Lauris Jullien - Asynchronous network requests in a web application [EuroPython 2016] [21 July 2016] [Bilbao, Euskadi, Spain] (https://ep2016.europython.eu//conference/talks/asynchronous-network-requests-in-a-web-application)
Introducing asynchronous calls from within an endpoint in a web app can be desirable but hard to achieve. This talk will explore different solutions for this (running Twisted event loop, Co-Routines, Asyncio, …) and how well they play with the different parallelization models of common WSGI web servers.
In the more and more popular SOA paradigm, it’s common for services to have to compose responses with resources from many different services. Everyone’s first idea will probably be to call each service synchronously with your favorite python HTTP library. This unfortunately doesn’t scale well and tens of successive network calls will make your endpoints painfully slow.
One solution is to parallelize these network calls. If you are already using an asynchronous web app (such as Tornado or Twisted), more asynchronous in your asynchronous shouldn’t be much of a challenge. But if you chose not to dive into the madness of chained Deferred calls, and used a standard prefork/threaded WSGI web server (such as Gunicorn or uWSGI) to run your Django/Flask/Pyramid application, you might find yourself wondering how to manage these asynchronous calls.
This talk will explore different solutions (running Twisted event loop, Co-Routines, Asyncio, …) and how well they play with the different parallelization models of WSGI web servers.