Overall Results: 31 Services, 44 Tests Each
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.
The short version
- Go is the fastest. Gin 1.12 (Go) and Go 1.27 · net/http reach 93% and 91% of the best possible score, and one of the two was the fastest service in 17 of the 44 tests.
- Behind Go there is a close group of 17 services between 71% and 84%: Bun, Deno, NpgsqlRest, the two Rust services, Swoole, and .NET with plain Npgsql or Dapper.
- NpgsqlRest 4.1 is in that group with no endpoint code written. Its four variants score 75% to 82% (positions 4, 6, 9, 14 of 31). The API is generated from PostgreSQL functions or SQL files.
- The three other generated APIs are far behind: PostgREST 33%, Hasura 26%, PostGraphile 20%.
- Laravel Octane and Django are last (20% and 17%), with FastAPI at 29%.
- No test failed. In none of the 1,364 tests did more than 1% of the requests fail.
The leaderboard
How the score works
Every service ran the same 44 tests. In each test, the service that answered the most requests per second gets 100%, and every other service gets its own requests per second as a percentage of that. A service half as fast as the winner of a test gets 50% for that test.
The score is the average of a service's 44 percentages. A service that was the fastest in every single test would score 100%.
Example: NpgsqlRest 4.1 JIT · SQL files scores 82%. Averaged over all 44 tests, it answered 82 requests for every 100 that the fastest service of each test answered.
↑ longer bar is better100% would mean: the fastest service in every test. 50% means: on average, half as fast as the fastest.
- 1Gin 1.12 (Go)93%
- 2Go 1.27 · net/http91%
- 3Bun 1.484%
- 4NpgsqlRest 4.1 JIT · SQL files82%
- 5Deno 2.982%
- 6NpgsqlRest 4.1 JIT · functions79%
- 7NpgsqlRest 3.21 JIT · SQL files77%
- 8.NET 10 · plain Npgsql77%
- 9NpgsqlRest 4.1 AOT · SQL files77%
- 10Axum 0.8 (Rust)76%
- 11.NET 10 · Dapper76%
- 12Actix-web 4.20 (Rust)76%
- 13.NET 11 · plain Npgsql75%
- 14NpgsqlRest 4.1 AOT · functions75%
- 15NpgsqlRest 3.21 JIT · functions75%
- 16.NET 11 · Dapper74%
- 17NpgsqlRest 3.21 AOT · SQL files73%
- 18Swoole 6.2 (PHP)73%
- 19NpgsqlRest 3.21 AOT · functions71%
- 20Fastify 5.1267%
- 21Spring Boot 4.2 (Java 25)61%
- 22NestJS 12.656%
- 23Express 5.356%
- 24.NET 11 · EF Core50%
- 25.NET 10 · EF Core49%
- 26PostgREST 16.633%
- 27FastAPI 0.16529%
- 28Hasura 2.50 (GraphQL)26%
- 29PostGraphile 5.2 (GraphQL)20%
- 30Laravel Octane 13.4320%
- 31Django 6.117%
The score shows how far apart services are, which a plain ranking hides: positions 3 to 19 are all within 13 percentage points of each other. In many tests the tool that sends the requests ran out of CPU before the fastest services did (see what limited the tests), which pulls the fast services closer together than they really are.
How often each service was the fastest
For each of the 44 tests, the 31 services are put in order by requests per second. This table counts how often each service finished first, second or third.
How to read a row: Go 1.27 · net/http was the fastest of all 31 services in 14 of the 44 tests, the second fastest in 9, and the third fastest in 7. So it was among the three fastest in 30 of 44 tests.
| Service | Was the fastest in … tests | Was second in … tests | Was third in … tests | Among the three fastest |
|---|---|---|---|---|
| Go 1.27 · net/http | 14 | 9 | 7 | 30 of 44 |
| Swoole 6.2 (PHP) | 8 | 0 | 5 | 13 of 44 |
| NpgsqlRest 4.1 JIT · SQL files | 6 | 6 | 2 | 14 of 44 |
| Bun 1.4 | 5 | 3 | 4 | 12 of 44 |
| Gin 1.12 (Go) | 3 | 17 | 7 | 27 of 44 |
| NpgsqlRest 3.21 JIT · SQL files | 3 | 0 | 2 | 5 of 44 |
| Deno 2.9 | 2 | 3 | 2 | 7 of 44 |
| FastAPI 0.165 | 2 | 0 | 0 | 2 of 44 |
| NpgsqlRest 4.1 JIT · functions | 1 | 1 | 4 | 6 of 44 |
| NpgsqlRest 4.1 AOT · SQL files | 0 | 2 | 2 | 4 of 44 |
| Axum 0.8 (Rust) | 0 | 1 | 2 | 3 of 44 |
| NpgsqlRest 3.21 AOT · SQL files | 0 | 1 | 2 | 3 of 44 |
| Fastify 5.12 | 0 | 1 | 1 | 2 of 44 |
| .NET 10 · plain Npgsql | 0 | 0 | 3 | 3 of 44 |
| Actix-web 4.20 (Rust) | 0 | 0 | 1 | 1 of 44 |
Services that are not listed were never among the three fastest. Swoole's 8 first places are all in the data types tests, most of them with 100 or 500 rows, where the load generator is the limit; that page explains why those say little.
Two services were corrected and run again
In the first run, PostgREST and Swoole were held back by how they were set up in this benchmark, not by what they can do: PostgREST had 10 database connections where the others had 100, and the Swoole service answered only four requests at a time. Both were corrected and all their tests were run again on a second server of the same type. The numbers on these pages are the corrected ones. What happened, and how the two runs were checked against each other.
The best of each platform
For each platform, its service with the highest speed score, and where its other services are.
| Platform | Its fastest service | Position | Speed score | Its other services (position) |
|---|---|---|---|---|
| Go | Gin 1.12 (Go) | 1 of 31 | 93% | Go 1.27 · net/http (2) |
| Bun & Deno | Bun 1.4 | 3 of 31 | 84% | Deno 2.9 (5) |
| NpgsqlRest | NpgsqlRest 4.1 JIT · SQL files | 4 of 31 | 82% | NpgsqlRest 4.1 JIT · functions (6), NpgsqlRest 3.21 JIT · SQL files (7), NpgsqlRest 4.1 AOT · SQL files (9), NpgsqlRest 4.1 AOT · functions (14), NpgsqlRest 3.21 JIT · functions (15), NpgsqlRest 3.21 AOT · SQL files (17), NpgsqlRest 3.21 AOT · functions (19) |
| .NET | .NET 10 · plain Npgsql | 8 of 31 | 77% | .NET 10 · Dapper (11), .NET 11 · plain Npgsql (13), .NET 11 · Dapper (16), .NET 11 · EF Core (24), .NET 10 · EF Core (25) |
| Rust | Axum 0.8 (Rust) | 10 of 31 | 76% | Actix-web 4.20 (Rust) (12) |
| PHP | Swoole 6.2 (PHP) | 18 of 31 | 73% | Laravel Octane 13.43 (30) |
| Node.js | Fastify 5.12 | 20 of 31 | 67% | NestJS 12.6 (22), Express 5.3 (23) |
| Java | Spring Boot 4.2 (Java 25) | 21 of 31 | 61% | — |
| PostgREST | PostgREST 16.6 | 26 of 31 | 33% | — |
| Python | FastAPI 0.165 | 27 of 31 | 29% | Django 6.1 (31) |
| GraphQL | Hasura 2.50 (GraphQL) | 28 of 31 | 26% | PostGraphile 5.2 (GraphQL) (29) |
Every service, with its position in each kind of test, is in Every Service, One Scorecard.
Who is first, by kind of test
| Kind of test | Its main test | Fastest | Requests/s | Second | Third | Fastest generated API (its place) |
|---|---|---|---|---|---|---|
| Data types | 100 users, 10 rows | NpgsqlRest 4.1 JIT · SQL files | 16,948 | Gin 1.12 (Go) | NpgsqlRest 4.1 JIT · functions | NpgsqlRest 4.1 JIT · SQL files (1) |
| Minimal request | 100 users | Go 1.27 · net/http | 61,391 | Gin 1.12 (Go) | Bun 1.4 | NpgsqlRest 3.21 JIT · SQL files (4) |
| POST body | 50 users, 10 rows | Go 1.27 · net/http | 39,402 | Bun 1.4 | Gin 1.12 (Go) | NpgsqlRest 4.1 JIT · SQL files (6) |
| Nested JSON | 50 users, depth 1 | Go 1.27 · net/http | 20,264 | Gin 1.12 (Go) | Axum 0.8 (Rust) | NpgsqlRest 4.1 JIT · SQL files (6) |
| Large payload | 25 users, 100 KB | NpgsqlRest 4.1 JIT · SQL files | 8,786 | NpgsqlRest 4.1 AOT · SQL files | Fastify 5.12 | NpgsqlRest 4.1 JIT · SQL files (1) |
| Many parameters | 50 users | Gin 1.12 (Go) | 50,908 | Go 1.27 · net/http | Bun 1.4 | NpgsqlRest 4.1 JIT · SQL files (5) |
| Table lookup | 50 users | Go 1.27 · net/http | 54,910 | Gin 1.12 (Go) | NpgsqlRest 4.1 JIT · SQL files | NpgsqlRest 4.1 JIT · SQL files (3) |
| Table list page | 50 users | NpgsqlRest 4.1 JIT · SQL files | 38,217 | NpgsqlRest 4.1 JIT · functions | .NET 10 · plain Npgsql | NpgsqlRest 4.1 JIT · SQL files (1) |
| Table insert | 50 users | Bun 1.4 | 34,440 | Go 1.27 · net/http | Axum 0.8 (Rust) | NpgsqlRest 3.21 JIT · functions (5) |
"Generated API" is a service where no endpoint code is written: NpgsqlRest, PostgREST, Hasura and PostGraphile.
What limited the tests
CPU was measured every second for the service, for PostgreSQL and for the load generator, each on its own cores (4, 16 and 12). A part is counted as "out of CPU" in a test when its average was at least 85% of what it may use.
A throughput number is a statement about a service only when the service was the part that ran out. Where the load generator ran out first, the number is a floor: the service could have done more. The charts in this series mark those results.
| Kind of test | Tests | Service out of CPU | Load generator | PostgreSQL | Nothing |
|---|---|---|---|---|---|
| Data types | 496 | 131 | 170 | 41 | 154 |
| Minimal request | 93 | 65 | 0 | 0 | 28 |
| POST body | 186 | 81 | 88 | 0 | 17 |
| Nested JSON | 186 | 39 | 120 | 0 | 27 |
| Large payload | 124 | 24 | 0 | 14 | 86 |
| Many parameters | 93 | 84 | 0 | 0 | 9 |
| Table lookup | 62 | 50 | 0 | 0 | 12 |
| Table list page | 62 | 51 | 2 | 0 | 9 |
| Table insert | 62 | 33 | 0 | 0 | 29 |
| All | 1,364 | 558 | 380 | 55 | 371 |
In the previous round (July 2026, on 8 cores) the service was the part out of CPU in 18 of 760 tests. Giving PostgreSQL and the load generator far more cores than the service raised that to 558 of 1,364. The load generator is still the limit in 27% of the tests, mostly where responses are large to parse (data types with 100 and 500 rows, nested JSON, POST body).
Efficiency: requests per CPU core
Throughput divided by the CPU the service actually used, averaged over all tests. It is not capped by the load generator the way throughput is: a service that is held back uses less CPU too. This is the cost of a request, and for a hosted service, the size of the bill.
↑ longer bar is betterHow much work a service gets out of one CPU core. A service with twice the number needs half the processor for the same traffic.
- 1NpgsqlRest 4.1 JIT · SQL files4,131req/s per core
- 2NpgsqlRest 4.1 JIT · functions4,079req/s per core
- 3Actix-web 4.20 (Rust)3,949req/s per core
- 4Axum 0.8 (Rust)3,861req/s per core
- 5Gin 1.12 (Go)3,846req/s per core
- 6Go 1.27 · net/http3,674req/s per core
- 7Bun 1.43,630req/s per core
- 8.NET 11 · plain Npgsql3,569req/s per core
- 9NpgsqlRest 4.1 AOT · SQL files3,557req/s per core
- 10Deno 2.93,549req/s per core
- 11NpgsqlRest 4.1 AOT · functions3,539req/s per core
- 12.NET 11 · Dapper3,474req/s per core
- 13.NET 10 · plain Npgsql2,960req/s per core
- 14.NET 10 · Dapper2,876req/s per core
- 15Swoole 6.2 (PHP)2,861req/s per core
- 16NpgsqlRest 3.21 AOT · SQL files2,842req/s per core
- 17NpgsqlRest 3.21 JIT · SQL files2,829req/s per core
- 18NpgsqlRest 3.21 AOT · functions2,828req/s per core
- 19NpgsqlRest 3.21 JIT · functions2,779req/s per core
- 20Fastify 5.122,612req/s per core
- 21Spring Boot 4.2 (Java 25)2,470req/s per core
- 22NestJS 12.62,008req/s per core
- 23Express 5.32,005req/s per core
- 24.NET 11 · EF Core1,758req/s per core
- 25.NET 10 · EF Core1,604req/s per core
- 26PostgREST 16.61,508req/s per core
- 27Hasura 2.50 (GraphQL)942req/s per core
- 28PostGraphile 5.2 (GraphQL)832req/s per core
- 29FastAPI 0.165783req/s per core
- 30Django 6.1432req/s per core
- 31Laravel Octane 13.43366req/s per core
Memory
The highest memory of each service container in any of its 44 tests. Lower is better.
↓ shorter bar is betterMegabytes of memory at the worst moment of all 44 tests.
- 1Go 1.27 · net/http80MB
- 2Gin 1.12 (Go)98MB
- 3NpgsqlRest 4.1 AOT · functions133MB
- 4Axum 0.8 (Rust)133MB
- 5Actix-web 4.20 (Rust)137MB
- 6PostgREST 16.6142MB
- 7Swoole 6.2 (PHP)146MB
- 8NpgsqlRest 4.1 AOT · SQL files190MB
- 9NpgsqlRest 4.1 JIT · functions205MB
- 10NpgsqlRest 4.1 JIT · SQL files224MB
- 11.NET 10 · Dapper289MB
- 12Bun 1.4292MB
- 13FastAPI 0.165303MB
- 14.NET 10 · EF Core312MB
- 15.NET 10 · plain Npgsql317MB
- 16.NET 11 · Dapper319MB
- 17.NET 11 · plain Npgsql341MB
- 18.NET 11 · EF Core348MB
- 19NpgsqlRest 3.21 AOT · functions365MB
- 20NpgsqlRest 3.21 JIT · functions422MB
- 21NpgsqlRest 3.21 AOT · SQL files436MB
- 22NpgsqlRest 3.21 JIT · SQL files542MB
- 23Deno 2.9553MB
- 24Express 5.3746MB
- 25Django 6.1769MB
- 26Fastify 5.12774MB
- 27NestJS 12.6810MB
- 28Laravel Octane 13.43977MB
- 29PostGraphile 5.2 (GraphQL)1,309MB
- 30Spring Boot 4.2 (Java 25)1,620MB
- 31Hasura 2.50 (GraphQL)2,571MB
Memory per kind of test, idle memory, startup time and image size are on the Resources page.
Code you write
Speed is one cost of an API; the code somebody has to write, review and keep working is another. This counts the non-blank lines a person wrote for the nine endpoints of each service: its own code and configuration, plus the SQL it needs. For most services the SQL is the 205 lines of PostgreSQL functions that everyone calls. The NpgsqlRest SQL file services need no functions: their endpoints are 135 lines of plain .sql files. Dockerfiles, package manifests and the table definitions are not counted; they are the same kind of thing for all.
↓ shorter bar is betterThe service's own code and configuration plus the SQL it needs, in non-blank lines.
- 1NpgsqlRest 4.1 AOT · SQL files164lines
- 2NpgsqlRest 4.1 JIT · SQL files164lines
- 3NpgsqlRest 3.21 AOT · SQL files164lines
- 4NpgsqlRest 3.21 JIT · SQL files164lines
- 5PostgREST 16.6221lines
- 6NpgsqlRest 4.1 AOT · functions226lines
- 7NpgsqlRest 4.1 JIT · functions226lines
- 8NpgsqlRest 3.21 AOT · functions226lines
- 9NpgsqlRest 3.21 JIT · functions226lines
- 10PostGraphile 5.2 (GraphQL)249lines
- 11Laravel Octane 13.43304lines
- 12.NET 11 · EF Core321lines
- 13.NET 10 · EF Core321lines
- 14Fastify 5.12334lines
- 15Express 5.3335lines
- 16NestJS 12.6340lines
- 17FastAPI 0.165357lines
- 18.NET 11 · Dapper360lines
- 19.NET 10 · Dapper360lines
- 20Hasura 2.50 (GraphQL)363lines
- 21Bun 1.4378lines
- 22Deno 2.9381lines
- 23Spring Boot 4.2 (Java 25)394lines
- 24Django 6.1457lines
- 25.NET 11 · plain Npgsql486lines
- 26.NET 10 · plain Npgsql486lines
- 27Swoole 6.2 (PHP)500lines
- 28Axum 0.8 (Rust)539lines
- 29Actix-web 4.20 (Rust)550lines
- 30Gin 1.12 (Go)573lines
- 31Go 1.27 · net/http613lines
The count for every service, with its position in the leaderboard
| Service | Own code and configuration | SQL | Total | Position of 31 | Its code |
|---|---|---|---|---|---|
| NpgsqlRest 4.1 AOT · SQL files | 29 | 135 (SQL files) | 164 | 9 | appsettings.json |
| NpgsqlRest 4.1 JIT · SQL files | 29 | 135 (SQL files) | 164 | 4 | appsettings.json |
| NpgsqlRest 3.21 AOT · SQL files | 29 | 135 (SQL files) | 164 | 17 | appsettings.json |
| NpgsqlRest 3.21 JIT · SQL files | 29 | 135 (SQL files) | 164 | 7 | appsettings.json |
| PostgREST 16.6 | 16 | 205 (functions) | 221 | 26 | postgrest.conf |
| NpgsqlRest 4.1 AOT · functions | 21 | 205 (functions) | 226 | 14 | appsettings.json |
| NpgsqlRest 4.1 JIT · functions | 21 | 205 (functions) | 226 | 6 | appsettings.json |
| NpgsqlRest 3.21 AOT · functions | 21 | 205 (functions) | 226 | 19 | appsettings.json |
| NpgsqlRest 3.21 JIT · functions | 21 | 205 (functions) | 226 | 15 | appsettings.json |
| PostGraphile 5.2 (GraphQL) | 44 | 205 (functions) | 249 | 29 | graphile.config.mjs |
| Laravel Octane 13.43 | 99 | 205 (functions) | 304 | 30 | api.php |
| .NET 11 · EF Core | 116 | 205 (functions) | 321 | 24 | Program.cs |
| .NET 10 · EF Core | 116 | 205 (functions) | 321 | 25 | Program.cs |
| Fastify 5.12 | 129 | 205 (functions) | 334 | 20 | app.js |
| Express 5.3 | 130 | 205 (functions) | 335 | 23 | app.js |
| NestJS 12.6 | 135 | 205 (functions) | 340 | 22 | perf.controller.ts |
| FastAPI 0.165 | 152 | 205 (functions) | 357 | 27 | app.py |
| .NET 11 · Dapper | 155 | 205 (functions) | 360 | 16 | Program.cs |
| .NET 10 · Dapper | 155 | 205 (functions) | 360 | 11 | Program.cs |
| Hasura 2.50 (GraphQL) | 86 | 277 (functions and wrappers) | 363 | 28 | databases.yaml |
| Bun 1.4 | 173 | 205 (functions) | 378 | 3 | app.ts |
| Deno 2.9 | 176 | 205 (functions) | 381 | 5 | app.ts |
| Spring Boot 4.2 (Java 25) | 189 | 205 (functions) | 394 | 21 | Application.java |
| Django 6.1 | 252 | 205 (functions) | 457 | 31 | views.py |
| .NET 11 · plain Npgsql | 281 | 205 (functions) | 486 | 13 | Program.cs |
| .NET 10 · plain Npgsql | 281 | 205 (functions) | 486 | 8 | Program.cs |
| Swoole 6.2 (PHP) | 295 | 205 (functions) | 500 | 18 | server.php |
| Axum 0.8 (Rust) | 334 | 205 (functions) | 539 | 10 | main.rs |
| Actix-web 4.20 (Rust) | 345 | 205 (functions) | 550 | 12 | main.rs |
| Gin 1.12 (Go) | 368 | 205 (functions) | 573 | 1 | main.go |
| Go 1.27 · net/http | 408 | 205 (functions) | 613 | 2 | main.go |
- The generated APIs need 12 to 86 lines of their own, all of it configuration. A hand-written service needs 99 to 408 lines of code for the same nine endpoints.
- NpgsqlRest with SQL files is the least to write in total: 164 lines, because the statement is the endpoint and there is no function around it.
- The fastest services are the longest. Go (408 lines), Gin and the two Rust services are at the top of the leaderboard and at the bottom of this chart: every type conversion and every row mapping is written out by hand. NpgsqlRest is the one group that is near the top of both.
- Fewer lines is also fewer tokens. Code that an AI assistant has to read, write and keep consistent is priced by its length, and a nine-endpoint API that is 21 lines of configuration leaves little to get wrong.
Latency objectives
Every test has an objective for the 99th percentile of the response time: 100 ms in the minimal request test, 500 ms with many parameters, 5 s for large payloads and 1 s in the others. 1354 of 1,364 tests met it. The 10 that did not:
| Service | Kind of test | Test | p99 (ms) |
|---|---|---|---|
| Django 6.1 | Minimal request | 500 users | 249 |
| Django 6.1 | Data types | 200 users, 500 rows | 1,141 |
| FastAPI 0.165 | Minimal request | 500 users | 135 |
| FastAPI 0.165 | Data types | 100 users, 500 rows | 1,243 |
| FastAPI 0.165 | Data types | 200 users, 500 rows | 2,454 |
| Hasura 2.50 (GraphQL) | Minimal request | 500 users | 154 |
| Laravel Octane 13.43 | Minimal request | 200 users | 445 |
| Laravel Octane 13.43 | Minimal request | 500 users | 696 |
| Laravel Octane 13.43 | Many parameters | 200 users | 501 |
| PostGraphile 5.2 (GraphQL) | Data types | 200 users, 500 rows | 1,474 |
All tests are closed-loop: a virtual user sends its next request when the previous one is answered. A slow service is therefore sent fewer requests, and its latency looks better than it would under the load a fast service handled. Compare latency between services with similar throughput.
How to read all of this
- Positions hide distances; the score shows them. Many services in the middle of the leaderboard are within a few percentage points of each other.
- Marked results are floors. Where a chart says k6 limit, the service was faster than the tool measuring it.
- This is one machine and one database design. Every service calls the same PostgreSQL functions on a 48-core server, with 4 cores for the service. Other hardware and other workloads move the numbers.
- Some services do less work in two kinds of test. Eight of them return JSON columns as strings; see POST body and nested JSON.
- Everything is in the open. The dataset has every measurement of every test.
Previous: ← Introduction · Next: Data Types →