SlideShare a Scribd company logo
1 of 12
Download to read offline
Python Toronto : Sep 2018
Final Frontier in
Python : Async
Ankit Mittal - @ankitml
SwissBorg
Python has come a
long way in last 4 years
Generators were the original
final frontiers
Experiences from writing a crypto exchange in Async Python
Async Components
• RESTful API
• Websockets
• Order Matching Engine
• Accounting Engine
An async lament
3 Failed projects, until it did not
Starting up with async not a
painless activity
Asyncio: The hard parts
❖ New Syntax
❖ Architecture and abstractions
for async programs
❖ New terms : coroutines, tasks, event
loops, awaitables, executables, futures
❖ New Libraries
❖ One does not simply write
async and meet deadlines
The silver lining
❖ Real problem is not asyncio’s
complexity or learning curve
❖ Non blocking mental model is
hard, coming from years of
blocking python
❖ Non blocking abstractions take
time to marinate the brain
❖ All of these are learnable,
intuition starts appearing
❖ Concurrency without locks is a
major win
We might get new asyncio documentation soon.
Simultaneous Exhibition as Async execution
❖ Miguel Grinberg in his pycon talk explains
async mental model with a chess analogy
❖ A grandmaster needs to play 30
games. Other players responds in 5 minutes
for a turn and the game ends in 12 turns.
❖ Blocking Code: He plays them one
by one (30 hours)
❖ Non Blocking Code is like an
exhibition match, grandmaster does not
wait for player’s response and moves on to
the next game. Grandmaster himself
decides when he wants to move on to next
game. (This is explicit yield of control, act of
awaiting a task)
Eventual Simplicity
❖ After grokking async model
and its python abstractions
❖ Async model feels much
simpler than other concurrency
models
❖ Predictability arising from
explicit yield.
❖ Predictable outcomes makes it
much more accessible to real
world async problems
Time for a live Demo
Summing up :
❖ Ayncio’s Explicit non-blocking architecture
can give a big leverage to python programs.
❖ Its biggest problem is initial learning curve.
❖ Give it a try and embrace the new frontier in python.
❖ Product Team Stack: Scala, Akka, Reactive ecosystem
❖ Research Team Stack : Python, Financial Markets


(Hint: This is a hiring slide)
Thank You

More Related Content

What's hot

Powerlang: a Vehicle for Lively Implementing Programming Languages
Powerlang: a Vehicle for Lively Implementing Programming LanguagesPowerlang: a Vehicle for Lively Implementing Programming Languages
Powerlang: a Vehicle for Lively Implementing Programming LanguagesESUG
 
Summer Internship Project - Remote Render
Summer Internship Project - Remote RenderSummer Internship Project - Remote Render
Summer Internship Project - Remote RenderYen-Kuan Wu
 
[Question Paper] Advanced Java (75:25 Pattern) [April / 2016]
[Question Paper] Advanced Java (75:25 Pattern) [April / 2016][Question Paper] Advanced Java (75:25 Pattern) [April / 2016]
[Question Paper] Advanced Java (75:25 Pattern) [April / 2016]Mumbai B.Sc.IT Study
 
From Python to smartphones: neural nets @ Saint-Gobain, François Sausset
From Python to smartphones: neural nets @ Saint-Gobain, François SaussetFrom Python to smartphones: neural nets @ Saint-Gobain, François Sausset
From Python to smartphones: neural nets @ Saint-Gobain, François SaussetPôle Systematic Paris-Region
 
F# Ignite - DNAD2010
F# Ignite - DNAD2010F# Ignite - DNAD2010
F# Ignite - DNAD2010Rodrigo Vidal
 

What's hot (6)

Powerlang: a Vehicle for Lively Implementing Programming Languages
Powerlang: a Vehicle for Lively Implementing Programming LanguagesPowerlang: a Vehicle for Lively Implementing Programming Languages
Powerlang: a Vehicle for Lively Implementing Programming Languages
 
Summer Internship Project - Remote Render
Summer Internship Project - Remote RenderSummer Internship Project - Remote Render
Summer Internship Project - Remote Render
 
Fluent15
Fluent15Fluent15
Fluent15
 
[Question Paper] Advanced Java (75:25 Pattern) [April / 2016]
[Question Paper] Advanced Java (75:25 Pattern) [April / 2016][Question Paper] Advanced Java (75:25 Pattern) [April / 2016]
[Question Paper] Advanced Java (75:25 Pattern) [April / 2016]
 
From Python to smartphones: neural nets @ Saint-Gobain, François Sausset
From Python to smartphones: neural nets @ Saint-Gobain, François SaussetFrom Python to smartphones: neural nets @ Saint-Gobain, François Sausset
From Python to smartphones: neural nets @ Saint-Gobain, François Sausset
 
