Django has always been called “slow” — at least from my 4 years dealing with it. Despite all the “batteries included”, the verdict I kept hearing was “not fast enough for future scale”. So I started wondering: do I give up on it and jump to a “fast” framework like NodeJS, Go or Rust?
But wait. If Django is so slow, why are big players like Instagram and Pinterest still running on it? And so began my research.
📚Pre-requisite to know before jumping in:
- Concurrency means 1 worker juggling many tasks.
- Parallelism means many workers, many tasks.
- Then there are two kinds of work:
- I/O bound is when you’re just waiting on the DB or network — like staring at a toaster, waiting for the toast to pop.
- CPU bound is when you’re actively doing the work — like grinding coffee beans by hand.
- “Sync” is 1 worker doing 1 task only, no concurrency;
- E.g. Kopitiam Uncle made coffee, put toasts into toast maker, and watch it until it’s done, then he only take another customer order.
- Async is 1 worker handling many tasks, with an event loop acting as the “coordinator”: whenever a task gets stuck waiting on I/O, the worker would’ve gone idle, so the event loop hands it another task instead. Then the process keep on repeating;
- E.g. Kopitiam Uncle made coffee, put toasts into toast maker, then go take the other customers order; When toast “ping” back, then only uncle will go and collect the finished toast.
Ok now, Django is only “slow” when traffic gets huge📈
With 1 request (assume normal api call, not heavy cpu or i/o bound), every framework is basically the same speed. The “slow” only shows up under volume.
- E.g. we have 100k requests, each needing 1 second of I/O and 1 second of CPU.
In WSGI mode (sync), Django’s 1 worker handles 1 task at a time — 2 seconds per task, so 200k seconds to clear the queue.
In ASGI mode (async) — whether Django or FastAPI — async hides the I/O second (cause it’s able to jump around to serve other request), but the CPU second still queues up. That’s 1 second per task, so 100k seconds. Half the time, same machine.
Then why is Python code execution itself slower than Go or Rust?
Three reasons.
**1.🔒The Global Interpreter Lock (GIL).**Python has the Global Interpreter Lock — a lock inside CPython with one brutal rule: only ONE thread can execute Python bytecode at any moment. So Python multi-threading is useless for CPU-bound work (still fine for I/O bound), because 2 threads touching the same object at the same time = problematic. To get true parallelism, you need multi-process. Go, meanwhile, gets true parallelism out of the box, with a concurrency model baked right in — goroutines.
So 1 core vs 8 cores in executing same Python code (that require CPython), essentially have the same performance, cause in this scenario of 8 cores, 7 cores will stay idle due to GIL.
To mitigate this, we will need to use multi-processing (True parallelism in Python, spawing another separated process, that have separate GIL)
2.🕴️The middleman. Python compiles your code into bytecode, then the CPU runs CPython, which executes that bytecode instruction by instruction — at runtime. Go and Rust compile to machine code BEFORE deploy, so the CPU runs it directly. No middleman.
**3.🏷️Dynamic typing.**For every a + b, Python has to ask at runtime: “what is a? An int? A string? A list? Which + do I use?”. Go and Rust know the types at compile time, so they emit one direct CPU add instruction. Zero questions asked.
So… is Python doomed in webapp?
Not at all. Yes, Python is “slower” at serving requests — but it can still comfortably serve startups and medium-sized companies. Everything is a trade-off: Django is fast to develop, batteries included, performance can be catch up via stronger infra setup. Go and Rust are comparatively slower to build, but serve faster on the same infra.
Verdict
Speed matters. But shipping matters more. Don’t dump Django for speed alone. Grow until a specific service actually hits a performance wall — say, 10k requests per second — then extract that one service and replace it with something more efficient like Java, Go, or Rust.
TLDR
Instagram didn’t ditch Django — they cloned it across thousands of servers. The real re-work in databases and caches got sharded, replaced, rebuilt to support huge request volume.
Suggestion? Master 1 framework, understand the rest; It helps when you understand the pros and cons, and make better decision in future.