Minimal Request: The Cost of Doing Almost Nothing
Before you trust these numbers
- The author of NpgsqlRest runs this benchmark, and NpgsqlRest is one of the services in it.
- The analysis was written with AI assistance from the raw data, then reviewed and edited.
- Every test ran once, on one machine. Treat differences of a few percent as a tie.
- Everything is public so you can check it: the code of every service, the data, and everything that went wrong, and how to run it yourself. Corrections and pull requests are welcome.
What this test does
The service calls a function that returns one row with a status text and a timestamp. There are no parameters. Almost nothing is serialized, so what is measured is everything a request costs before any real work: accepting the connection, routing, getting a database connection from the pool, one round trip to PostgreSQL, and writing a small response.
It is run at 100, 200 and 500 users at the same time. This is the kind of test where the raw speed of a runtime shows most, and the one that matters least for choosing a tool, because no real endpoint does this little.
The code that ran: the load script scenarios/minimal-baseline.js, the PostgreSQL function in init.sql (for the NpgsqlRest SQL file services: perf-minimal.sql), and each service's own source, linked from Every Service, One Scorecard.
How to read the charts
- A bar is requests answered per second. Longer is faster. The fastest service is at the top.
- A "k6 limit" or "PG limit" tag means the load generator (k6, the tool that sends the requests) or the database ran out of CPU before the service did. That service could have gone faster than its bar shows.
- The Highlight buttons above keep one platform highlighted in every chart of the series.
What the numbers say
- Go is first at 100 and 200 users, Deno at 500. The top of this chart is a list of runtimes with cheap request handling: Go, Bun, Deno, .NET (as NpgsqlRest or hand-written with plain Npgsql) and Rust.
- NpgsqlRest is within 7% of the leader with its JIT builds, on both versions. For a request this small, version 4.1 changes nothing: there was nothing left to remove.
- This is where generated GraphQL costs most. Hasura does 3,824 requests per second and PostGraphile 11,505: parsing and planning a GraphQL document is most of a request that does nothing else.
- Nothing held the services back here: in no test of this kind of test was the load generator or PostgreSQL out of CPU.
Of the 93 tests on this page, the service was out of CPU in 65, the load generator in 0, PostgreSQL in 0, and nothing in 28 (in those, the number of users set the pace, not a lack of CPU). A throughput number says how much a service can carry only where the service itself was out of CPU.
Compare the services
Pick a test with the buttons. Choose the number of users, and what to look at: requests per second, how slow the slowest requests are, memory, or requests per CPU core. The chart starts on the main test of this kind (100 users), which the summary tables of the series use.
↑ longer bar is betterHow many requests each service answered per second, with 100 users sending requests at the same time.
- 1Go 1.27 · net/http61,391req/s
- 2Gin 1.12 (Go)60,090req/s
- 3Bun 1.458,354req/s
- 4NpgsqlRest 3.21 JIT · SQL files57,336req/s
- 5NpgsqlRest 3.21 JIT · functions57,280req/s
- 6NpgsqlRest 4.1 JIT · functions57,264req/s
- 7NpgsqlRest 4.1 JIT · SQL files57,187req/s
- 8Deno 2.956,615req/s
- 9.NET 10 · plain Npgsql56,471req/s
- 10.NET 10 · Dapper54,262req/s
- 11NpgsqlRest 3.21 AOT · functions53,859req/s
- 12NpgsqlRest 4.1 AOT · functions51,786req/s
- 13NpgsqlRest 3.21 AOT · SQL files51,417req/s
- 14.NET 11 · Dapper50,728req/s
- 15NpgsqlRest 4.1 AOT · SQL files49,846req/s
- 16.NET 11 · plain Npgsql49,416req/s
- 17Actix-web 4.20 (Rust)45,486req/s
- 18Axum 0.8 (Rust)44,570req/s
- 19Fastify 5.1241,679req/s
- 20Spring Boot 4.2 (Java 25)36,662req/s
- 21Express 5.329,164req/s
- 22Swoole 6.2 (PHP)26,918req/s
- 23NestJS 12.626,905req/s
- 24.NET 11 · EF Core15,730req/s
- 25.NET 10 · EF Core15,376req/s
- 26FastAPI 0.16511,629req/s
- 27PostGraphile 5.2 (GraphQL)11,505req/s
- 28PostgREST 16.67,655req/s
- 29Hasura 2.50 (GraphQL)3,824req/s
- 30Django 6.12,573req/s
- 31Laravel Octane 13.431,991req/s
The code of this test:the script that sends the requests · the PostgreSQL function it calls · the same as a SQL file. Click a service's name (↗) to open its own code for this test.
At 100 users at the same time, Go 1.27 · net/http is first with 61,391 requests per second, 2.2% ahead of Gin 1.12 (Go). 9 of the 31 services are within 10% of the leader, and the slowest does 1,991.
The best of each platform
The fastest service of every platform in the main test (100 users). "Compared with the fastest" is its requests per second as a percentage of the service in first place.
| Platform | Its fastest service | Place among the 31 | Requests per second | Compared with the fastest | Its code |
|---|---|---|---|---|---|
| Go | Go 1.27 · net/http | 1 | 61,391 | 100% | main.go |
| Bun & Deno | Bun 1.4 | 3 | 58,354 | 95% | app.ts |
| NpgsqlRest | NpgsqlRest 3.21 JIT · SQL files | 4 | 57,336 | 93% | appsettings.json |
| .NET | .NET 10 · plain Npgsql | 9 | 56,471 | 92% | Program.cs |
| Rust | Actix-web 4.20 (Rust) | 17 | 45,486 | 74% | main.rs |
| Node.js | Fastify 5.12 | 19 | 41,679 | 68% | app.js |
| Java | Spring Boot 4.2 (Java 25) | 20 | 36,662 | 60% | Application.java |
| PHP | Swoole 6.2 (PHP) | 22 | 26,918 | 44% | server.php |
| Python | FastAPI 0.165 | 26 | 11,629 | 19% | app.py |
| GraphQL | PostGraphile 5.2 (GraphQL) | 27 | 11,505 | 19% | graphile.config.mjs |
| PostgREST | PostgREST 16.6 | 28 | 7,655 | 12% | postgrest.conf |
Every measurement of the main test
Latency, CPU, memory and time in PostgreSQL for all 31 services
| # | Service | Requests/s | Median ms | p99 ms | CPU cores used | Requests/s per core | Peak memory MB | Time in PostgreSQL | Out of CPU |
|---|---|---|---|---|---|---|---|---|---|
| 1 | Go 1.27 · net/http | 61,391 | 1.12 | 5.0 | 3.35 | 18,329 | 43 | 0% | — |
| 2 | Gin 1.12 (Go) | 60,090 | 1.14 | 5.1 | 3.32 | 18,096 | 43 | 0% | — |
| 3 | Bun 1.4 | 58,354 | 1.30 | 4.4 | 3.50 | 16,680 | 161 | 0% | service |
| 4 | NpgsqlRest 3.21 JIT · SQL files | 57,336 | 1.31 | 5.2 | 3.59 | 15,983 | 134 | 0% | service |
| 5 | NpgsqlRest 3.21 JIT · functions | 57,280 | 1.37 | 4.5 | 3.53 | 16,230 | 131 | 0% | service |
| 6 | NpgsqlRest 4.1 JIT · functions | 57,264 | 1.32 | 4.7 | 3.16 | 18,142 | 93 | 0% | — |
| 7 | NpgsqlRest 4.1 JIT · SQL files | 57,187 | 1.35 | 4.6 | 3.12 | 18,352 | 101 | 0% | — |
| 8 | Deno 2.9 | 56,615 | 1.36 | 4.1 | 3.54 | 16,006 | 317 | 0% | service |
| 9 | .NET 10 · plain Npgsql | 56,471 | 1.40 | 4.4 | 3.58 | 15,774 | 90 | 0% | service |
| 10 | .NET 10 · Dapper | 54,262 | 1.45 | 4.5 | 3.52 | 15,396 | 108 | 0% | service |
| 11 | NpgsqlRest 3.21 AOT · functions | 53,859 | 1.49 | 4.4 | 3.60 | 14,975 | 72 | 0% | service |
| 12 | NpgsqlRest 4.1 AOT · functions | 51,786 | 1.52 | 5.0 | 3.46 | 14,955 | 48 | 0% | service |
| 13 | NpgsqlRest 3.21 AOT · SQL files | 51,417 | 1.37 | 7.6 | 3.56 | 14,437 | 81 | 0% | service |
| 14 | .NET 11 · Dapper | 50,728 | 1.59 | 4.8 | 3.50 | 14,484 | 114 | 0% | service |
| 15 | NpgsqlRest 4.1 AOT · SQL files | 49,846 | 1.36 | 8.2 | 3.36 | 14,856 | 61 | 0% | — |
| 16 | .NET 11 · plain Npgsql | 49,416 | 1.42 | 7.6 | 3.20 | 15,438 | 91 | 0% | — |
| 17 | Actix-web 4.20 (Rust) | 45,486 | 1.82 | 4.0 | 3.55 | 12,795 | 31 | 0% | service |
| 18 | Axum 0.8 (Rust) | 44,570 | 1.90 | 4.2 | 3.53 | 12,628 | 19 | 0% | service |
| 19 | Fastify 5.12 | 41,679 | 1.96 | 4.3 | 3.62 | 11,507 | 402 | 0% | service |
| 20 | Spring Boot 4.2 (Java 25) | 36,662 | 1.87 | 12.0 | 3.59 | 10,212 | 1,161 | 0% | service |
| 21 | Express 5.3 | 29,164 | 2.90 | 5.2 | 3.83 | 7,617 | 433 | 0% | service |
| 22 | Swoole 6.2 (PHP) | 26,918 | 3.47 | 4.5 | 3.66 | 7,357 | 72 | 0% | service |
| 23 | NestJS 12.6 | 26,905 | 3.19 | 5.4 | 3.75 | 7,169 | 471 | 0% | service |
| 24 | .NET 11 · EF Core | 15,730 | 5.52 | 11.6 | 3.78 | 4,165 | 153 | 0% | service |
| 25 | .NET 10 · EF Core | 15,376 | 5.77 | 10.5 | 3.83 | 4,017 | 143 | 0% | service |
| 26 | FastAPI 0.165 | 11,629 | 7.42 | 14.8 | 3.83 | 3,038 | 291 | 0% | service |
| 27 | PostGraphile 5.2 (GraphQL) | 11,505 | 6.99 | 24.8 | 3.84 | 2,994 | 851 | 0% | service |
| 28 | PostgREST 16.6 | 7,655 | 12.67 | 14.5 | 3.05 | 2,511 | 83 | 0% | — |
| 29 | Hasura 2.50 (GraphQL) | 3,824 | 25.61 | 32.8 | 2.19 | 1,746 | 194 | 0% | — |
| 30 | Django 6.1 | 2,573 | 36.61 | 52.2 | 3.38 | 761 | 354 | 0% | — |
| 31 | Laravel Octane 13.43 | 1,991 | 41.92 | 92.9 | 3.67 | 542 | 561 | 0% | service |
"CPU cores used" is the average CPU of the service during the test (it may use 4). "Time in PostgreSQL" is the share of an average request that PostgreSQL spent executing the statement.
All tests of this kind
Requests per second of every service in every test of this kind. Each column is one test; a higher number is better.
| Service | 100 users | 200 users | 500 users |
|---|---|---|---|
| Go 1.27 · net/http | 61,391 | 60,527 | 57,275 |
| Gin 1.12 (Go) | 60,090 | 59,671 | 56,625 |
| Bun 1.4 | 58,354 | 57,420 | 58,259 |
| NpgsqlRest 3.21 JIT · SQL files | 57,336 | 55,997 | 53,114 |
| NpgsqlRest 3.21 JIT · functions | 57,280 | 56,451 | 53,431 |
| NpgsqlRest 4.1 JIT · functions | 57,264 | 58,886 | 54,156 |
| NpgsqlRest 4.1 JIT · SQL files | 57,187 | 56,831 | 53,733 |
| Deno 2.9 | 56,615 | 58,540 | 61,197 |
| .NET 10 · plain Npgsql | 56,471 | 55,478 | 53,188 |
| .NET 10 · Dapper | 54,262 | 55,823 | 50,779 |
| NpgsqlRest 3.21 AOT · functions | 53,859 | 54,789 | 50,341 |
| NpgsqlRest 4.1 AOT · functions | 51,786 | 51,613 | 49,187 |
| NpgsqlRest 3.21 AOT · SQL files | 51,417 | 54,475 | 50,419 |
| .NET 11 · Dapper | 50,728 | 49,848 | 46,909 |
| NpgsqlRest 4.1 AOT · SQL files | 49,846 | 52,300 | 49,539 |
| .NET 11 · plain Npgsql | 49,416 | 51,353 | 48,841 |
| Actix-web 4.20 (Rust) | 45,486 | 48,081 | 47,664 |
| Axum 0.8 (Rust) | 44,570 | 50,384 | 49,728 |
| Fastify 5.12 | 41,679 | 43,180 | 39,824 |
| Spring Boot 4.2 (Java 25) | 36,662 | 35,337 | 32,348 |
| Express 5.3 | 29,164 | 29,808 | 28,517 |
| Swoole 6.2 (PHP) | 26,918 | 27,390 | 27,246 |
| NestJS 12.6 | 26,905 | 27,050 | 26,022 |
| .NET 11 · EF Core | 15,730 | 15,962 | 15,132 |
| .NET 10 · EF Core | 15,376 | 15,701 | 15,672 |
| FastAPI 0.165 | 11,629 | 11,815 | 11,556 |
| PostGraphile 5.2 (GraphQL) | 11,505 | 11,233 | 11,188 |
| PostgREST 16.6 | 7,655 | 7,261 | 6,807 |
| Hasura 2.50 (GraphQL) | 3,824 | 3,665 | 3,483 |
| Django 6.1 | 2,573 | 2,477 | 2,416 |
| Laravel Octane 13.43 | 1,991 | 1,993 | 2,006 |
Bold is the best of the column. ᵏ the load generator was out of CPU in that test and the service was not; ᵖ the same for PostgreSQL.
Previous: ← Data Types · Next: POST Body →