Title: Asynchronous Workflows and Parallel FX
1Asynchronous Workflows and Parallel FX
2Calling Web Service using Asynchronous Workflows
3Calling Web Services
- Demonstration of calling a web service
synchronously and asynchronously using workflows - This demonstration will analyse
- Changes in the code required
- How the results are effected
- How is performance effected
4Asynchronous Workflows and Web Services
let getAtoms() let pt new
PeriodicTableWS.periodictable() let atoms
pt.GetAtoms() let atoms getNodeContentsList
atoms "/NewDataSet/Table/ElementName"
atoms
let getAtoms async let pt new
PeriodicTableWS.periodictable() let!
atoms pt.GetAtomsAsync() let atoms
getNodeContentsList atoms
"/NewDataSet/Table/ElementName"
return atoms
5Where did the Async Come From?
- The programmer must add these to the web service
proxies
type PeriodicTableWS.periodictable with
member ws.GetAtomsAsync()
Async.BuildPrimitive(ws.BeginGetAtoms,
ws.EndGetAtoms)
type PeriodicTableWS.periodictable with
member ws.GetAtomicWeighAsync(s)
Async.BuildPrimitive(s,
ws.BeginGetAtomicWeight,
ws.EndGetAtomicWeight)
6Demo
7Interpreting the Results
Asynchronous .NET Thread 1Get Element Data
List .NET Thread 6Got 112 Elements .NET Thread
11Get Data For Actinium .NET Thread 11Get
Data For Aluminium .NET Thread 10Get Data For
Americium .NET Thread 11Get Data For
Antimony .NET Thread 11Get Data For
Argon ... .NET Thread 6Actinium 227 .NET
Thread 6Aluminium 26.9815 .NET Thread
6Americium 243 .NET Thread 6Antimony
121.75 .NET Thread 6Arsenic 74.9216 .NET
Thread 6Astatine 210 ...
Synchronous .NET Thread 1Get Element Data
List .NET Thread 1Got 112 Elements .NET Thread
1Get Data For Actinium .NET Thread 1Actinium
227 .NET Thread 1Get Data For Aluminium .NET
Thread 1Aluminium 26.9815 .NET Thread 1Get
Data For Americium .NET Thread 1Americium
243 .NET Thread 1Get Data For Antimony .NET
Thread 1Antimony 121.75 .NET Thread 1Get Data
For Argon .NET Thread 1Argon 39.948 .NET
Thread 1Get Data For Arsenic ... ...
8The Timings
9Option Pricing using Parallel FX Futures
10What is Parallel FX?
- A library currently under development that
provides - Data Parallelism
- Task Parallelism
- A common work scheduler
- Last release was December 2007 CTP
11What is Options Pricing?
- An Option is finical contract that gives the
right, but not the obligation, to buy something - Option Pricing is calculating the current value
of an option contact - ... but dont worry about the details this
provides computational work that needs
parallelizing
12What is a Future?
- Future is a Task that calculates a result
13Evolution of the Code
- Synchronous programming
- Improving responsiveness using BackgroundWorker
- Work queuing using Futures
14Evolution of the GUI
- Old style GUI shows one set of parameters and
result
- Queuing style GUI shows all parameters and
results
15Demo
16Summary
- Asynchronous Workflows Tackle working with
asynchronous programming model - Parallel FX Tackles data and task based
concurrency
17Resources
- Asynchronous Workflows
- http//www.infoq.com/articles/pickering-fsharp-wor
kflow - http//www.strangelights.com/blog/
- http//blogs.msdn.com/dsyme
- Parallel FX
- http//msdn2.microsoft.com/en-us/concurrency/defau
lt.aspx - http//www.bluebytesoftware.com/blog/Default.aspx