SlideShare a Scribd company logo
1 of 19
Asynchrony in (ASP).NET Aliaksandr Famin [email_address] @AlexSane
Developer and a Kettle
Developer and a Kettle ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Comparison Approach Transferring 1K, rps Transferring 1M, rps Sync 2844,44 100% 32,57 26% Async with callbacks 2547,26 90% 125,97 100% Async - sync 2327,28 82% 33,04 26% Sync with threads 861,23 30% 83,89 67% Async with threads 604,84 21% 80,36 64%
Evolution: WinAPI ,[object Object],[object Object]
Evolution: .NET 1.0 – 1.1 ,[object Object],[object Object],[object Object],[object Object]
Evolution: .NET 2.0 – …  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Evolution: .NET 4.0 ,[object Object]
IAsyncResult vs Events ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],ContextAwareResult, but no guarantee
Event-based async pattern SyncronizationContext Thread #1 XAsync YAsync Thread #3 YCompleted Thread #2 ZAsync Thread #4 ZCompleted AsyncOperationManager PreRenderComplete PreRender X Y XCompleted Z All operations are completed
TTT #1: Use closures ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
TTT#2: Use userState carefully ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
TTT#3: Unsubscribe from events ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
TTT#5: There is no timeout support in both async patterns
TTT#6 AsyncResult callbacks don’t have HttpContext ,[object Object]
TTT#7 Do not convert event-based pattern to IAsyncResult one ,[object Object]
TTT #8: Do not use [ThreadStatic] ,[object Object]
TTT#9: Do not throw exceptions in callbacks ,[object Object]
Q&A

More Related Content

What's hot

Introduction to RxJS
Introduction to RxJSIntroduction to RxJS
Introduction to RxJSBrainhub
 
Building serverless application on the Apache Openwhisk platform
Building serverless application on the Apache Openwhisk platformBuilding serverless application on the Apache Openwhisk platform
Building serverless application on the Apache Openwhisk platformLucio Grenzi
 
Reactive stream processing using Akka streams
Reactive stream processing using Akka streams Reactive stream processing using Akka streams
Reactive stream processing using Akka streams Johan Andrén
 
C# 5 deep drive into asynchronous programming
C# 5 deep drive into asynchronous programmingC# 5 deep drive into asynchronous programming
C# 5 deep drive into asynchronous programmingPraveen Prajapati
 
Learn You a ReactiveCocoa for Great Good
Learn You a ReactiveCocoa for Great GoodLearn You a ReactiveCocoa for Great Good
Learn You a ReactiveCocoa for Great GoodJason Larsen
 
Next generation actors with Akka
Next generation actors with AkkaNext generation actors with Akka
Next generation actors with AkkaJohan Andrén
 
Networks and types - the future of Akka
Networks and types - the future of AkkaNetworks and types - the future of Akka
Networks and types - the future of AkkaJohan Andrén
 
Asynchronous JavaScript and Promises
Asynchronous JavaScript and Promises Asynchronous JavaScript and Promises
Asynchronous JavaScript and Promises Senthil Kumar
 
Reactive streams processing using Akka Streams
Reactive streams processing using Akka StreamsReactive streams processing using Akka Streams
Reactive streams processing using Akka StreamsJohan Andrén
 
RxJava applied [JavaDay Kyiv 2016]
RxJava applied [JavaDay Kyiv 2016]RxJava applied [JavaDay Kyiv 2016]
RxJava applied [JavaDay Kyiv 2016]Igor Lozynskyi
 
Reactive cocoa made Simple with Swift
Reactive cocoa made Simple with SwiftReactive cocoa made Simple with Swift
Reactive cocoa made Simple with SwiftColin Eberhardt
 
Next generation message driven systems with Akka
Next generation message driven systems with AkkaNext generation message driven systems with Akka
Next generation message driven systems with AkkaJohan Andrén
 
ReactiveCocoa in Practice
ReactiveCocoa in PracticeReactiveCocoa in Practice
ReactiveCocoa in PracticeOutware Mobile
 
ReactiveCocoa Goodness - Part I of II
ReactiveCocoa Goodness - Part I of IIReactiveCocoa Goodness - Part I of II
ReactiveCocoa Goodness - Part I of IImanuelmaly
 
