Go framework benchmark: net/http, Chi, Gin, Echo, Fiber

The same API on five Go HTTP frameworks, driven by the same k6 load test as the Laravel FPM vs Swoole vs FrankenPHP benchmark, on the same machine.

Frameworks

Whole run, all five scenarios combined. Latency counts successful responses only.

Takeaways

What the numbers say, and what they don't.

Throughput (requests per second)

Latency per scenario (ms, log scale)

Per scenario

Average latency in ms, with p95 below. Green marks the best Go framework in each row.

Overall, with PHP for reference

The PHP runtimes ran Laravel 12 on the same VM, with the same k6 script and database schema.

How it was run

Everything runs in Docker Compose on one VM. Frameworks are benchmarked one at a time.

k6 scenarios

ScenarioEndpointVUsDuration
Health checkGET /api/health500030s
List 20 postsGET /api/posts1000→500→1000→060s
Single postGET /api/posts/{id}300030s
Create postPOST /api/posts200030s
Heavy computeGET /api/heavy200030s

Test machine

HostAzure Standard_D4as_v6
CPUAMD EPYC 9V74, 4 vCPU
RAM15.6 GiB, no swap
OSUbuntu 24.04.5, kernel 7.0
Go1.26, static binaries, distroless image
DatabasePostgreSQL 16, pgx pool of 50 per app
Loadk6 v2.3.0 on the same machine

Fairness notes

  • DB access, validation and the CPU workload live in one shared package. Each framework only wires routes, parses bodies and renders JSON.
  • No request logging on any framework. Every container gets a 65535 open-file limit.
  • The posts table is reset to the same 100 seeded rows before each framework runs.
  • k6, Postgres and the server share the same 4 vCPUs, so absolute numbers are lower than on a dedicated setup. The comparison is still like for like.