Running Python on Rust: Granian as a Production App Server

LinkMichael KennedyResource

In Chapter 6 of his book 'Python in Production', Michael Kennedy explains the deployment of Granian as an HTTP server for Python applications. Built with Rust, Granian replaces legacy tools like uWSGI, excelling in benchmarks through consistent low tail latency and dual support for WSGI and ASGI.

Key points

  1. uWSGI is no longer supported and should be retired from modern Python production deployments according to Kennedy.
  2. Gunicorn remains a solid lightweight choice for WSGI-only workloads, while Uvicorn handles ASGI standalone as of August 2024 without requiring Gunicorn.
  3. Granian wraps the battle-tested Rust Hyper library, offering support for WSGI, ASGI/3, and RSGI across HTTP/1 and HTTP/2.
  4. The primary driver for adopting Granian was lower tail latency, showing a 2.8x ratio between average and max latency compared to 6.8x in Uvicorn.
  5. Scaling at Talk Python relies on web gardens (multiple processes to navigate the GIL) in Docker containers running uvloop.

Why it matters

Tail latency and runtime overhead remain core challenges for Python web applications. Rust-backed application servers like Granian provide high-performance networking and stable response times without requiring modifications to standard framework code.

Analysis

Kennedy highlights a pragmatic infrastructure shift from legacy tools towards Rust-assisted networking layers. Because Granian adheres strictly to standard WSGI and ASGI protocols, switching requires no application code changes—only an update to container entrypoints or systemd configurations. The shared production configuration illustrates how pairing multi-worker process models with uvloop achieves consistent performance despite Python's GIL.

Found in

Summary generated by AI (Gemini 3.8 Flash, 27 September 2026). It may contain errors – the original source is authoritative.

Similar in content, found by the AI search.

  • Repository:emmett-framework/granian

    Granian: A Rust HTTP Server for Python Applications

    Granian is a high-performance HTTP server for Python applications built in Rust using Hyper and Tokio. It supports ASGI, WSGI, and RSGI interfaces, aiming to replace complex dependency stacks like Gunicorn plus Uvicorn with a single, fast binary package.

    5.6kstarsRust

    Web development· Tool

  • Link:uvicorn.dev

    Uvicorn: ASGI Web Server for Python

    The official documentation for Uvicorn introduces the asynchronous Python web server, which implements the ASGI specification and supports HTTP/1.1 and WebSockets.

    Web development· Tool

  • Repository:Kludex/uvicorn

    Uvicorn: Asynchronous ASGI Web Server for Python

    Uvicorn is a lightweight Python web server implementing the ASGI specification with support for HTTP/1.1 and WebSockets.

    10.9kstarsPython

    Web development· Tool

  • Link:Tiangolo

    FastAPI: Running a Server Manually

    FastAPI's official documentation outlines the manual execution of server programs and ASGI servers.

    Web development· Resource

  • Article:Daroc Alden

    Rust in CPython: Debate Sparked Over Gradual Integration

    Python core developers Emma Smith and Kirill Podoprigora have proposed introducing Rust into CPython. Following community concerns regarding platform support and maintenance overhead, the timeline to make Rust a mandatory dependency has been postponed indefinitely.

    Web development· Discussion

  • Link:Emma Smith

    Rust for CPython: Making Python Safer and More Robust

    A PyCon US 2026 presentation covers the Rust for CPython initiative, which explores integrating Rust into CPython to replace legacy C code, targeting memory and thread unsafety.

    Security· Talk

Let's talk about your project

Locations

  • Mattersburg
    Johann Nepomuk Bergerstraße 7/2/14
    7210 Mattersburg, Austria
  • Vienna
    Ungargasse 64-66/3/404
    1030 Wien, Austria

Parts of this content were created with the assistance of AI.