F# Ignite - DNAD2010
F# Ignite - DNAD2010F# Ignite - DNAD2010
F# Ignite - DNAD2010
 

Similar to Asyncio : Final frontier in python

11th Manila MuleSoft Meetup Dec 2021
11th Manila MuleSoft Meetup Dec 202111th Manila MuleSoft Meetup Dec 2021
11th Manila MuleSoft Meetup Dec 2021Ryan Anthony Andal
 
What is Python? An overview of Python for science.
What is Python? An overview of Python for science.What is Python? An overview of Python for science.
What is Python? An overview of Python for science.Nicholas Pringle
 
Python intro
Python introPython intro
Python introrik0
 
Proof-of-Stake & Its Improvements (San Francisco Bitcoin Devs Hackathon)
Proof-of-Stake & Its Improvements (San Francisco Bitcoin Devs Hackathon)Proof-of-Stake & Its Improvements (San Francisco Bitcoin Devs Hackathon)
Proof-of-Stake & Its Improvements (San Francisco Bitcoin Devs Hackathon)Alex Chepurnoy
 
Python @ PiTech - March 2009
Python @ PiTech - March 2009Python @ PiTech - March 2009
Python @ PiTech - March 2009tudorprodan
 
The Beam Vision for Portability: "Write once run anywhere"
The Beam Vision for Portability: "Write once run anywhere"The Beam Vision for Portability: "Write once run anywhere"
The Beam Vision for Portability: "Write once run anywhere"Knoldus Inc.
 
Python Experience in KKBOX Group
Python Experience in KKBOX GroupPython Experience in KKBOX Group
Python Experience in KKBOX GroupShuen-Huei Guan
 
DEF CON 24 - Allan Cecil and DwangoAC - tasbot the perfectionist
DEF CON 24 - Allan Cecil and DwangoAC -  tasbot the perfectionistDEF CON 24 - Allan Cecil and DwangoAC -  tasbot the perfectionist
DEF CON 24 - Allan Cecil and DwangoAC - tasbot the perfectionistFelipe Prado
 
Understanding concurrency
Understanding concurrencyUnderstanding concurrency
Understanding concurrencyAnshul Sharma
 
Python 3.5: An agile, general-purpose development language.
Python 3.5: An agile, general-purpose development language.Python 3.5: An agile, general-purpose development language.
Python 3.5: An agile, general-purpose development language.Carlos Miguel Ferreira
 
testmon for Python
testmon for Pythontestmon for Python
testmon for Pythontib0r
 
Harmonic Stack for Speed
Harmonic Stack for SpeedHarmonic Stack for Speed
Harmonic Stack for SpeedYung-Yu Chen
 
NE Scala 2016 roundup
NE Scala 2016 roundupNE Scala 2016 roundup
NE Scala 2016 roundupHung Lin
 
Aaa ped-1- Python: Introduction to AI, Python and Colab
Aaa ped-1- Python: Introduction to AI, Python and ColabAaa ped-1- Python: Introduction to AI, Python and Colab
Aaa ped-1- Python: Introduction to AI, Python and ColabAminaRepo
 
My talk on Piter Py 2016
My talk on Piter Py 2016My talk on Piter Py 2016
My talk on Piter Py 2016Alex Chistyakov
 
SAIG Overview March 2011
SAIG Overview March 2011SAIG Overview March 2011
SAIG Overview March 2011Luke Dicken
 

Similar to Asyncio : Final frontier in python (20)

11th Manila MuleSoft Meetup Dec 2021
11th Manila MuleSoft Meetup Dec 202111th Manila MuleSoft Meetup Dec 2021
11th Manila MuleSoft Meetup Dec 2021
 
What is Python? An overview of Python for science.
What is Python? An overview of Python for science.What is Python? An overview of Python for science.
What is Python? An overview of Python for science.
 
Sci computing using python
Sci computing using pythonSci computing using python
Sci computing using python
 
Python intro
Python introPython intro
Python intro
 
Proof-of-Stake & Its Improvements (San Francisco Bitcoin Devs Hackathon)
Proof-of-Stake & Its Improvements (San Francisco Bitcoin Devs Hackathon)Proof-of-Stake & Its Improvements (San Francisco Bitcoin Devs Hackathon)
Proof-of-Stake & Its Improvements (San Francisco Bitcoin Devs Hackathon)
 
Python @ PiTech - March 2009
Python @ PiTech - March 2009Python @ PiTech - March 2009
Python @ PiTech - March 2009
 
The Beam Vision for Portability: "Write once run anywhere"
The Beam Vision for Portability: "Write once run anywhere"The Beam Vision for Portability: "Write once run anywhere"
The Beam Vision for Portability: "Write once run anywhere"
 
