async/await: tpl & message pumps

21
TPL & Message Pumps Welcome webinar

Upload: particular-software

Post on 24-Jan-2017

221 views

Category:

Software


3 download

TRANSCRIPT

Page 1: Async/Await: TPL & Message Pumps

TPL & Message PumpsWelcome

webinar

Page 2: Async/Await: TPL & Message Pumps

Part 2Async webinar series

Page 3: Async/Await: TPL & Message Pumps

Solution Architect

Enthusiastic Software Engineer

Microsoft MVP for systems integration

@danielmarbach

particular.net/blog

planetgeek.ch

Page 5: Async/Await: TPL & Message Pumps

RecapUse Task.Run, Factory.StartNew for

CPU-bound work

Use Task directly for IO-bound work

Use async Task instead of async voidreminder

Page 6: Async/Await: TPL & Message Pumps

RecapLibraries and frameworks should use

ConfigureAwait(false)

Async all the way, don’t mix blocking and asynchronous code

reminder

Page 7: Async/Await: TPL & Message Pumps

GoalsCombine async/await with the TPL

Throttling your concurrent operations

Graceful shutdowns

target

Page 8: Async/Await: TPL & Message Pumps

The Pump Code WrapUp

Page 9: Async/Await: TPL & Message Pumps

The Pump Code WrapUp

Page 10: Async/Await: TPL & Message Pumps

Message Pump

Queue

Your code

Page 11: Async/Await: TPL & Message Pumps

The Pump Code WrapUp

Page 12: Async/Await: TPL & Message Pumps

Demoawait

Page 13: Async/Await: TPL & Message Pumps

Semaphore

gated

Page 14: Async/Await: TPL & Message Pumps

Demoawait

Page 15: Async/Await: TPL & Message Pumps

The Pump Code WrapUp

Page 16: Async/Await: TPL & Message Pumps

RecapPrefer Task.Run over Factory.StartNew

Use CancellationToken to cancel

operations inside tasks

Use SemaphoreSlim to throttle instead

of a custom TaskSchedulerreminder

Page 17: Async/Await: TPL & Message Pumps

RecapDon’t use LongRunning or

AttachToParent for Tasks with async

operations

Non-blocking all the way, to maximize throughputreminder

Page 18: Async/Await: TPL & Message Pumps

Next

particular.net/async-await-webinar-series

Page 19: Async/Await: TPL & Message Pumps

github.com/danielmarbach/03-03-2016-AsyncWebinar

Slides, Links…

Page 20: Async/Await: TPL & Message Pumps

Q & Aawait

Page 21: Async/Await: TPL & Message Pumps

Thanks