Posts HTTP servers
actix-web vs axum vs Spring Boot vs Express vs Bun vs Apache httpd vs nginx
Seven HTTP servers on 4 Graviton4 cores, each at its documented setup: the most responses a second each holds at p99 ≤ 50 ms, what 1,000 slow clients cost it in memory, and how fast it serves a 64 MiB file.
actix-web 4.19.0 led all three JSON routes, at 1.5 times Bun and 1.9 times axum on small JSON. On the 323 KB bodies and the 64 MiB file, every server but Express reached the network's limit..
Small JSON
A 1 KB JSON document built and serialized on every request: the highest rate held at p99 ≤ 50 ms.
actix-web 480,000 responses/s, axum 251,000 responses/s, Spring Boot 128,000 responses/s, Express 107,000 responses/s, Bun 320,000 responses/s
Test 1 Small JSON
The mean of each candidate's samples: the statistic the scorecard ranks this section by.
Mean of 3 passes per candidate; the whisker spans the lowest and highest pass.
16 KB body
16,384 bytes from one shared buffer, or a file for Apache httpd and nginx, under actix-web's 32 KiB write-buffer threshold.
actix-web 352,000 responses/s, axum 352,000 responses/s, Spring Boot 123,000 responses/s, Express 90,700 responses/s, Bun 267,000 responses/s, Apache httpd 49,300 responses/s, nginx 352,000 responses/s
Test 1 16 KB body
The mean of each candidate's samples: the statistic the scorecard ranks this section by.
Mean of 3 passes per candidate; the whisker spans the lowest and highest pass; the lead over axum and nginx is inside the noise.
323 KB shared body
323,000 bytes cloned from one shared buffer, as a server answers from a cache, or a file for Apache httpd and nginx.
actix-web 18,000 responses/s, axum 18,000 responses/s, Spring Boot 18,000 responses/s, Express 13,300 responses/s, Bun 18,000 responses/s, Apache httpd 18,000 responses/s, nginx 18,000 responses/s
Test 1 323 KB shared body
The mean of each candidate's samples: the statistic the scorecard ranks this section by.
Mean of 3 passes per candidate; the whisker spans the lowest and highest pass; the lead over axum, Spring Boot, Bun, Apache httpd, and nginx is inside the noise.
323 KB body built per request
The same 323,000 bytes copied into a new buffer on every request.
actix-web 18,000 responses/s, axum 18,000 responses/s, Spring Boot 18,000 responses/s, Express 10,000 responses/s, Bun 18,000 responses/s
Test 1 323 KB body built per request
The mean of each candidate's samples: the statistic the scorecard ranks this section by.
Mean of 3 passes per candidate; the whisker spans the lowest and highest pass; the lead over axum, Spring Boot, and Bun is inside the noise.
40 KB JSON
A 263-item JSON document, 40,039 bytes, built and serialized on every request.
actix-web 36,000 responses/s, axum 26,700 responses/s, Spring Boot 21,300 responses/s, Express 20,000 responses/s, Bun 32,000 responses/s
Test 1 40 KB JSON
The mean of each candidate's samples: the statistic the scorecard ranks this section by.
Mean of 3 passes per candidate; the whisker spans the lowest and highest pass.
323 KB JSON
A 2,100-item JSON document, 323,142 bytes, built and serialized on every request.
actix-web 5,000 responses/s, axum 3,250 responses/s, Spring Boot 3,250 responses/s, Express 3,000 responses/s, Bun 4,000 responses/s
Test 1 323 KB JSON
The mean of each candidate's samples: the statistic the scorecard ranks this section by.
Mean of 3 passes per candidate; the whisker spans the lowest and highest pass.
Slow clients, 323 KB shared body
Peak memory growth with 1,000 keep-alive clients, each paced at 10 Mbit/s with 40 ms added round trip.
actix-web 17.7 MB, axum 29.5 MB, Spring Boot 113 MB, Express 90.1 MB, Bun 198 MB, Apache httpd 49.1 MB, nginx 17.2 MB
Test 1 Slow clients, 323 KB shared body
The mean of each candidate's samples: the statistic the scorecard ranks this section by.
Mean of 3 passes per candidate; the whisker spans the lowest and highest pass; the lead over actix-web is inside the noise.
Slow clients, 323 KB body built per request
Peak memory growth with 1,000 slow keep-alive clients on the per-request body.
actix-web 270 MB, axum 288 MB, Spring Boot 424 MB, Express 356 MB, Bun 227 MB
Test 1 Slow clients, 323 KB body built per request
The mean of each candidate's samples: the statistic the scorecard ranks this section by.
Mean of 3 passes per candidate; the whisker spans the lowest and highest pass.
Slow clients, 40 KB JSON
Peak memory growth with 1,000 slow keep-alive clients on the 40 KB JSON document.
actix-web 50.5 MB, axum 33.7 MB, Spring Boot 792 MB, Express 323 MB, Bun 79.8 MB
Test 1 Slow clients, 40 KB JSON
The mean of each candidate's samples: the statistic the scorecard ranks this section by.
Mean of 3 passes per candidate; the whisker spans the lowest and highest pass.
Slow clients, 323 KB JSON
Peak memory growth with 1,000 slow keep-alive clients on the 323 KB JSON document.
actix-web 227 MB, axum 248 MB, Spring Boot 2,260 MB, Express 492 MB, Bun 279 MB
Test 1 Slow clients, 323 KB JSON
The mean of each candidate's samples: the statistic the scorecard ranks this section by.
Mean of 3 passes per candidate; the whisker spans the lowest and highest pass; the lead over axum is inside the noise.
64 MiB file
64 keep-alive clients downloading a 64 MiB file through each server's own file serving, nothing shaped.
actix-web 49.2 Gbit/s, axum 49.2 Gbit/s, Spring Boot 48.9 Gbit/s, Express 38.4 Gbit/s, Bun 49.2 Gbit/s, Apache httpd 49.2 Gbit/s, nginx 49.1 Gbit/s
Test 1 64 MiB file
The mean of each candidate's samples: the statistic the scorecard ranks this section by.
Mean of 3 passes per candidate; the whisker spans the lowest and highest pass; the lead over axum, actix-web, and Bun is inside the noise.
Test conditions: rig, corpus, protocol
- Machine
- AWS c8gn.4xlarge server, its processes pinned to 4 of 16 cores, and a c8gn.4xlarge client, one cluster placement group
- Chip
- AWS Graviton4
- Cores
- 4 (server)
- Memory
- 32 GiB each
- OS
- Ubuntu 24.04 LTS arm64, kernel 7.0.0-1014-aws (arm64)
- Runtime
- Each server at its documented setup: Rust release builds with rustc 1.99.1, OpenJDK 25.0.5, Node.js 26.13.0, Bun 1.4.4, Apache httpd 2.4.58 and nginx 1.30.6; oha 1.16.0; plain HTTP/1.1 keep-alive, no TLS, 50 Gbps between the instances
- Warmups
- 3 unmeasured passes
- Measured
- 3 passes per tool
- Process
- A fresh server process group per cell on the server's 4 cores, each server sizing its own workers; every server but Bun listens with actix-web's backlog of 1,024 from its own settings, since Bun.serve has none
- Cache
- JSON built on every request; byte bodies from one shared buffer, or a new one per request on /323k-fresh, while Apache httpd and nginx serve them as files; the 64 MiB file stays in the page cache
- Output
- Capacity: the highest open-loop rate held with p99 at most 50 ms, at most 0.1% errors and at least 95% delivered, doubling then bisecting three times; CPU per response from the server's user plus system time and peak memory growth from VmHWM, each summed over its processes
What did we learn?
actix-web 4.19.0 led all three JSON routes, at 1.5 times Bun and 1.9 times axum on small JSON. On the 323 KB bodies and the 64 MiB file, every server but Express reached the network's limit..
| Candidate | Small JSON (K responses/s, higher is better) | 16 KB body (K responses/s, higher is better) | 323 KB shared body (responses/s, higher is better) | 323 KB body built per request (responses/s, higher is better) | 40 KB JSON (responses/s, higher is better) | 323 KB JSON (responses/s, higher is better) | Slow clients, 323 KB shared body (MB, lower is better) | Slow clients, 323 KB body built per request (MB, lower is better) | Slow clients, 40 KB JSON (MB, lower is better) | Slow clients, 323 KB JSON (MB, lower is better) | 64 MiB file (Gbit/s, higher is better) |
|---|---|---|---|---|---|---|---|---|---|---|---|
| actix-web | 480 | 352.0 | 18,000 | 18,000 | 36,000 | 5,000 | 17.7 | 270 | 50.5 | 227 | 49.2 |
| axum | 251 | 352.0 | 18,000 | 18,000 | 26,667 | 3,250 | 29.5 | 288 | 33.7 | 248 | 49.2 |
| Spring Boot | 128 | 122.7 | 18,000 | 18,000 | 21,333 | 3,250 | 113.3 | 424 | 792.3 | 2,261 | 48.9 |
| Express | 107 | 90.7 | 13,333 | 10,000 | 20,000 | 3,000 | 90.1 | 356 | 322.6 | 492 | 38.4 |
| Bun | 320 | 266.7 | 18,000 | 18,000 | 32,000 | 4,000 | 198.4 | 227 | 79.8 | 279 | 49.2 |
| Apache httpd | – | 49.3 | 18,000 | – | – | – | 49.1 | – | – | – | 49.2 |
| nginx | – | 352.0 | 18,000 | – | – | – | 17.2 | – | – | – | 49.1 |
actix-web answered small JSON on 8.2 µs of CPU a response, against 12.5 for Bun and 14.7 for axum. With 1,000 slow clients on a shared 323 KB body, actix-web and nginx held 18 and 17 MB, axum 30, Apache httpd 49 and Bun 198, while Spring Boot reached 2.3 GB on the 323 KB JSON. On the 16 KB body actix-web, axum and nginx tied at 352,000 responses a second, about 46 Gbit/s. Serving the 64 MiB file, Bun, nginx and Apache httpd spent 2.5 to 3.6 ms of CPU a download, about a tenth of the 25 to 30 ms actix-web, axum and Spring Boot spent.
What this does not prove
- The server ran on 4 of a c8gn.4xlarge's 16 Graviton4 cores, with its client on a second c8gn.4xlarge in the same placement group: one instance size, one architecture, plain HTTP/1.1 and no TLS.
- Every server ran its documented setup without tuning, Spring Boot with no JVM flags. Every server but Bun takes actix-web's listen backlog of 1,024 from its own settings; Bun.serve has no such setting.
- Apache httpd and nginx serve files, not code, so they sit out the JSON routes and the body built per request.
- The fastest servers reached the 50 Gbps link on the 16 KB and 323 KB bodies and on the file (46 to 49 Gbit/s), so those routes have no winner; they show who falls short of it.
- Capacity is found by doubling the offered rate and then bisecting three times, so two servers within an eighth of each other can land on the same step.
- Apache httpd, at the 150 workers Ubuntu's packaged configuration allows, served the 1,000 slow clients at 1,521 responses a second against about 3,400 for the rest, with a 30-second p99.
- Three passes, each on a fresh pair of instances. A route has a winner only when the passes' 95% intervals don't overlap.
- Peak memory growth is VmHWM summed over a server's processes, so Express, Bun, Apache httpd and nginx, which run several, count each one's peak.
- I wrote actix-web #4302 and #4404, the changes in actix-http 3.21.0 that stop copying large response bodies into the write buffer.
Rerun it yourself: the runner and configuration are in the repository, and the methodology page covers what every run holds constant. Think a result is wrong? Open an issue with your rig and your samples.
actix-web is a project of the actix organization. axum is a project of the tokio-rs organization. rama is a project of Plabayo. Spring is a trademark of Broadcom Inc. and/or its subsidiaries. Express and Node.js are projects of the OpenJS Foundation. Bun is part of Anthropic. Apache and Apache HTTP Server are trademarks of The Apache Software Foundation. NGINX is a trademark of F5, Inc. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.