Cerveur is an HTTP/1.1 server written in C and released as open source under the MIT licence that gives each CPU core its own event loop, runs every connection as a coroutine and, when a core gets busy, hands its heaviest connections to a quieter one by passing a pointer, even in the middle of a request. Its author, AI and systems engineer Manuel Capel, built it to see how far a few good ideas can go without a large runtime, and is asking for help measuring it on other machines, especially on Linux.
Cerveur key points in 20 seconds
- What it is: an HTTP/1.1 server in C with WebSockets, SSE and pub/sub, as a binary or a library.
- Key idea: one reactor per core, one coroutine per connection and load rebalancing every 250 ms.
- Numbers: 83,700 requests/s on a Windows laptop; Linux has not been benchmarked yet.
In his first tests, according to the author, the server used roughly half the CPU per small request of a minimal Rust server built with Axum. He stresses that those figures come from a single laptop, which is why the project is looking for data from other machines.
One reactor per core, and connections that move
The server starts one pinned thread per CPU, or as many threads as you choose, each with its own event loop. On Linux it uses level-triggered epoll with non-blocking recv and send, and each reactor has its own SO_REUSEPORT listener, so the kernel spreads new connections across threads. On Windows it uses I/O completion ports (IOCP) with overlapped WSARecv and WSASend. The README does not mention io_uring or kqueue.
Each connection is a stackless coroutine from the STC library, and an idle connection takes about 17 KB. Handlers are coroutines too, awaiting body chunks, output buffer space, WebSocket messages, timers or pub/sub mail. HTTP parsing is done by llhttp, the same parser Node.js uses.
The most distinctive part is rebalancing. Every 250 ms, each core measures its load; if it is clearly the busiest, it hands its heaviest connections to the least-loaded core, even mid-request. On Linux the migration is a pointer handoff through the target core’s inbox. On Windows it costs a bit more, because the socket has to move to the other reactor’s completion port and pending reads are cancelled.
What it includes and what it leaves out on purpose
It supports keep-alive, pipelining, chunked bodies, Expect: 100-continue, 400, 413 and 431 errors, lingering close, a router with path parameters and wildcards, RFC 6455 WebSockets, SSE, timers, pub/sub, PROXY protocol v1 and v2, X-Forwarded-For and -Proto headers from trusted proxies, and graceful shutdown. It deliberately leaves out TLS, HTTP/2 and HTTP/3: the idea is to run it behind a reverse proxy, and the repository ships example configs for Caddy, nginx and HAProxy.
To build it you need STC’s coroutine.h and the llhttp release branch next to server.c; the deploy/fetch_deps.sh script fetches both. Then compile with gcc:
git clone https://github.com/mancap314/cerveur
cd cerveur
./deploy/fetch_deps.sh
# compile server.c and the three llhttp sources with gcc -pthread -std=gnu11
./server [options] [port] [threads]Code language: PHP (php)Build flags let you use it as a library (SERVER_NO_MAIN), size the response buffer (OUT_CAP) or count syscalls per request (IO_STATS). The project ships HTTP, WebSocket, pub/sub and proxy test suites, sanitizer runs, fuzz targets and CI on Linux and Windows.
The benchmarks, fine print included
| Scenario | Requests/s | p50 / p99 latency | CPU per request |
|---|---|---|---|
| GET /, 64 keep-alive connections | 83,700 | 0.58 / 4.6 ms | 12 µs |
| GET /, new TCP connection per request | 5,400 | 5.0 / 28 ms | 81 µs |
| Streaming about 19 KB, 16 connections | 11,600 (219 MB/s) | 1.1 / 6.1 ms | 134 µs |
| POST with 64 KB bodies, 16 connections | 21,300 (1.4 GB/s) | 0.55 / 4.5 ms | 63 µs |
The figures come from a 2-core, 4-thread Intel i3 laptop running Windows 11, over loopback, with the server pinned to two cores and the oha load generator on the other two. Each number is the median of five 4-second runs, with other programs using about half the machine, and run-to-run noise reached 10-30%. Against a minimal Axum 0.8 server, Cerveur used about half the CPU per small request and per new connection, while Axum moved large bodies about 10% more cheaply. The author points out that Axum does far more, with HTTP/2, TLS and middleware, so the comparison covers only the core HTTP/1.1 path.
For operators, the value lies more in the ideas than in replacing nginx or a mature framework today: isolate work per core, move connections instead of blocking, and leave TLS to the proxy. The Linux build has no published benchmarks yet, so anyone who tries it on a real server can contribute the first numbers.
Frequently asked questions
What is Cerveur?
An open-source, MIT-licensed HTTP/1.1 server in C with one event loop per core and one coroutine per connection.
Does it support HTTPS?
Not directly. TLS, HTTP/2 and HTTP/3 are left to a reverse proxy such as Caddy, nginx or HAProxy.
Which platforms does it run on?
Linux with epoll and Windows 10 1703 or later with IOCP. The published benchmarks are Windows-only.
Is it faster than Axum?
In the author’s tests it used about half the CPU per small request, but Axum was slightly more efficient with large bodies and offers many more features.
Sources:
- GitHub: mancap314/cerveur
- Manuel Capel’s LinkedIn post introducing the project
