#web-server #applications-server #create #async #thread-based

ehttpd

A HTTP server nano-framework, which can be used to create custom HTTP server applications

21 unstable releases

Uses new Rust 2024

new 0.11.0 Dec 1, 2025
0.10.0 Oct 10, 2025
0.9.0 Oct 6, 2024
0.8.2 Jun 16, 2024
0.4.3 Mar 20, 2023

#267 in HTTP server

Download history 10/week @ 2025-08-13 45/week @ 2025-08-20 48/week @ 2025-08-27 53/week @ 2025-09-03 45/week @ 2025-09-10 43/week @ 2025-09-17 41/week @ 2025-09-24 49/week @ 2025-10-01 214/week @ 2025-10-08 48/week @ 2025-10-15 45/week @ 2025-10-22 21/week @ 2025-10-29 22/week @ 2025-11-05 23/week @ 2025-11-12 21/week @ 2025-11-19 74/week @ 2025-11-26

143 downloads per month
Used in 3 crates

BSD-2-Clause OR MIT

48KB
964 lines

License BSD-2-Clause License MIT AppVeyor CI docs.rs crates.io Download numbers dependency status

ehttpd

Welcome to ehttpd 🎉

ehttpd is a HTTP server library, which can be used to create custom HTTP server applications. It also offers an optional threadpool-based server for simple applications (feature: server, disabled by default).

Threadpool-based server

The rationale behind the thread-based approach is that it is much easier to implement than async/await, subsequently requires less code, and is – in theory – less error prone.

Furthermore, it also simplifies application development as the developer cannot accidentally stall the entire runtime with a single blocking call. Since threads are managed and preempted by the OS-scheduler, they offer much stronger concurrency guarantees, and are usually more resilient against optimization issues or bugs.

Performance

While the thread-based approach is not the most efficient out there, it's not that bad either. Some wrk benchmarks:

MacBook Pro (M1 Pro, v0.10.0)

$ 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   579.95us  474.19us  18.67ms   93.96%
    Req/Sec     1.89k   222.89     3.09k    78.08%
  1213288 requests in 10.11s, 60.17MB read
Requests/sec: 120063.69
Transfer/sec:      5.95MB

$ wrk -t 64 -c 64 http://localhost:9999/testolope-nokeepalive
Running 10s test @ http://127.0.0.1:9999/testolope-nokeepalive
  64 threads and 64 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     3.21ms   13.35ms 163.31ms   97.39%
    Req/Sec   351.54     84.78   500.00     89.42%
  184617 requests in 10.10s, 12.50MB read
  Socket errors: connect 64, read 3, write 0, timeout 0
Requests/sec:  18278.08
Transfer/sec:      1.24MB

Linux Machine (Intel(R) Core(TM) i5-10400F CPU @ 2.90GHz, v0.10.0)

$ 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   194.38us  138.51us  11.24ms   82.56%
    Req/Sec     5.44k   533.89     9.77k    78.54%
  3496971 requests in 10.10s, 173.42MB read
Requests/sec: 346246.07
Transfer/sec:     17.17MB

$ wrk -t 64 -c 64 http://localhost:9999/testolope-nokeepalive
Running 10s test @ http://localhost:9999/testolope-nokeepalive
  64 threads and 64 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   677.28us  355.42us  14.77ms   89.79%
    Req/Sec     1.37k   156.80     2.87k    90.07%
  877556 requests in 10.10s, 59.42MB read
Requests/sec:  86883.46
Transfer/sec:      5.88MB

Dependencies

~43KB