Tornado is a non-blocking light-weight web server and framework. There's been many introductory talks about it, and it's time to look deeper into it: not just what Tornado does, but how it does it and what can we learn from it when designing our own concurrent systems.
In this talk I go over the following topics. I cover them in two parts: first I present how to use a certain feature or approach in our applications; then, I dig into Tornado's source code to see how it really works.
- Getting Started: quickly get a simple Tornado application up and running. We'll keep digging into, changing and poking this Application for most of the talk.
- An Application Listens: what an Application is, how does Tornado start it and how does it process its requests.
- Application and IOLoop: we'll look at how the IOLoop receives the connections from the users and passes them on to the Applications.
- Scheduled Tasks: we'll see how to schedule tasks and how the IOLoop will run them.
- Generators: we'll learn to use generators to handle the responses of our asynchronous calls, and how they work with the IOLoop.
- Websockets: how to use them and how they work.
- IOStream: how do Tornado's non-blocking sockets work.
- Database: how to use non-blocking sockets to connect to databases.
- Process: how Tornado works with multiple processes.
I presented this talk at Europython 2012 and PyGrunn 2012.
Code examples: https://bitbucket.org/grimborg/tornado-in-depth/src/tip/examples/