Offline

Python and HTTP/3: feel the difference in performance

Track:
Web Development, Web APIs, Front-End Integration
Type:
Talk
Level:
intermediate
Duration:
30 minutes
View in the schedule

Abstract

Python and HTTP/3: feel the difference in performance

Abstract

Building real-time Python applications, from live dashboards to multiplayer games, often feels like a battle against an invisible lag. While we focus on optimizing our async code, the underlying transport protocol often sabotages us: TCP guarantees ordering at the absolute cost of responsiveness.

In this session, I will show that the standard choice of using Websocket over HTTP/1.1 or HTTP/2 can make the application perform horribly, due to the "head-of-line blocking" problem that is visible when the network is unstable. Then I will present how HTTP/3 and WebTransport eliminate transport-layer bottlenecks and enable seamless connection migration for network switching users. The audience will experience the difference between protocols performance firsthand through a live three-round multiplayer snake game demo.

Description

The Problem

Application performance is a complex challenge. Users often complain about lag, and regardless of how well we optimize our business logic, the issue persists. All too often, the blame is shifted to the client for having a "spotty network." However, even under ideal conditions, users experience disruptions simply by being mobile, due to switching between Wi-Fi access points or cellular towers. The core problem is that many developers are unaware of the limitations of HTTP/1.1 and HTTP/2, or that implementing HTTP/3 might be a solution.

Why This is Interesting to the Python Community

As Python applications become more real-time and data-intensive, traditional networking stacks are reaching their limits. There are important advances in technology that the audience should get familiar with, like HTTP/3, QUIC, and WebTransport. What is also important, is to be aware of how the Python ecosystem is still fragmented when it comes to supporting HTTP/3. Despite that, a solution is achievable, and by using a combination of Starlette and aioquic code across three generations of transport protocols, the audience will experience and learn how protocol choice dictates application reliability on imperfect networks.

Key takeaways:

  • Witness an app suffering from transport-layer head-of-line blocking.
  • Understand the Python HTTP/3 ecosystem, including aioquic, Hypercorn, and Starlette.
  • Deploy a HTTP/3 server handling WebTransport datagrams for real-time data.
  • Learn how to use Linux traffic control (tc) to inject some chaos to the network
  • Play multiplayer Snake!

Resources