bun
Flagship · TS · standard configuration · completeness 3/4
Bun.serve, Bun's own HTTP server, with no framework on top and one process per core sharing the ports. The same routes serve every protocol: HTTP/1.1 on 8080 and over TLS on 8081, h2c on 8082 and h2 plus HTTP/3 on 8443 through Bun's experimental `http2: true` and `http3: true` flags (QUIC is Bun's own lsquic, no proxy in front).
Achievements
🥇 1 Gold · 🥈 2 Silver · 🥉 2 Bronze. Top three of a field, taken in this entry's own league: the family composite, the same composite among entries written in the same language, and each test profile it is scored on. Every field is the one the badges publish, so a medal and a badge always say the same thing. How medals are awarded.
| Medal | Award | Field | Rank |
|---|---|---|---|
| 🥇 Gold | Test profile | HTTP/3 · Static | 1 of 17 |
| 🥈 Silver | Within its language | TS · HTTP/1.1 | 2 of 6 |
| 🥈 Silver | Test profile | Workload · JSON Comp | 2 of 84 |
| 🥉 Bronze | Family composite | Composite · HTTP/3 | 3 of 17 |
| 🥉 Bronze | Test profile | HTTP/3 · Baseline | 3 of 17 |
Composite rank
Each profile of a family is worth its weight × 1,000 to the entry that leads it - 1, or 0.5 apiece for two profiles that measure one thing - and the composite is the sum over the family, less 2.5% for each of routing, middleware, request and response the entry does not do for you - its completeness factor, which the WebSocket and gRPC families do not carry. The field is this entry's own league: engines and reverse proxies are scored apart from frameworks. How it works.
Protocol compliance
The conformance suites this entry subscribes to, run against it on the benchmark machine: Http11Probe on HTTP/1.1, h2spec on HTTP/2, h3spec on HTTP/3 and Autobahn on WebSocket. A score, not part of the composite. How it works.
| Suite | Tool | Passed | Failed |
|---|---|---|---|
| HTTP/1.1 | http11probe d50d818 | 133 of 159 (83.6%) | 26 |
| HTTP/2 | h2spec 2.6.0 | 144 of 146 (98.6%) | 2 |
| HTTP/3 | h3spec v0.1.15 | 64 of 81 (79.0%) | 17 |
HTTP/1.1: what failed
| Test | Expected | Got |
|---|---|---|
RFC9112-2.2-BARE-LF-REQUEST-LINE Bare LF in request line should be rejected, but MAY be accepted (RFC 9112 §2.2, MAY) | 400 or close (pass), 2xx (warn) | 505, connection closed |
RFC9112-3-CR-ONLY-LINE-ENDING CR without LF as line ending must be rejected (RFC 9112 §2.2, MUST) | 400, close, or timeout = warn | 505, connection closed |
RFC9112-2.3-HTTP09-REQUEST HTTP/0.9 request (no version) must be rejected (RFC 9112 §2.3, SHOULD) | 400/close/timeout | 505, connection closed |
RFC9110-5.4-DUPLICATE-HOST Duplicate Host headers with different values must be rejected (RFC 9112 §3.2, MUST) | 400 | 200, connection left open |
COMP-DUPLICATE-HOST-SAME Duplicate Host headers with identical values must be rejected (RFC 9112 §3.2, MUST) | 400 | 200, connection left open |
COMP-HOST-WITH-USERINFO Host header with userinfo (user@host) must be rejected (RFC 9112 §3.2, MUST) | 400 or close | 200, connection left open |
COMP-HOST-WITH-PATH Host header with path component must be rejected (RFC 9112 §3.2, MUST) | 400 or close | 200, connection left open |
COMP-OPTIONS-STAR OPTIONS * is the only valid asterisk-form request (RFC 9112 §3.2.4, MUST) | 2xx or 405; close/timeout = warn | 400, connection closed |
COMP-METHOD-CONNECT CONNECT to an origin server must be rejected (RFC 9110 §9.3.6, SHOULD) | 400/405/501 or close | 404, connection left open |
COMP-HOST-EMPTY-VALUE Empty Host header value must be rejected (RFC 9112 §3.2, MUST) | 400 or close | 200, connection left open |
COMP-REQUEST-LINE-TAB Tab as request-line delimiter — SHOULD reject but MAY parse on whitespace (RFC 9112 §3, SHOULD) | 400 or 2xx; close/timeout = warn | 505, connection closed |
COMP-VERSION-MISSING-MINOR HTTP/1 with no minor version digit is invalid (RFC 9112 §2.3, MUST) | 400, close, or timeout = warn | 505, connection closed |
COMP-VERSION-LEADING-ZEROS HTTP/01.01 — leading zeros in version digits are invalid (RFC 9112 §2.3, MUST) | 400, close, or timeout = warn | 505, connection closed |
COMP-VERSION-WHITESPACE HTTP/ 1.1 — whitespace inside version token is invalid (RFC 9112 §2.3, MUST) | 400, close, or timeout = warn | 505, connection closed |
COMP-CHUNKED-TRAILER-VALID Valid chunked body with trailer field should be accepted (RFC 9112 §7.1.2, MUST) | 2xx + echo | 200, connection closed (Echo mismatch: expected "hello", got "helloHTTP/1.1 400 Bad Request Connectio...") |
COMP-NO-1XX-HTTP10 Server must not send 1xx responses to an HTTP/1.0 client (RFC 9110 §15.2, MUST) | non-1xx response | 100, connection closed |
COMP-VERSION-CASE HTTP version is case-sensitive — lowercase 'http' must be rejected (RFC 9112 §2.3, MUST) | 400, close, or timeout = warn | 505, connection closed |
COMP-SPACE-IN-TARGET Whitespace inside request-target is invalid (RFC 9112 §3.2, MUST) | 400, close, or timeout = warn | 505, connection closed |
SMUG-CHUNK-BARE-SEMICOLON Chunk size with bare semicolon and no extension name must be rejected (RFC 9112 §7.1.1, MUST) | 400 or close | 200, connection left open |
SMUG-CHUNK-EXT-INVALID-TOKEN Chunk extension with invalid token character must be rejected (RFC 9112 §7.1.1, MUST) | 400 or close | 200, connection left open |
SMUG-MULTIPLE-HOST-COMMA Host header with comma-separated values must be rejected (RFC 9110 §7.2, MUST) | 400 or close | 200, connection left open |
MAL-NUL-IN-URL NUL byte in URL should be rejected (MUST) | 400 or close | 505, connection closed |
MAL-LONG-METHOD 100KB method name should be rejected (SHOULD) | 400, 501 or close | 431, connection closed |
MAL-NON-ASCII-URL Non-ASCII bytes (UTF-8 é) in URL must be rejected (MUST) | 400 or close | 404, connection left open |
MAL-URL-OVERLONG-UTF8 Overlong UTF-8 encoding of / (0xC0 0xAF) in URL must be rejected (MUST) | 400 or close | 404, connection left open |
MAL-CHUNK-EXT-64K 64KB chunk extension — tests extension length limits (CVE-2023-39326 class) (NOTAPPLICABLE) | 400 or 2xx | 413, connection closed |
HTTP/2: what failed
| Test | Expected | Got |
|---|---|---|
http2/3.5/2 Sends invalid connection preface | GOAWAY Frame (Error Code: PROTOCOL_ERROR) or Connection closed | Error: unexpected EOF |
http2/6.9.1/3 Sends multiple WINDOW_UPDATE frames increasing the flow control window to above 2^31-1 on a stream | RST_STREAM Frame (Error Code: FLOW_CONTROL_ERROR) | RST_STREAM Frame (length:4, flags:0x00, stream_id:1) |
HTTP/3: what failed
| Test | Expected | Got |
|---|---|---|
| QUIC servers MUST send FRAME_ENCODING_ERROR if a frame is cut short [Transport 12.4] | - | predicate failed on expected exception: QUICException / TransportErrorIsReceived InternalError "connection error" |
| QUIC servers MUST send CRYPTO_BUFFER_EXCEEDED if CRYPTO data is buffered beyond the limit [Transport 7.5] | - | did not get expected exception: QUICException |
| QUIC servers MUST send unexpected_message TLS alert if KeyUpdate in 1-RTT is received [TLS 6] | - | did not get expected exception: QUICException |
| HTTP/3 servers MUST send H3_MESSAGE_ERROR if a pseudo-header is duplicated [HTTP/3 4.3.1] | - | did not get expected exception: QUICException |
| HTTP/3 servers MUST send H3_MESSAGE_ERROR if mandatory pseudo-header fields are absent [HTTP/3 4.3.1] | - | did not get expected exception: QUICException |
| HTTP/3 servers MUST send H3_MESSAGE_ERROR if prohibited pseudo-header fields are present [HTTP/3 4.3] | - | did not get expected exception: QUICException |
| HTTP/3 servers MUST send H3_MESSAGE_ERROR if pseudo-header fields exist after fields [HTTP/3 4.3] | - | did not get expected exception: QUICException |
| HTTP/3 servers MUST treat a request with connection as malformed [HTTP/3 4.2] | - | did not get expected exception: QUICException |
| HTTP/3 servers MUST treat a request with keep-alive as malformed [HTTP/3 4.2] | - | did not get expected exception: QUICException |
| HTTP/3 servers MUST treat a request with proxy-connection as malformed [HTTP/3 4.2] | - | did not get expected exception: QUICException |
| HTTP/3 servers MUST treat a request with transfer-encoding as malformed [HTTP/3 4.2] | - | did not get expected exception: QUICException |
| HTTP/3 servers MUST treat a request with upgrade as malformed [HTTP/3 4.2] | - | did not get expected exception: QUICException |
| HTTP/3 servers MUST treat a request with te as malformed [HTTP/3 4.2] | - | did not get expected exception: QUICException |
| HTTP/3 servers MUST send H3_FRAME_ERROR if a SETTINGS frame stops mid-parameter [HTTP/3 7.1] | - | did not get expected exception: QUICException |
| HTTP/3 servers treats a repeated setting identifier as an error whatever its value [HTTP/3 7.2.4] | - | did not get expected exception: QUICException |
| HTTP/3 servers MUST send H3_ID_ERROR if GOAWAY goes up [HTTP/3 5.2] | - | did not get expected exception: QUICException |
| HTTP/3 servers MUST NOT buffer an over-long frame on a control stream [HTTP/3 7.1] | - | did not get expected exception: QUICException |
Every result
Alpha Round, 22 runs. Requests per second is the best of three; latency, CPU and memory come from that run.
| Category | Profile | Conns | Req/sec | Avg | p99 | CPU | Memory |
|---|---|---|---|---|---|---|---|
| Connection | Baseline | 4,096 | 1,926,386 | 2.13ms | 3.84ms | 6737.0% | 1.2GiB |
| Connection | Pipelined | 4,096 | 5,529,928 | 11.85ms | 15.20ms | 6393.6% | 328MiB |
| Connection | Short-lived | 4,096 | 1,672,444 | 2.43ms | 8.61ms | 6283.0% | 1.1GiB |
| Concurrency | Async Delay | 32,000 | 1,949,532 | 16.33ms | 22.30ms | 6385.5% | 1.5GiB |
| Efficiency | Latency-10K | 1,024 | 9,982 | 82.4us | 125.0us | 54.0% | 394MiB |
| Efficiency | Latency-1M | 1,024 | 997,935 | 140.7us | 429.0us | 4730.8% | 967MiB |
| Workload | JSON Comp | 4,096 | 460,716 | 8.87ms | 20.90ms | 6322.9% | 1.1GiB |
| Workload | JSON Comp | 16,384 | 460,816 | 35.22ms | 61.00ms | 6179.2% | 1.1GiB |
| Workload | JSON TLS | 4,096 | 1,081,708 | 3.80ms | 41.48ms | 6292.0% | 966MiB |
| Workload | 8Gbit | 512 | 49,237 | 105.5us | 180.0us | 397.7% | 476MiB |
| Workload | Static TLS | 1,024 | 481,407 | 2.28ms | 62.40ms | 6530.9% | 1.0GiB |
| HTTP/2 | Baseline | 256 | 7,062,166 | 3.54ms | 20.48ms | 6283.7% | 1.2GiB |
| HTTP/2 | Baseline | 1,024 | 7,059,841 | 13.46ms | 84.78ms | 6272.8% | 1.3GiB |
| HTTP/2 | Static | 256 | 613,748 | 14.32ms | 87.71ms | 6332.3% | 1.2GiB |
| HTTP/2 | Static | 1,024 | 599,957 | 51.83ms | 249.17ms | 6387.3% | 1.4GiB |
| HTTP/2 | Baseline (h2c) | 256 | 7,306,785 | 3.59ms | 23.23ms | 6203.3% | 1.3GiB |
| HTTP/2 | Baseline (h2c) | 1,024 | 7,402,051 | 13.25ms | 53.30ms | 6388.6% | 1.3GiB |
| HTTP/2 | Baseline (h2c) | 4,096 | 7,262,661 | 52.79ms | 150.50ms | 6177.6% | 1.3GiB |
| HTTP/2 | JSON (h2c) | 1,024 | 2,245,990 | 14.67ms | 67.74ms | 6289.2% | 1.0GiB |
| HTTP/2 | JSON (h2c) | 4,096 | 2,218,793 | 56.52ms | 178.21ms | 6221.8% | 1.1GiB |
| HTTP/3 | Baseline | 64 | 3,435,034 | 1.04ms | 2.51ms | 3616.5% | 1.0GiB |
| HTTP/3 | Static | 64 | 289,587 | 14.81ms | 138.14ms | 5306.5% | 1.3GiB |
Compared with
The TS web frameworks around bun on the HTTP/1.1 composite, and the one leading them. Entries of other leagues are left out: a composite does not carry from one league to another. The last column shows every profile side by side.
| Entry | Composite | vs bun | |
|---|---|---|---|
| barejs | 4819 | +26% | head to head |
| elysia | 2668 | -30% | head to head |
| hono-bun | 2296 | -40% | head to head |
Compare bun with any TS entry · Compare bun with any entry, in any language · Every TS entry, ranked
Results updated · How the benchmark is run · The machine · Add or fix an entry