JavaOne 2013: Java 8 - The Good Parts
JavaOne 2013: Java 8 - The Good PartsJavaOne 2013: Java 8 - The Good Parts
JavaOne 2013: Java 8 - The Good PartsKonrad Malawski
 
Process control nodejs
Process control nodejsProcess control nodejs
Process control nodejsLearningTech
 
ReactiveCocoa and Swift, Better Together
ReactiveCocoa and Swift, Better TogetherReactiveCocoa and Swift, Better Together
ReactiveCocoa and Swift, Better TogetherColin Eberhardt
 
Intro to ReactiveCocoa
Intro to ReactiveCocoaIntro to ReactiveCocoa
Intro to ReactiveCocoakleneau
 
An Introduction to Reactive Cocoa
An Introduction to Reactive CocoaAn Introduction to Reactive Cocoa
An Introduction to Reactive CocoaSmartLogic
 

What's hot (20)

Introduction to RxJS
Introduction to RxJSIntroduction to RxJS
Introduction to RxJS
 
Building serverless application on the Apache Openwhisk platform
Building serverless application on the Apache Openwhisk platformBuilding serverless application on the Apache Openwhisk platform
Building serverless application on the Apache Openwhisk platform
 
Reactive stream processing using Akka streams
Reactive stream processing using Akka streams Reactive stream processing using Akka streams
Reactive stream processing using Akka streams
 
C# 5 deep drive into asynchronous programming
C# 5 deep drive into asynchronous programmingC# 5 deep drive into asynchronous programming
C# 5 deep drive into asynchronous programming
 
Learn You a ReactiveCocoa for Great Good
Learn You a ReactiveCocoa for Great GoodLearn You a ReactiveCocoa for Great Good
Learn You a ReactiveCocoa for Great Good
 
Next generation actors with Akka
Next generation actors with AkkaNext generation actors with Akka
Next generation actors with Akka
 
Networks and types - the future of Akka
Networks and types - the future of AkkaNetworks and types - the future of Akka
Networks and types - the future of Akka
 
Asynchronous JavaScript and Promises
Asynchronous JavaScript and Promises Asynchronous JavaScript and Promises
Asynchronous JavaScript and Promises
 
Reactive streams processing using Akka Streams
Reactive streams processing using Akka StreamsReactive streams processing using Akka Streams
Reactive streams processing using Akka Streams
 
RxJava applied [JavaDay Kyiv 2016]
RxJava applied [JavaDay Kyiv 2016]RxJava applied [JavaDay Kyiv 2016]
RxJava applied [JavaDay Kyiv 2016]
 
AMC Minor Technical Issues
AMC Minor Technical IssuesAMC Minor Technical Issues
AMC Minor Technical Issues
 
Reactive cocoa made Simple with Swift
Reactive cocoa made Simple with SwiftReactive cocoa made Simple with Swift
Reactive cocoa made Simple with Swift
 
Next generation message driven systems with Akka
Next generation message driven systems with AkkaNext generation message driven systems with Akka
Next generation message driven systems with Akka
 
ReactiveCocoa in Practice
ReactiveCocoa in PracticeReactiveCocoa in Practice
ReactiveCocoa in Practice
 
ReactiveCocoa Goodness - Part I of II
ReactiveCocoa Goodness - Part I of IIReactiveCocoa Goodness - Part I of II
ReactiveCocoa Goodness - Part I of II
 
JavaOne 2013: Java 8 - The Good Parts
JavaOne 2013: Java 8 - The Good PartsJavaOne 2013: Java 8 - The Good Parts
JavaOne 2013: Java 8 - The Good Parts
 
Process control nodejs
Process control nodejsProcess control nodejs
Process control nodejs
 
ReactiveCocoa and Swift, Better Together
ReactiveCocoa and Swift, Better TogetherReactiveCocoa and Swift, Better Together
ReactiveCocoa and Swift, Better Together
 
Intro to ReactiveCocoa
Intro to ReactiveCocoaIntro to ReactiveCocoa
Intro to ReactiveCocoa
 
