Command Palette<br>Search for a command to run...
Back to articles
backendperformancedjangorust<br>June 3, 2026
Porting our Django backend to Rust improved the infra usage by 90%
Syrus Akbary<br>Founder & CEO
At Wasmer, we have been happily using Django for 7 years (it was the backend we initially used for storing the package information when wapm.io was the only dynamic website Wasmer had). However, in the last year the backend started showing issues as usage started to grow .
At its peak, the Django backend required more than 800 GB of memory and 220 CPUs to serve normal production load. Our traffic was not extremely high, so this was a clear signal to look at ways to improve it.
The high load put a big strain on the infrastructure we need to have the site operating, and as well on our small 1-person team that maintains the infrastructure.
At the end, we decided to rewrite our 7-year-old Django backend to Rust. It’s an effort that took one person about 3 months full time (with AI assistance), and involved more team members as the Rust backend started to become more stable.
Here’s some TL;DR of the improvements:
MetricDjangoRustChangeCompute CPUs22024-89%Average CPU utilization80%30%-62.5%RAM800 GB64 GB-92%DB connectionsThousandsHundreds3–5x fewerQuery latencyBaseline5–10x faster5–10xStartup time>60s worst case1 s~60x fasterp95 API latency120 ms30 ms-75%
We measured these numbers by comparing production usage before and after the migration under similar traffic patterns. The numbers below refer to backend compute capacity, memory allocation, DB connection pressure, startup time, and API latency
What issues did we have with Django?
Even though you can use await in the ORM queries, Django doesn’t really support async database connections and cursors (see issue on Django repo), which slowed down significantly the response times when mixed up with GraphQL
Over time, Python’s gradual typing was not enough for us: Any and partially typed dependencies made type safety hard to enforce.
Easy mismatch between types on Wasmer Backend and Wasmer Edge (Edge is built in Rust)
Slow startup times. At its worst, startup times were over a minute
Also, our own practices didn’t help (this issues are not related to Django itself):
We have time pressure to deliver , which usually means that people will do shortcuts for developing (often on typing)… which caused a terrible codebase over time
The backend was missing strong building principles (it was a Frankestein maintained by different people with different programming maturity and different expertises during many years)
We have no Python expert in-house (only me, Syrus, creator of Graphene GraphQL framework for Python… but that was not enough as nowadays I can’t be as present on the code as earlier in time)
These issues made the backend increasingly difficult to maintain in the last year. We tried to solve the problem by adding more money into it, however we hit some hard limits that money can’t solve.
Not everything was bad though, we did some great things in our backend:
API was properly abstracted by using GraphQL (none of our clients needed changes after the rewrite)
Django Admin panel made super easy to inspect and quickly fix things.<br>Note: We haven’t figured out how to do this properly with Rust. It’s likely we will leverage AI for creating new Dashboards
Celery and task schedulers worked surprisingly well
Fast iteration times
How the old backend was architected:
Django with different product silos: Users, Registry, Edge, Domains, …
Django for the ORM
Graphene and Graphene-Django (note: I’m the creator of those frameworks, perhaps this is why it was hard for me to let go our Python backend!)
Celery as the task scheduler
Python native libraries for local encryption
Custom Github API client
Django Admin panel
Why Rust, Why Now
We decided to use Rust to rewrite our backend for this reasons:
Team is already expert in Rust , thus we can improve the bus factor for the backend and have a shared expertise of the backend in our team
AI tools helped automate much of the mechanical migration work, especially for translating straightforward model and business logic from Python to Rust
Good opportunity to have strong abstraction and strong typing
Reusability of libraries (for example, we can reuse easily the package validation mechanisms we already have in the Wasmer Runtime)
Incredibly fast startup times (important for cold starts)
How the new Rust backend is architected:
A Rust workspace split into focused crates:
Tech silos / architecture: db, graphql, cache, iam/users, admin, tasks
Products: Apps, Blog, Mailer
SeaORM for the ORM
Async-GraphQL for the GraphQL server
Apalis for the Task scheduler
Fernet for local encryption
Octocrab for the Github integration
Tailadmin components for the AI-generated admin panel
Note: to be clear, we could have ported to FastAPI + SQLAlchemy and see similar gains, but we decided a new rewrite with better...