fib
Experimental · Go · standard configuration · completeness 4/4
fib (Fast In Balance) Go networking library, served through its prefork package: a master process starts a child for every two CPUs, each with two Ps and its own heap, and every engine a child binds listens with SO_REUSEPORT, so the children share the ports. In each child an edge-triggered epoll event loop hands HTTP/1 connections' rounds to a logical worker pool, where each connection is an ordered task that any idle worker may run. Its http package serves HTTP/1.1, HTTP/2 (ALPN and prior-knowledge h2c) and, through package http3, HTTP/3 over its own QUIC, all through one handler taking a *http.Request and a Context; TLS through package tls on crypto/tls. Default configuration throughout; the certificate on the opt-in TLS hardening listener is picked per handshake through tls.Config.GetCertificate, so a renewed pair is served without a restart. Requests are routed by fib's Router (chi's API with fib's handlers), the same one for every protocol, with path parameters read through Context.Param, and JSON answered through Context.JSON, encoding/json's encoding; the JSON routes sit behind fib's compress middleware (Router.With(compress.New()), defaults), which gzips per request as Accept-Encoding allows. The gRPC profiles' BenchmarkService, protoc-generated with google.golang.org/protobuf messages, is served by fib's grpc package through the same router, so gRPC shares 8080 (h2c) and 8443 (h2 over TLS) with HTTP. /delay waits in its handler, on fib's worker pool, which grows for handlers that block, /async-db answers a retained request from a goroutine, and /static goes through fib's FileCache, which serves the files from memory and follows the disk through an inotify watch, choosing the pre-compressed twin on disk off Accept-Encoding.
Achievements
🥇 8 Gold · 🥈 8 Silver · 🥉 4 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 | Family composite | Composite · HTTP/2 | 1 of 4 |
| 🥇 Gold | Family composite | Composite · HTTP/3 | 1 of 3 |
| 🥇 Gold | Test profile | Efficiency · Latency-1M | 1 of 5 |
| 🥇 Gold | Test profile | HTTP/2 · Baseline (h2c) | 1 of 4 |
| 🥇 Gold | Test profile | HTTP/2 · Static | 1 of 3 |
| 🥇 Gold | Test profile | HTTP/3 · Baseline | 1 of 3 |
| 🥇 Gold | Test profile | WebSocket · Echo Short-lived | 1 of 7 |
| 🥇 Gold | Test profile | Workload · 8Gbit | 1 of 5 |
| 🥈 Silver | Family composite | Composite · HTTP/1.1 | 2 of 7 |
| 🥈 Silver | Family composite | Composite · WebSocket | 2 of 7 |
| 🥈 Silver | Within its language | Go · WebSocket | 2 of 3 |
| 🥈 Silver | Test profile | Concurrency · Async Delay | 2 of 5 |
| 🥈 Silver | Test profile | Connection · Short-lived | 2 of 7 |
| 🥈 Silver | Test profile | HTTP/2 · Baseline | 2 of 3 |
| 🥈 Silver | Test profile | Workload · JSON Comp | 2 of 6 |
| 🥈 Silver | Test profile | Workload · JSON TLS | 2 of 6 |
| 🥉 Bronze | Test profile | Connection · Baseline | 3 of 7 |
| 🥉 Bronze | Test profile | Efficiency · Latency-10K | 3 of 5 |
| 🥉 Bronze | Test profile | HTTP/2 · JSON (h2c) | 3 of 4 |
| 🥉 Bronze | Test profile | WebSocket · Echo Pipelined | 3 of 7 |
Composite rank
Each profile of a family is worth 100 to the entry that leads it, 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.
| Family | Rank | Composite |
|---|---|---|
| HTTP/1.1 | 2 of 7 | 6302 |
| HTTP/2 | 1 of 4 | 2737 |
| HTTP/3 | 1 of 3 | 1955 |
| gRPC | 1 of 2 | 1839 |
| WebSocket | 2 of 7 | 2782 |
Every result
Alpha Round, 36 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 | 3,164,504 | 1.30ms | 2.66ms | 6139.4% | 293MiB |
| Connection | Pipelined | 4,096 | 20,397,414 | 3.21ms | 7.39ms | 6555.1% | 285MiB |
| Connection | Short-lived | 4,096 | 2,548,722 | 1.58ms | 4.14ms | 6146.9% | 298MiB |
| Concurrency | Async Delay | 32,000 | 1,798,497 | 17.66ms | 31.30ms | 5580.7% | 1.5GiB |
| Efficiency | Latency-10K | 1,024 | 9,981 | 78.6us | 103.0us | 43.5% | 161MiB |
| Efficiency | Latency-1M | 1,024 | 998,149 | 113.3us | 204.0us | 3436.9% | 260MiB |
| Efficiency | Latency-500K/8 | 1,024 | 444,092 | 1085584.1us | 2644992.0us | 789.5% | 50MiB |
| Workload | JSON Comp | 4,096 | 297,385 | 13.76ms | 37.20ms | 6340.3% | 516MiB |
| Workload | JSON Comp | 16,384 | 296,064 | 54.85ms | 95.00ms | 6380.6% | 1.1GiB |
| Workload | JSON TLS | 4,096 | 774,182 | 5.42ms | 97.47ms | 6376.7% | 375MiB |
| Workload | 8Gbit | 512 | 49,363 | 88.6us | 120.0us | 235.8% | 256MiB |
| Workload | Static TLS | 1,024 | 1,229,892 | 689.56us | 19.67ms | 5751.7% | 350MiB |
| Database | Async DB | 1,024 | 197,176 | 4.65ms | 25.70ms | 4489.7% | 389MiB |
| HTTP/2 | Baseline | 256 | 5,634,126 | 2.30ms | 20.21ms | 2505.0% | 504MiB |
| HTTP/2 | Baseline | 1,024 | 5,490,643 | 8.82ms | 87.74ms | 2464.0% | 804MiB |
| HTTP/2 | Static | 256 | 930,877 | 8.61ms | 80.39ms | 6273.2% | 778MiB |
| HTTP/2 | Static | 1,024 | 945,065 | 32.84ms | 227.12ms | 6226.0% | 1.1GiB |
| HTTP/2 | Baseline (h2c) | 256 | 12,891,491 | 1.43ms | 17.67ms | 4912.5% | 421MiB |
| HTTP/2 | Baseline (h2c) | 1,024 | 13,903,429 | 4.96ms | 80.60ms | 5963.3% | 642MiB |
| HTTP/2 | Baseline (h2c) | 4,096 | 11,484,657 | 30.74ms | 649.12ms | 6315.3% | 1.7GiB |
| HTTP/2 | JSON (h2c) | 1,024 | 1,102,054 | 28.90ms | 230.41ms | 6182.7% | 882MiB |
| HTTP/2 | JSON (h2c) | 4,096 | 1,114,439 | 111.84ms | 487.00ms | 6253.7% | 2.3GiB |
| HTTP/3 | Baseline | 64 | 6,067,295 | 555us | 1.36ms | 3554.6% | 402MiB |
| HTTP/3 | Static | 64 | 748,540 | 5.16ms | 22.19ms | 4744.4% | 872MiB |
| gRPC | Unary | 256 | 6,198,578 | 3.50ms | 81.67ms | 5449.7% | 603MiB |
| gRPC | Unary | 1,024 | 6,199,041 | 13.90ms | 346.21ms | 6198.4% | 1.1GiB |
| gRPC | Unary TLS | 256 | 4,246,784 | 3.54ms | 43.08ms | 3672.7% | 562MiB |
| gRPC | Unary TLS | 1,024 | 4,160,362 | 12.39ms | 130.08ms | 3662.4% | 1022MiB |
| WebSocket | Echo | 512 | 3,539,300 | 144us | 385us | 6064.5% | 99MiB |
| WebSocket | Echo | 4,096 | 3,972,953 | 1.03ms | 1.99ms | 6458.6% | 133MiB |
| WebSocket | Echo | 16,384 | 3,748,427 | 4.36ms | 8.36ms | 6142.8% | 266MiB |
| WebSocket | Echo Pipelined | 512 | 46,941,744 | 173us | 406us | 6273.1% | 100MiB |
| WebSocket | Echo Pipelined | 4,096 | 51,031,532 | 1.28ms | 2.52ms | 6617.6% | 134MiB |
| WebSocket | Echo Pipelined | 16,384 | 48,606,448 | 5.36ms | 10.20ms | 6206.1% | 268MiB |
| WebSocket | Echo Short-lived | 512 | 2,053,428 | 154us | 502us | 5403.9% | 246MiB |
| WebSocket | Echo Short-lived | 4,096 | 2,613,729 | 1.05ms | 2.42ms | 5887.0% | 277MiB |
Compared with
The Go entries around fib on the HTTP/1.1 composite, and the one leading them. The last column shows every profile side by side.
| Entry | Composite | vs fib | |
|---|---|---|---|
| fib-tuned | 7101 | +13% | head to head |
| fiber-tuned | 6372 | +1% | head to head |
| fiber | 5932 | -6% | head to head |
| go-fasthttp | 3632 | -42% | head to head |
Compare fib with any Go entry · Compare fib with any entry, in any language · Every Go entry, ranked
Results updated · How the benchmark is run · The machine · Add or fix an entry