A multi-threaded HTTP/1.1 server written in C++17 using raw epoll and a thread-per-core reactor architecture.
Features: non-blocking I/O, persistent (keep-alive) connections, static
file serving, HEAD/GET support, and a /metrics endpoint with live latency
percentiles.
git clone https://github.com/mayankd101/epoll-http-server.git
cd epoll-http-server
mkdir -p build
g++ -std=c++17 -O2 -Wall -Wextra -pthread -Iinclude \
src/main.cpp src/thread_pool.cpp src/http_parser.cpp src/http_response.cpp \
src/reactor.cpp src/metrics.cpp src/logger.cpp \
-o build/http_server
./build/http_server --port 8080 --threads 4 --static-dir static
Then visit http://localhost:8080 or curl http://localhost:8080/metrics.
g++ -std=c++17 -Iinclude tests/test_http_parser.cpp src/http_parser.cpp -o build/test_http_parser
./build/test_http_parser
g++ -std=c++17 -O2 -pthread tools/bench_client.cpp -o build/bench_client
./build/bench_client --threads 8 --requests 5000