An Introduction to Reactive Cocoa
An Introduction to Reactive CocoaAn Introduction to Reactive Cocoa
An Introduction to Reactive Cocoa
 

Viewers also liked

Sylvipastoral Systems
Sylvipastoral SystemsSylvipastoral Systems
Sylvipastoral SystemsTeresa Fresu
 
Monkey climb Reg
Monkey climb RegMonkey climb Reg
Monkey climb Regbbchsllynch
 
Ayuntamiento De Jubrique
Ayuntamiento De JubriqueAyuntamiento De Jubrique
Ayuntamiento De Jubriquebertha reyes
 
Безопасность бизнес-приложений
Безопасность бизнес-приложенийБезопасность бизнес-приложений
Безопасность бизнес-приложенийDigital Security
 
Curriculum for Resuscitation Education - Univ.of Florida - Gainesville 2010
Curriculum for Resuscitation Education -  Univ.of Florida -  Gainesville 2010Curriculum for Resuscitation Education -  Univ.of Florida -  Gainesville 2010
Curriculum for Resuscitation Education - Univ.of Florida - Gainesville 2010Eric B. Bauman
 
Lugares para conocer
Lugares para conocerLugares para conocer
Lugares para conocerPaola Lopez
 
How to Install, Use, and Customize Drush
How to Install, Use, and Customize DrushHow to Install, Use, and Customize Drush
How to Install, Use, and Customize DrushAcquia
 
Nutrientes OrgáNicos
Nutrientes OrgáNicosNutrientes OrgáNicos
Nutrientes OrgáNicosconstanzast
 
Owain Glyndwr Ysgol Evan James
Owain  Glyndwr  Ysgol  Evan  JamesOwain  Glyndwr  Ysgol  Evan  James
Owain Glyndwr Ysgol Evan JamesLearn Politics
 
Curriculum bicentenario cristián martínez
Curriculum bicentenario cristián martínezCurriculum bicentenario cristián martínez
Curriculum bicentenario cristián martínezCristián Martínez
 
Trabalho de informatica nicaele e rafaella
Trabalho de informatica nicaele e rafaellaTrabalho de informatica nicaele e rafaella
Trabalho de informatica nicaele e rafaellarafaduarte1511
 
Presentacion SFLT Eje comunicación
Presentacion SFLT Eje comunicaciónPresentacion SFLT Eje comunicación
Presentacion SFLT Eje comunicaciónLuis RB
 
"Overview on the Future of Benchmarking 2030 Project" by Bruce Searles
"Overview on the Future of Benchmarking 2030 Project" by Bruce Searles"Overview on the Future of Benchmarking 2030 Project" by Bruce Searles
"Overview on the Future of Benchmarking 2030 Project" by Bruce SearlesDubai Quality Group
 
Ayo goyang dumang
Ayo goyang dumangAyo goyang dumang
Ayo goyang dumangarwinsabtu
 

Viewers also liked (20)

Sylvipastoral Systems
Sylvipastoral SystemsSylvipastoral Systems
Sylvipastoral Systems
 
Monkey climb Reg
Monkey climb RegMonkey climb Reg
Monkey climb Reg
 
Ayuntamiento De Jubrique
Ayuntamiento De JubriqueAyuntamiento De Jubrique
Ayuntamiento De Jubrique
 
Quintero vargas
Quintero vargasQuintero vargas
Quintero vargas
 
Безопасность бизнес-приложений
Безопасность бизнес-приложенийБезопасность бизнес-приложений
Безопасность бизнес-приложений
 
Curriculum for Resuscitation Education - Univ.of Florida - Gainesville 2010
Curriculum for Resuscitation Education -  Univ.of Florida -  Gainesville 2010Curriculum for Resuscitation Education -  Univ.of Florida -  Gainesville 2010
Curriculum for Resuscitation Education - Univ.of Florida - Gainesville 2010
 
Lugares para conocer
Lugares para conocerLugares para conocer
Lugares para conocer
 
How to Install, Use, and Customize Drush
How to Install, Use, and Customize DrushHow to Install, Use, and Customize Drush
How to Install, Use, and Customize Drush
 
Moneysukh report on margins for tuesday 9/3/2010
Moneysukh report on margins for tuesday 9/3/2010Moneysukh report on margins for tuesday 9/3/2010
Moneysukh report on margins for tuesday 9/3/2010
 
