ehttpd
Welcome to ehttpd
🎉
ehttpd
is a thread-based HTTP server library, which can be used to create custom HTTP server applications.
The rationale behind the thread-based approach is that it is much easier to implement than async/await
, subsequently requires less codes, and is – in theory – less error prone.
Furthermore, it also simplifies application development since the developer cannot accidentally stall the entire runtime
with a single blocking call – via the OS' scheduler, threads offer much strong concurrency isolation guarantees, which
in most environments can even be nice
d or tweaked if appropriate.
While the thread-based approach is not the most efficient out there, it's not that bad either. Some wrk
benchmarks:
M1 Pro
, helloworld
)ignore
$ wrk -t 64 -c 64 http://localhost:9999/testolope
Running 10s test @ http://localhost:9999/testolope
64 threads and 64 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 0.98ms 346.32us 13.64ms 89.26%
Req/Sec 1.03k 125.94 1.38k 70.02%
662807 requests in 10.10s, 32.87MB read
Requests/sec: 65622.88
Transfer/sec: 3.25MB
Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz
, helloworld-nokeepalive
)ignore
$ wrk -t 64 -c 64 http://localhost:9999/testolope
Running 10s test @ http://localhost:9999/testolope
64 threads and 64 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 2.31ms 1.31ms 79.98ms 97.48%
Req/Sec 419.80 73.74 2.03k 94.15%
268421 requests in 10.10s, 18.18MB read
Requests/sec: 26579.74
Transfer/sec: 1.80MB