What Is Async, How Does It Work, And When Should I Use It?*
"Asynchronous" or "non-blocking" frameworks like Tornado and Node.js are in fashion, but most programmers still don't have a rigorous understanding of what's meant by asynchronous, how these frameworks function, and when they're appropriate to use. I'll give a detailed tour of Tornado's event loop and show exactly how it works, and under what circumstances it's superior to a traditional multithreaded web server. You'll learn how to write the most efficient servers for modern apps with very large numbers of concurrent connections.
Why is async hot now? Contemporary web apps trend towards web sockets and service-oriented architectures, which require very high numbers of concurrent connections, which makes async more necessary than before. There are a number of asynchronous frameworks available. I’ll demo a popular one for Python: Tornado.
An async framework like Tornado allows a single thread to efficiently interleave concurrent I/O operations, using an event loop. I’ll walk through the code for Tornado’s event loop so you thoroughly understand the underlying process, and so you can forever avoid the mortal sin of blocking the event loop.
Once you grok the foundations of Tornado, you’ll understand how asynchronous frameworks work in general and be ready to build very high-performance modern web applications.
I've spoken at several Python Meetups, at the Chicago WindyCityDB conference, at the PyGotham conference, and at two MongoDB conferences. My talks have covered three topics: MongoDB; asynchronous frameworks; and Motor, my asynchronous driver for Tornado and MongoDB. Four times, I've taught 2-day-long training sessions on programming with MongoDB. I've also spoken at 10gen internal meetings, staff training sessions, and customer consultations.
Here's a video of me explaining how Motor works. It briefly covers some material on asynchronous frameworks and Tornado, which I'll expand into the talk I would like to give at Open Source Bridge:
If you start at 2:15 you'll see the seed of a longer talk about async.
Staff Engineer at MongoDB in New York City specializing in C, Python, and async. Lead developer of the MongoDB C Driver libraries libbson and libmongoc. Author of Motor, an async MongoDB driver for Tornado and asyncio. Contributor to Python, PyMongo, MongoDB, Tornado, and asyncio. Co-author with Guido van Rossum of “A Web Crawler With asyncio Coroutines”, a chapter in the Architecture of Open Source Applications series.
- Title: What Is Async, How Does It Work, And When Should I Use It?
- Track: Chemistry
- Room: B201
- Time: 2:30 – 3:15pm
“Asynchronous” or “non-blocking” frameworks like Tornado and Node.js are in fashion, but most programmers still don’t have a rigorous understanding of what’s meant by asynchronous, how these frameworks function, and when they’re appropriate to use. I’ll give a detailed tour of Tornado’s event loop and show exactly how it works, and under what circumstances it’s superior to a traditional multithreaded web server. You’ll learn how to write the most efficient servers for modern apps with very large numbers of concurrent connections.
- Speakers: A. Jesse Jiryu Davis