Nutrientes OrgáNicos
Nutrientes OrgáNicosNutrientes OrgáNicos
Nutrientes OrgáNicos
 
Owain Glyndwr Ysgol Evan James
Owain  Glyndwr  Ysgol  Evan  JamesOwain  Glyndwr  Ysgol  Evan  James
Owain Glyndwr Ysgol Evan James
 
Sydney ppp.pptx nicholas
Sydney ppp.pptx nicholasSydney ppp.pptx nicholas
Sydney ppp.pptx nicholas
 
Curriculum bicentenario cristián martínez
Curriculum bicentenario cristián martínezCurriculum bicentenario cristián martínez
Curriculum bicentenario cristián martínez
 
Trabalho de informatica nicaele e rafaella
Trabalho de informatica nicaele e rafaellaTrabalho de informatica nicaele e rafaella
Trabalho de informatica nicaele e rafaella
 
Presentacion SFLT Eje comunicación
Presentacion SFLT Eje comunicaciónPresentacion SFLT Eje comunicación
Presentacion SFLT Eje comunicación
 
IV-JamesWeber-Beauty
IV-JamesWeber-BeautyIV-JamesWeber-Beauty
IV-JamesWeber-Beauty
 
quirky machine.
quirky machine.quirky machine.
quirky machine.
 
"Overview on the Future of Benchmarking 2030 Project" by Bruce Searles
"Overview on the Future of Benchmarking 2030 Project" by Bruce Searles"Overview on the Future of Benchmarking 2030 Project" by Bruce Searles
"Overview on the Future of Benchmarking 2030 Project" by Bruce Searles
 
Ayo goyang dumang
Ayo goyang dumangAyo goyang dumang
Ayo goyang dumang
 
Quiromasaje
QuiromasajeQuiromasaje
Quiromasaje
 

Similar to Evolution of asynchrony in (ASP).NET

Sync with async
Sync with  asyncSync with  async
Sync with asyncprabathsl
 
Akka.NET streams and reactive streams
Akka.NET streams and reactive streamsAkka.NET streams and reactive streams
Akka.NET streams and reactive streamsBartosz Sypytkowski
 
Device Simulator with Akka
Device Simulator with AkkaDevice Simulator with Akka
Device Simulator with AkkaMax Huang
 
SystemVerilog Assertion.pptx
SystemVerilog Assertion.pptxSystemVerilog Assertion.pptx
SystemVerilog Assertion.pptxNothing!
 
pdx-react-observables
pdx-react-observablespdx-react-observables
pdx-react-observablesIan Irvine
 
Formal Verification of Transactional Interaction Contract
Formal Verification of Transactional Interaction ContractFormal Verification of Transactional Interaction Contract
Formal Verification of Transactional Interaction ContractGera Shegalov
 
Anton Moldovan "Load testing which you always wanted"
Anton Moldovan "Load testing which you always wanted"Anton Moldovan "Load testing which you always wanted"
Anton Moldovan "Load testing which you always wanted"Fwdays
 
Advanced patterns in asynchronous programming
Advanced patterns in asynchronous programmingAdvanced patterns in asynchronous programming
Advanced patterns in asynchronous programmingMichael Arenzon
 
Reactive programming every day
Reactive programming every dayReactive programming every day
Reactive programming every dayVadym Khondar
 
Parallel Processing
Parallel ProcessingParallel Processing
Parallel ProcessingRTigger
 
Ece 415 control systems, fall 2021 computer project 1
Ece 415 control systems, fall 2021 computer project  1 Ece 415 control systems, fall 2021 computer project  1
Ece 415 control systems, fall 2021 computer project 1 ronak56
 
Asynchronous programming done right - Node.js
Asynchronous programming done right - Node.jsAsynchronous programming done right - Node.js
Asynchronous programming done right - Node.jsPiotr Pelczar
 
동기화 시대를 뛰어넘는 비동기 프로그래밍
동기화 시대를 뛰어넘는 비동기 프로그래밍동기화 시대를 뛰어넘는 비동기 프로그래밍
동기화 시대를 뛰어넘는 비동기 프로그래밍명신 김
 
