Rust-Powered Engine

Hurricane 2.0 replaced Tornado's legacy Python asyncio event loop with a high-performance HTTP engine built directly on Rust’s Hyper and Tokio runtimes, powered by Granian.


Architecture Overview

Rendering diagram...

Why Rust Over Python Event Loops?

Previous versions of Hurricane used Tornado to bridge asynchronous networking with Django's synchronous WSGI layer. Under high concurrency, Python's single-threaded event loop became a bottleneck:

  1. GIL Contention: Switching between Python coroutines and worker thread pools incurred high CPU context-switching overhead.
  2. Buffer Saturation: Large file uploads or request storms flooded Python's memory heap before threads could process them.
  3. Event Loop Starvation: Blocking C libraries or compute-heavy tasks temporarily froze probe responsiveness.

With Hurricane's Rust Engine (powered by Granian)

  • Rust Handles the Network: Socket connection management, TLS termination, HTTP 1.1/2 parsing, and keep-alive pools run entirely in compiled Rust (Granian) without touching Python or the Global Interpreter Lock (GIL).
  • Native Thread Workers: For WSGI applications, Hurricane manages OS worker threads directly from Rust via Granian's native worker architecture, invoking the WSGI callable only when a worker thread is free.
  • Zero-Copy File Streaming: Static and media files are streamed with minimal memory footprint.

Zero-Config Unified Asynchronous Front-Door

Hurricane runs on a unified Tokio-based asynchronous front-door, automatically auto-detecting your application structure:

Rendering diagram...
  • Zero Configuration: Simply run python manage.py serve. Hurricane boots the high-performance Granian ASGI engine on the network edge.
  • Async & Channels Projects: If ASGI_APPLICATION is configured, requests run natively as coroutines on the Tokio event loop.
  • Classic Django Projects: Traditional synchronous views (WSGI_APPLICATION) execute across a fully parallel ThreadPoolExecutor via FastWsgiToAsgi, eliminating asgiref's single-thread serialization trap.

⚡ Comparative Benchmarks: Hurricane 1.x (Tornado) vs. Hurricane 2.0 (Granian Rust Engine)

We pit the classic Tornado-based Hurricane against the new Rust-powered Hurricane 2.0 (using Granian) under identical high-concurrency conditions with Locust:

MetricHurricane 1.x (Tornado)Hurricane 2.0 (Granian Engine) 🦀Difference
False Readiness Failures (HTTP 400)160 flapping events0 events-100.0% (Eliminated!)
Peak Throughput (RPS)313.3 req/s630.9 req/s+101.4% (2x faster)
P50 Median Latency130.0 ms66.0 ms-49.2% (Half the wait)
P99 Tail Latency220.0 ms120.0 ms-45.5% faster
Probe Latency Under Load170.0 ms94.0 ms-44.7% faster

Under heavy traffic, Hurricane 1.x mistook pending asyncio task counts for saturated request backlogs, triggering 160 false unready events that pulled pods out of service endpoints. Hurricane 2.0's Granian Rust engine completely eliminates false unready flaps while doubling throughput.

Reproduce & Run Benchmarks

Explore the reproducible benchmark suite, load scenarios, and raw result datasets at django-hurricane/django-hurricane-bench on GitHub.