👉 TL;DR
If you simply want the most raw performance per MB of RAM and per CPU-cycle, nothing currently beats native, ahead-of-time-compiled languages that have no garbage collector:
• C / C++ – fastest, tiniest footprint, but easy to shoot yourself in the foot.
• Rust – ~C performance, memory-safe, slightly heavier binaries but still tiny compared with a VM.
For a “pragmatic sweet-spot” (great performance, minimal memory, fast build-deploy loop, easy concurrency) Go is usually the next best pick.
Beyond that, runtimes with a VM/GC (JVM, .NET, BEAM, V8, CPython, etc.) tend to need noticeably more RAM to get similar throughput, though many can be tuned to do surprisingly well.
- Comparing the usual suspects
(The numbers below are representative averages from the latest TechEmpower “Plaintext” / “JSON” benchmarks, containerized on a 4-core/16 GB host. They fluctuate, but the relative ordering is stable.)
| Tier | Language (Typical framework) | Req/s (JSON) | RSS Mem (MB) | Notes |
|---|
| 🏎️ 1 | C (h2o), C++ (drogon) | 4–7 M | 2–8 MB | Zero GC, SIMD hand-tuning possible |
| 🏎️ 1 | Rust (actix-web, hyper) | 4–6 M | 3–10 MB | Memory safety, async/await native |
| 🚀 2 | Go (fasthttp, fiber) | 2–3 M | 5–15 MB | 1 goroutine ≈ 2 kB; GC very fast |
| ⚖️ 2 | Zig (bun HTTP, self-roll) | 2–3 M | 3–12 MB | Similar to Rust; still maturing |
| ⚡ 3 | Java (Netty, Quarkus native) | 1–2 M | 60–120 MB | JIT good for long-running services; AOT (GraalVM native-image) cuts mem to 15–40 MB but sacrifices peak speed |
| ⚡ 3 | Kotlin (Ktor, Netty) | 0.8–1.5 M | 80–150 MB | JVM footprints apply |
| 💡 3 | C# (.NET 7, Kestrel) | 1–2 M | 70–140 MB | Can AOT to trimmed native single-file ~30 MB |
| 🔄 3 | Elixir/Erlang (Phoenix) | 0.6–1 M | 50–90 MB | Tiny 1–2 kB “processes”, great soft-realtime |
| ⏳ 4 | Node.js (Fastify, uWebSockets) | 0.2–0.7 M | 40–120 MB | Event loop, libuv; GC pauses can spike |
| 🐢 5 | Python (uvicorn, FastAPI) | 0.05–0.15 M | 60–150 MB | GIL bounds CPU, great for I/O heavy |
| 🐢 5 | Ruby (Falcon, Rails) | 0.04–0.1 M | 80–200 MB | |
| 🐢 5 | PHP 8 (RoadRunner) | 0.05–0.12 M | 50–140 MB | JIT helps a bit, still PHP syntax |
Key take-aways
• Order-of-magnitude differences exist: C/Rust/Go can do millions of req/s at <20 MB, whereas Python/Ruby typically need 10× the hardware for the same throughput.
• Framework choice inside the same language can move the needle 2-3×.
• JVM/.NET can reach “native-ish” speed, but only after you’ve given the GC breathing room (≥1 GB recommended for latency-sensitive production).
- What “most performant per resource” really means
CPU efficiency
• Eliminating runtime indirection (virtual machines, reflection) and GC pauses keeps instructions retired per request low.
• JITs (HotSpot, V8) can partially offset the overhead but need warm-up and memory to store JIT-ted code.
Memory efficiency
• No VM = no per-object bookkeeping and no GC roots → fewer pages touched, fewer cache misses.
• Languages with segmented/arena/stack allocation (C, Rust, Zig) win big here.
Concurrency model
• Green-threads (goroutines, Erlang processes) ≈ thousands of concurrent tasks with very little memory each.
• Event loops (Node, Python async) are light, but single-threaded by default—needs clustering to scale across cores.
• OS threads (Java, C++ without fibers) add 0.5–2 MB per stack; too many and you’re out of RAM fast.
- Picking for YOUR situation
| If you… | Consider |
|---|
| Need absolute bare-metal speed and can invest in low-level safety checks yourself | C/C++ (with sanitizers) |
| Want near-C speed but refuse to fight seg-faults | Rust |
| Need small single-binary deploys, lightning-fast compile-run cycles, and simple concurrency | Go |
| Already have JVM infra and 256 MB+ per container is fine | Java (Netty, Quarkus), Kotlin |
| Need soft-realtime chat / messaging with 100k+ concurrent sockets | Elixir/Erlang |
| Team writes mostly TypeScript, can live with higher RAM | Node.js + uWebSockets/Fastify |
| Optimizing dev velocity over hardware cost | Python (FastAPI), Ruby on Rails, etc. |
Edge Cases
• Serverless: Cold-start time trumps sustained throughput. Rust, Go, and GraalVM-native Java shine (<100 ms).
• Memory-capped IoT gateway (<64 MB): Rust or C built with musl, or tiny Go static binary.
• FaaS billed by MB-sec: Rust tends to be cheapest, followed by Go, then Java (Native), then Node, Python.
-
Extra knobs that often matter more than language choice
-
Use an efficient HTTP library (e.g., fasthttp > net/http in Go, actix-web > Rocket in Rust).
-
Turn on compiler optimizations (-O3 for clang/gcc, -C opt-level=z for size-optimized Rust).
-
Cut syscalls: pool DB connections, reuse buffers, prefer HTTP keep-alive.
-
Profile & tune memory (jemalloc vs. tcmalloc, GOGC, JVM -Xms/-Xmx, ZGC vs. G1).
-
Run behind an async reverse proxy (Caddy, Nginx, Envoy) to soak up slow TLS handshakes.
Bottom line
• For tiny VPS or edge devices, Rust (or C/C++) gives you the absolute least-resource backend.
• For 90 % of green-field web APIs where you still care about memory, Go is often the happiest compromise.
• Once you move beyond ~4 GB RAM per service, the difference blurs and you’ll pick based on ecosystem and team skills more than raw efficiency.
Hope that helps you size up the landscape! 🚀