Skip to main content

Demystifying AsyncIO: Building Your Own Event Loop in Python

30 minutes


AsyncIO has emerged as a vital tool in Python’s ecosystem, particularly in web development, IO-bound tasks, and network programming. However, its internal mechanics often remain obscure, even to seasoned Python developers. This talk aims to demystify AsyncIO by guiding you through creating your own event loop in Python, culminating in running a FastAPI application with it.

In this talk, we’ll build an event loop from scratch in Python, capable of running an HTTP server through a FastAPI application.


  • Introduction to AsyncIO
  • Core Concepts: Deep dive into Event loop, Futures, Tasks, and coroutines
  • Hands-On Building: Constructing an event loop from scratch
    • Scheduling callbacks
    • Executing tasks and coroutines
    • Handling network calls
  • Practical Application: Running a FastAPI HTTP server with our loop
  • Performance Insights: Comparing our event loop with the fastest ones

By the end of this talk, you’ll be able to understand the internal workings of AsyncIO and create a basic event loop capable of running a FastAPI application.

The speaker

Arthur Pastel

Arthur Pastel

Hi, I’m Arthur, a software engineer based in Paris 🇫🇷🥖

I worked as an engineer in a few tech companies over the past years, mostly building software with Python, but I’m also passionate about (too ??) many other software fields.

I’m an Open source enthusiast and love to contribute when possible. 2 years ago, I built ODMantic, an ODM for MongoDB & Python. It’s a kind of ORM but built on top of Pydantic to provide a seamless model definition and integration with FastAPI.

Last year, I founded CodSpeed, a Continuous Performance Analysis solution helping tech companies and Open-Source projects prevent performance issues directly in their CI pipelines.