Python Experience in KKBOX Group
Python Experience in KKBOX GroupPython Experience in KKBOX Group
Python Experience in KKBOX Group
 
DEF CON 24 - Allan Cecil and DwangoAC - tasbot the perfectionist
DEF CON 24 - Allan Cecil and DwangoAC -  tasbot the perfectionistDEF CON 24 - Allan Cecil and DwangoAC -  tasbot the perfectionist
DEF CON 24 - Allan Cecil and DwangoAC - tasbot the perfectionist
 
Bitcoin Price Prediction
Bitcoin Price PredictionBitcoin Price Prediction
Bitcoin Price Prediction
 
Understanding concurrency
Understanding concurrencyUnderstanding concurrency
Understanding concurrency
 
Python 3.5: An agile, general-purpose development language.
Python 3.5: An agile, general-purpose development language.Python 3.5: An agile, general-purpose development language.
Python 3.5: An agile, general-purpose development language.
 
testmon for Python
testmon for Pythontestmon for Python
testmon for Python
 
Harmonic Stack for Speed
Harmonic Stack for SpeedHarmonic Stack for Speed
Harmonic Stack for Speed
 
NE Scala 2016 roundup
NE Scala 2016 roundupNE Scala 2016 roundup
NE Scala 2016 roundup
 
Childhood Dream to Pi World Record by Emma Haruka, Developer Advocate @Google
Childhood Dream to Pi World Record by Emma Haruka, Developer Advocate @GoogleChildhood Dream to Pi World Record by Emma Haruka, Developer Advocate @Google
Childhood Dream to Pi World Record by Emma Haruka, Developer Advocate @Google
 
Why learn python in 2017?
Why learn python in 2017?Why learn python in 2017?
Why learn python in 2017?
 
Aaa ped-1- Python: Introduction to AI, Python and Colab
Aaa ped-1- Python: Introduction to AI, Python and ColabAaa ped-1- Python: Introduction to AI, Python and Colab
Aaa ped-1- Python: Introduction to AI, Python and Colab
 
My talk on Piter Py 2016
My talk on Piter Py 2016My talk on Piter Py 2016
My talk on Piter Py 2016
 
SAIG Overview March 2011
SAIG Overview March 2011SAIG Overview March 2011
SAIG Overview March 2011
 

Recently uploaded

"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 

Recently uploaded (20)

"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 

Asyncio : Final frontier in python

  • 1. Python Toronto : Sep 2018 Final Frontier in Python : Async Ankit Mittal - @ankitml SwissBorg
  • 2. Python has come a long way in last 4 years Generators were the original final frontiers
  • 3. Experiences from writing a crypto exchange in Async Python Async Components • RESTful API • Websockets • Order Matching Engine • Accounting Engine
  • 4. An async lament 3 Failed projects, until it did not Starting up with async not a painless activity
  • 5. Asyncio: The hard parts ❖ New Syntax ❖ Architecture and abstractions for async programs ❖ New terms : coroutines, tasks, event loops, awaitables, executables, futures ❖ New Libraries ❖ One does not simply write async and meet deadlines
  • 6. The silver lining ❖ Real problem is not asyncio’s complexity or learning curve ❖ Non blocking mental model is hard, coming from years of blocking python ❖ Non blocking abstractions take time to marinate the brain ❖ All of these are learnable, intuition starts appearing ❖ Concurrency without locks is a major win
  • 7. We might get new asyncio documentation soon.
  • 8. Simultaneous Exhibition as Async execution ❖ Miguel Grinberg in his pycon talk explains async mental model with a chess analogy ❖ A grandmaster needs to play 30 games. Other players responds in 5 minutes for a turn and the game ends in 12 turns. ❖ Blocking Code: He plays them one by one (30 hours) ❖ Non Blocking Code is like an exhibition match, grandmaster does not wait for player’s response and moves on to the next game. Grandmaster himself decides when he wants to move on to next game. (This is explicit yield of control, act of awaiting a task)
  • 9. Eventual Simplicity ❖ After grokking async model and its python abstractions ❖ Async model feels much simpler than other concurrency models ❖ Predictability arising from explicit yield. ❖ Predictable outcomes makes it much more accessible to real world async problems
  • 10. Time for a live Demo
  • 11. Summing up : ❖ Ayncio’s Explicit non-blocking architecture can give a big leverage to python programs. ❖ Its biggest problem is initial learning curve. ❖ Give it a try and embrace the new frontier in python.
  • 12. ❖ Product Team Stack: Scala, Akka, Reactive ecosystem ❖ Research Team Stack : Python, Financial Markets 
 (Hint: This is a hiring slide) Thank You