A lightweight, high-performance HTTP server written in pure C, designed for speed and scalability.
It uses epoll for efficient I/O multiplexing and a thread pool for concurrency, allowing it to handle thousands of simultaneous connections with minimal overhead.
- Ultra-lightweight: Minimal dependencies, written in pure C.
- Fast Endpoints:
GET /
→ responds with raw text"OK"
.GET /stats
→ responds with real-time JSON statistics:total_connections
: total number of connections since server start.rps
: requests per second (updated every second).
- High Concurrency: Combines
epoll
with multi-threading for maximum throughput. - Optimized for Linux: Uses non-blocking sockets and atomic counters.
- Linux-based system
- GCC (supporting C11 standard)
- POSIX threads (pthread)
git clone https://github.com/VryptLab/http-server.git
make clear && make
./server
By default, the server listens on port 8080.
-
Access the root endpoint:
curl http://localhost:8080/
Response:
OK
-
Access server statistics:
curl http://localhost:8080/stats
Example response:
{ "total_connections": 42, "rps": 7 }
- Designed to handle high numbers of concurrent connections using
epoll
(edge-triggered I/O). - Multithreaded with a thread pool equal to the number of CPU cores.
- Atomic counters ensure safe, lock-free statistics tracking.
- Benchmarking and load testing tools.
- Educational reference for building scalable servers in C.
- Lightweight alternative to heavy HTTP frameworks.
This project is released under the MIT License.
You are free to use, modify, and distribute it as long as the license terms are respected.