Relayouter: A Lightning-Fast HTTP Server Written in Assembly
Ever wondered how fast a web server could be if you stripped away all the abstractions and wrote it in raw assembly? Meet Relayouter—a minimal, multi-process HTTP server that’s built entirely in x86-64 assembly using FASM. No libc, no bloat, just pure speed.
This isn’t just a proof of concept—it’s a functional server that handles static files, uses epoll for non-blocking I/O, and parallelizes across CPU cores. If you’ve ever wanted to see how close to the metal you can take a web server, this is it.
What It Does
Relayouter is a tiny (~5.3 KiB) nginx-like server that:
- Serves static files from a
./publicdirectory. - Spawns multiple processes (one per CPU core) for parallelism.
- Uses raw Linux syscalls—no external dependencies.
- Handles URL decoding and MIME type detection.
It’s designed to be as lean as possible while still being practical for local development or lightweight hosting.
Why It’s Cool
- Raw Performance: By skipping libc and writing directly in assembly, Relayouter minimizes overhead.
- Multi-Process Architecture: Unlike single-threaded servers, it scales across CPU cores.
epollfor Efficiency: Uses Linux’sepollsyscall for high-performance I/O multiplexing.- Educational Value: A great codebase to study if you’re curious about low-level networking or syscalls.
That said, the author notes it’s not production-ready yet—there are bugs, and it’s "very easily exploitable." But for tinkering or learning? Perfect.
How to Try It
git clone https://github.com/peachey2k2/relayouter.git
cd relayouter
make build # Compile the server
make run # Start it (listens on http://localhost:8080)
Drop files into ./public, and they’ll be served instantly.
Final Thoughts
Relayouter is a fascinating project—not because you should replace nginx with it, but because it shows how much you can do with so little. It’s a reminder of what’s possible when you ditch abstractions and embrace the bare metal.
If you’re into systems programming, give it a look. And if you’re brave, maybe even contribute to the todo list (edge-triggered epoll, anyone?).
Follow @githubprojects for more cool projects.