Skip to content

Latest commit

 

History

20 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

epoll-http-server

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.

Install

git clone https://github.com/mayankd101/epoll-http-server.git
cd epoll-http-server

Build

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

Run

./build/http_server --port 8080 --threads 4 --static-dir static

Then visit http://localhost:8080 or curl http://localhost:8080/metrics.

Test

g++ -std=c++17 -Iinclude tests/test_http_parser.cpp src/http_parser.cpp -o build/test_http_parser
./build/test_http_parser

Benchmark

g++ -std=c++17 -O2 -pthread tools/bench_client.cpp -o build/bench_client
./build/bench_client --threads 8 --requests 5000

About

Multi-threaded C++ HTTP/1.1 server using epoll and a thread-per-core reactor architecture

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages