Tornado Framework — ELI5
Imagine an old-fashioned telephone switchboard operator. Instead of connecting one call, waiting for it to finish, then connecting the next, the operator plugs in multiple calls at once and switches attention between them. Nobody has to wait for the person before them to hang up.
Tornado is a Python web framework that works like that operator. It was created by the team at FriendFeed (later acquired by Facebook) back in 2009 to handle their real-time feed — where thousands of users needed instant updates at the same time.
Most websites work like a conversation: your browser asks a question, the server answers, done. But some apps need a constant connection — like a chat app, a live sports score page, or a stock ticker. The server needs to keep many connections open simultaneously and send updates whenever something changes.
Tornado was designed specifically for this. While other Python tools of that era could handle maybe a few hundred connections at a time, Tornado could manage tens of thousands. It did this by using a technique called non-blocking I/O — instead of waiting around for slow things (like reading from a database), it notes what it’s waiting for and goes to help the next connection.
What’s interesting about Tornado is its age. It existed years before Python added the async/await syntax. Tornado had its own way of doing async programming using callbacks and coroutines. When Python caught up with official async support, Tornado adapted to use it too.
Today, Tornado powers parts of Facebook’s infrastructure and is used by companies that need to hold thousands of open connections simultaneously.
The one thing to remember: Tornado is a battle-tested Python framework designed for real-time applications that need to keep many connections open at the same time.
See Also
- Python Aiohttp Client Understand Aiohttp Client through a practical analogy so your Python decisions become faster and clearer.
- Python Api Client Design Why building your own API client in Python is like creating a TV remote that only has the buttons you actually need.
- Python Api Documentation Swagger Swagger turns your Python API into an interactive playground where anyone can click buttons to try it out — no coding required.
- Python Api Mocking Responses Why testing with fake API responses is like rehearsing a play with stand-ins before the real actors show up.
- Python Api Pagination Clients Why APIs send data in pages, and how Python handles it — like reading a book one chapter at a time instead of swallowing the whole thing.