Chasing zero allocations in a Zig web framework
November 22, 2025
I wanted a microservice framework that doesn’t fight me — one with strong opinions, a small dependency surface, and the kind of performance you only get from a language that doesn’t hide allocations from you. That’s how Zero started.
Zero is a web framework written in Zig, built on top of http.zig. The goal in its name is literal: aim for zero allocations and zero memory leaks on the hot path.
What it bundles
Instead of leaving you to glue libraries together, Zero ships the things most internal tools need, opt-in:
- REST / CRUD out of the box
- Authentication — Basic, API Key, OAuth 2.0
- Logging, metrics, tracing (TraceID middleware)
- Databases — PostgreSQL, SQLite, Redis
- Pub/Sub — MQTT, Kafka
- Migrations and seeding
- Cron jobs with second-level and range support
- WebSockets
- Static files and an embedded Swagger UI
- Health and liveness endpoints
Everything is configuration-driven via .env with per-environment overrides. Features activate only when you uncomment them.
How it benchmarks
The baseline run, with logging disabled, sits around ~83,000 req/s over 100 seconds with 100 concurrent connections:
8344879 requests in 1m39s
Requests/sec: 83747.67
Fastest: 84µs
Avg: 1.193ms
Even with metrics + logging + tracing all enabled, it holds around ~16,500 req/s. The framework is designed so you can trade observability for raw throughput by turning knobs, not by rewriting code.
Why Zig
I spend my days in Go and JavaScript. Zig is the opposite end of the spectrum — no hidden allocations, no garbage collector, comptime everywhere. Writing Zero was a way to understand what a microservice framework looks like when you control every byte.
The source and examples live at github.com/im-ng/zero.
Written as part of zero.