Deep Dive async/await in Unity with UniTask(EN)
Deep Dive async/await in Unity with UniTask(EN)Deep Dive async/await in Unity with UniTask(EN)
Deep Dive async/await in Unity with UniTask(EN)Yoshifumi Kawai
 

Similar to Evolution of asynchrony in (ASP).NET (20)

Sync with async
Sync with  asyncSync with  async
Sync with async
 
Akka.NET streams and reactive streams
Akka.NET streams and reactive streamsAkka.NET streams and reactive streams
Akka.NET streams and reactive streams
 
Rx workshop
Rx workshopRx workshop
Rx workshop
 
Tdd iPhone For Dummies
Tdd iPhone For DummiesTdd iPhone For Dummies
Tdd iPhone For Dummies
 
Device Simulator with Akka
Device Simulator with AkkaDevice Simulator with Akka
Device Simulator with Akka
 
SystemVerilog Assertion.pptx
SystemVerilog Assertion.pptxSystemVerilog Assertion.pptx
SystemVerilog Assertion.pptx
 
Rxjs swetugg
Rxjs swetuggRxjs swetugg
Rxjs swetugg
 
Rxjs marble-testing
Rxjs marble-testingRxjs marble-testing
Rxjs marble-testing
 
pdx-react-observables
pdx-react-observablespdx-react-observables
pdx-react-observables
 
Formal Verification of Transactional Interaction Contract
Formal Verification of Transactional Interaction ContractFormal Verification of Transactional Interaction Contract
Formal Verification of Transactional Interaction Contract
 
Anton Moldovan "Load testing which you always wanted"
Anton Moldovan "Load testing which you always wanted"Anton Moldovan "Load testing which you always wanted"
Anton Moldovan "Load testing which you always wanted"
 
Advanced patterns in asynchronous programming
Advanced patterns in asynchronous programmingAdvanced patterns in asynchronous programming
Advanced patterns in asynchronous programming
 
Rxjs ngvikings
Rxjs ngvikingsRxjs ngvikings
Rxjs ngvikings
 
Reactive programming every day
Reactive programming every dayReactive programming every day
Reactive programming every day
 
Parallel Processing
Parallel ProcessingParallel Processing
Parallel Processing
 
Ece 415 control systems, fall 2021 computer project 1
Ece 415 control systems, fall 2021 computer project  1 Ece 415 control systems, fall 2021 computer project  1
Ece 415 control systems, fall 2021 computer project 1
 
Asynchronous programming done right - Node.js
Asynchronous programming done right - Node.jsAsynchronous programming done right - Node.js
Asynchronous programming done right - Node.js
 
React hooks
React hooksReact hooks
React hooks
 
동기화 시대를 뛰어넘는 비동기 프로그래밍
동기화 시대를 뛰어넘는 비동기 프로그래밍동기화 시대를 뛰어넘는 비동기 프로그래밍
동기화 시대를 뛰어넘는 비동기 프로그래밍
 
Deep Dive async/await in Unity with UniTask(EN)
Deep Dive async/await in Unity with UniTask(EN)Deep Dive async/await in Unity with UniTask(EN)
Deep Dive async/await in Unity with UniTask(EN)
 

Evolution of asynchrony in (ASP).NET

  • 1. Asynchrony in (ASP).NET Aliaksandr Famin [email_address] @AlexSane
  • 3.
  • 4. Comparison Approach Transferring 1K, rps Transferring 1M, rps Sync 2844,44 100% 32,57 26% Async with callbacks 2547,26 90% 125,97 100% Async - sync 2327,28 82% 33,04 26% Sync with threads 861,23 30% 83,89 67% Async with threads 604,84 21% 80,36 64%
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10. Event-based async pattern SyncronizationContext Thread #1 XAsync YAsync Thread #3 YCompleted Thread #2 ZAsync Thread #4 ZCompleted AsyncOperationManager PreRenderComplete PreRender X Y XCompleted Z All operations are completed
  • 11.
  • 12.
  • 13.
  • 14. TTT#5: There is no timeout support in both async patterns
  • 15.
  • 16.
  • 17.
  • 18.
  • 19. Q&A