Resources: Memory, CPU, Startup and Size
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.
Throughput says how much a service can do. This page is about what it takes: the memory it holds, the CPU a request costs, how long it takes to start, and how large it is to ship. For a service that runs in a container and is billed by memory and CPU, these numbers decide more than the top of a throughput chart.
Memory and CPU were sampled once a second for every container, during the tests of that service only. Memory is what docker stats reports: the container's memory without the file cache the kernel can drop. In all charts on this page lower is better, except the last one.
Memory under load
The highest memory of the service container in any of its 44 tests.
↓ 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
Peak memory by kind of test
The highest memory during the tests of each type, in MB. This is where it shows which kind of request makes a service grow.
| Service | Data types | Minimal request | POST body | Nested JSON | Large payload | Many parameters | Table lookup | Table list page | Table insert | Highest |
|---|---|---|---|---|---|---|---|---|---|---|
| Go 1.27 · net/http | 54 | 60 | 48 | 42 | 80 | 50 | 50 | 50 | 48 | 80 |
| Gin 1.12 (Go) | 57 | 63 | 51 | 42 | 98 | 48 | 45 | 53 | 49 | 98 |
| NpgsqlRest 4.1 AOT · functions | 105 | 104 | 83 | 65 | 133 | 128 | 97 | 88 | 118 | 133 |
| Axum 0.8 (Rust) | 33 | 29 | 22 | 22 | 133 | 37 | 22 | 22 | 23 | 133 |
| Actix-web 4.20 (Rust) | 36 | 34 | 33 | 32 | 137 | 83 | 83 | 82 | 32 | 137 |
| PostgREST 16.6 | 142 | 125 | 101 | 80 | 137 | 86 | 88 | 88 | 96 | 142 |
| Swoole 6.2 (PHP) | 78 | 89 | 86 | 84 | 146 | 142 | 142 | 142 | 145 | 146 |
| NpgsqlRest 4.1 AOT · SQL files | 104 | 108 | 74 | 82 | 179 | 190 | 89 | 90 | 110 | 190 |
| NpgsqlRest 4.1 JIT · functions | 147 | 167 | 163 | 129 | 204 | 197 | 195 | 152 | 157 | 204 |
| NpgsqlRest 4.1 JIT · SQL files | 156 | 161 | 142 | 130 | 224 | 191 | 192 | 166 | 154 | 224 |
| .NET 10 · Dapper | 147 | 131 | 123 | 114 | 289 | 275 | 165 | 187 | 163 | 289 |
| Bun 1.4 | 277 | 176 | 186 | 172 | 292 | 169 | 163 | 174 | 163 | 292 |
| FastAPI 0.165 | 303 | 291 | 288 | 288 | 299 | 298 | 298 | 296 | 297 | 303 |
| .NET 10 · EF Core | 165 | 189 | 175 | 172 | 312 | 290 | 235 | 244 | 247 | 312 |
| .NET 10 · plain Npgsql | 128 | 129 | 116 | 106 | 317 | 254 | 135 | 137 | 135 | 317 |
| .NET 11 · Dapper | 143 | 135 | 147 | 119 | 319 | 280 | 201 | 185 | 160 | 319 |
| .NET 11 · plain Npgsql | 138 | 125 | 118 | 120 | 341 | 281 | 152 | 164 | 153 | 341 |
| .NET 11 · EF Core | 153 | 181 | 178 | 167 | 348 | 294 | 221 | 220 | 231 | 348 |
| NpgsqlRest 3.21 AOT · functions | 165 | 109 | 125 | 101 | 365 | 305 | 198 | 143 | 158 | 365 |
| NpgsqlRest 3.21 JIT · functions | 166 | 179 | 166 | 140 | 422 | 394 | 280 | 280 | 252 | 422 |
| NpgsqlRest 3.21 AOT · SQL files | 177 | 115 | 110 | 96 | 436 | 347 | 124 | 126 | 166 | 436 |
| NpgsqlRest 3.21 JIT · SQL files | 160 | 163 | 153 | 149 | 542 | 394 | 223 | 208 | 228 | 542 |
| Deno 2.9 | 553 | 395 | 389 | 299 | 464 | 401 | 396 | 401 | 396 | 553 |
| Express 5.3 | 746 | 433 | 447 | 450 | 724 | 615 | 645 | 652 | 647 | 746 |
| Django 6.1 | 769 | 443 | 435 | 447 | 601 | 507 | 519 | 530 | 543 | 769 |
| Fastify 5.12 | 774 | 410 | 424 | 428 | 761 | 544 | 536 | 545 | 543 | 774 |
| NestJS 12.6 | 787 | 521 | 507 | 506 | 810 | 672 | 697 | 690 | 700 | 810 |
| Laravel Octane 13.43 | 680 | 663 | 748 | 815 | 898 | 910 | 921 | 951 | 977 | 977 |
| PostGraphile 5.2 (GraphQL) | 1,058 | 994 | 907 | 844 | 1,309 | 1,120 | 1,043 | 971 | 940 | 1,309 |
| Spring Boot 4.2 (Java 25) | 1,158 | 1,188 | 1,244 | 1,275 | 1,313 | 1,589 | 1,599 | 1,609 | 1,620 | 1,620 |
| Hasura 2.50 (GraphQL) | 318 | 231 | 221 | 212 | 2,571 | 206 | 199 | 207 | 208 | 2,571 |
Memory when idle
Each service was restarted before the tests and its memory read ten seconds after its first answer, before any load. This is what it costs to keep a service that is doing nothing.
↓ shorter bar is betterMegabytes the service holds ten seconds after it started, before it has served any load.
- 1Axum 0.8 (Rust)2.6MB
- 2Actix-web 4.20 (Rust)3.4MB
- 3Go 1.27 · net/http4.9MB
- 4Gin 1.12 (Go)5.2MB
- 5PostgREST 16.67.2MB
- 6Swoole 6.2 (PHP)14.4MB
- 7NpgsqlRest 3.21 AOT · functions21.3MB
- 8NpgsqlRest 3.21 AOT · SQL files22.1MB
- 9NpgsqlRest 4.1 AOT · functions22.8MB
- 10NpgsqlRest 4.1 AOT · SQL files23.9MB
- 11.NET 10 · plain Npgsql32.4MB
- 12.NET 11 · plain Npgsql33.1MB
- 13.NET 10 · Dapper33.5MB
- 14.NET 11 · Dapper33.9MB
- 15NpgsqlRest 4.1 JIT · functions38.9MB
- 16NpgsqlRest 4.1 JIT · SQL files39.4MB
- 17Bun 1.443.1MB
- 18.NET 10 · EF Core45.5MB
- 19.NET 11 · EF Core46.5MB
- 20NpgsqlRest 3.21 JIT · functions47.6MB
- 21NpgsqlRest 3.21 JIT · SQL files48.6MB
- 22Deno 2.990.0MB
- 23Express 5.3102.7MB
- 24Fastify 5.12123.6MB
- 25Django 6.1133.6MB
- 26Hasura 2.50 (GraphQL)159.1MB
- 27FastAPI 0.165188.9MB
- 28Spring Boot 4.2 (Java 25)202.6MB
- 29NestJS 12.6210.5MB
- 30PostGraphile 5.2 (GraphQL)372.2MB
- 31Laravel Octane 13.43452.5MB
Services that start one process or several workers per CPU core (the Node.js ones, PostGraphile, Laravel Octane, Django, FastAPI) hold that memory once per worker; here each service has 4 cores.
Time to the first answer
From restarting the container to the first correct response, polled every 20 ms. It matters for scaling out quickly, for deployments, and for platforms that start a service on demand.
↓ shorter bar is betterMilliseconds from starting the service until it answers its first request correctly. 1,000 ms is one second.
- 1Actix-web 4.20 (Rust)47ms
- 2Axum 0.8 (Rust)51ms
- 3Go 1.27 · net/http53ms
- 4Gin 1.12 (Go)55ms
- 5Swoole 6.2 (PHP)111ms
- 6Bun 1.4153ms
- 7PostgREST 16.6165ms
- 8Deno 2.9167ms
- 9NpgsqlRest 3.21 AOT · SQL files195ms
- 10NpgsqlRest 3.21 AOT · functions231ms
- 11NpgsqlRest 4.1 AOT · SQL files244ms
- 12NpgsqlRest 4.1 AOT · functions287ms
- 13Express 5.3322ms
- 14Fastify 5.12372ms
- 15Django 6.1373ms
- 16.NET 11 · Dapper506ms
- 17.NET 11 · plain Npgsql508ms
- 18.NET 10 · plain Npgsql547ms
- 19FastAPI 0.165600ms
- 20.NET 10 · Dapper603ms
- 21NestJS 12.6827ms
- 22PostGraphile 5.2 (GraphQL)943ms
- 23.NET 10 · EF Core998ms
- 24.NET 11 · EF Core1,019ms
- 25NpgsqlRest 3.21 JIT · functions1,064ms
- 26NpgsqlRest 3.21 JIT · SQL files1,104ms
- 27Laravel Octane 13.431,166ms
- 28NpgsqlRest 4.1 JIT · functions1,213ms
- 29NpgsqlRest 4.1 JIT · SQL files1,254ms
- 30Hasura 2.50 (GraphQL)2,365ms
- 31Spring Boot 4.2 (Java 25)2,518ms
Image size
↓ shorter bar is betterMegabytes to download and store in order to run the service.
- 1Go 1.27 · net/http8MB
- 2Gin 1.12 (Go)12MB
- 3PostgREST 16.620MB
- 4Axum 0.8 (Rust)29MB
- 5Actix-web 4.20 (Rust)30MB
- 6NpgsqlRest 3.21 AOT · SQL files58MB
- 7NpgsqlRest 3.21 AOT · functions58MB
- 8NpgsqlRest 4.1 AOT · SQL files59MB
- 9NpgsqlRest 4.1 AOT · functions59MB
- 10FastAPI 0.16562MB
- 11Django 6.167MB
- 12Deno 2.970MB
- 13NestJS 12.685MB
- 14Express 5.385MB
- 15Fastify 5.1288MB
- 16.NET 10 · plain Npgsql94MB
- 17.NET 10 · Dapper94MB
- 18.NET 10 · EF Core96MB
- 19Spring Boot 4.2 (Java 25)96MB
- 20Bun 1.4100MB
- 21.NET 11 · plain Npgsql108MB
- 22.NET 11 · Dapper108MB
- 23NpgsqlRest 3.21 JIT · SQL files108MB
- 24NpgsqlRest 3.21 JIT · functions108MB
- 25.NET 11 · EF Core110MB
- 26NpgsqlRest 4.1 JIT · SQL files123MB
- 27NpgsqlRest 4.1 JIT · functions123MB
- 28Hasura 2.50 (GraphQL)206MB
- 29Swoole 6.2 (PHP)220MB
- 30PostGraphile 5.2 (GraphQL)220MB
- 31Laravel Octane 13.43253MB
The NpgsqlRest and PostgREST images are the published ones; the others are built from the Dockerfile in each service directory.
CPU: requests per core
Requests per second for each CPU core the service used, averaged over all 44 tests. Higher is better. Unlike throughput, this is not capped when the load generator is the limit.
↑ longer bar is betterHow much work a service gets out of one CPU core, averaged over all 44 tests.
- 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
Time in PostgreSQL
PostgreSQL counted every statement and the time it spent executing it, per test (pg_stat_statements, reset before each test). Dividing that time by the average response time gives the share of a request that was the database's work. The rest is the service, the driver, and the network between the containers.
The table shows that share for the main test of each type. Where it is low, the service is the cost; where it is high, there is little left for a framework to win or lose.
| Service | Data types | Minimal request | POST body | Nested JSON | Large payload | Many parameters | Table lookup | Table list page | Table insert |
|---|---|---|---|---|---|---|---|---|---|
| NpgsqlRest 3.21 AOT · SQL files | 3% | 0% | 2% | 11% | 7% | 0% | 3% | 4% | 1% |
| NpgsqlRest 3.21 AOT · functions | 3% | 0% | 2% | 10% | 36% | 0% | 3% | 4% | 3% |
| NpgsqlRest 3.21 JIT · SQL files | 3% | 0% | 2% | 11% | 7% | 0% | 3% | 4% | 1% |
| NpgsqlRest 3.21 JIT · functions | 3% | 0% | 2% | 10% | 37% | 0% | 3% | 5% | 3% |
| NpgsqlRest 4.1 AOT · SQL files | 3% | 0% | 2% | 11% | 12% | 0% | 3% | 4% | 1% |
| NpgsqlRest 4.1 AOT · functions | 3% | 0% | 2% | 10% | 57% | 0% | 3% | 4% | 3% |
| NpgsqlRest 4.1 JIT · SQL files | 3% | 0% | 2% | 11% | 12% | 0% | 3% | 5% | 1% |
| NpgsqlRest 4.1 JIT · functions | 3% | 0% | 2% | 10% | 59% | 0% | 3% | 5% | 3% |
| .NET 10 · Dapper | 2% | 0% | 1% | 5% | 4% | 0% | 2% | 2% | 4% |
| .NET 10 · EF Core | 1% | 0% | 0% | 3% | 3% | 0% | 1% | 1% | 3% |
| .NET 10 · plain Npgsql | 2% | 0% | 1% | 5% | 4% | 0% | 2% | 3% | 4% |
| .NET 11 · Dapper | 2% | 0% | 1% | 5% | 3% | 0% | 2% | 2% | 4% |
| .NET 11 · EF Core | 1% | 0% | 0% | 3% | 3% | 0% | 1% | 1% | 3% |
| .NET 11 · plain Npgsql | 2% | 0% | 1% | 5% | 3% | 0% | 2% | 2% | 3% |
| Gin 1.12 (Go) | 3% | 0% | 1% | 11% | 39% | 3% | 4% | 6% | 3% |
| Go 1.27 · net/http | 2% | 0% | 1% | 11% | 43% | 4% | 4% | 7% | 3% |
| Actix-web 4.20 (Rust) | 3% | 0% | 1% | 6% | 10% | 0% | 3% | 5% | 3% |
| Axum 0.8 (Rust) | 3% | 0% | 1% | 6% | 11% | 0% | 3% | 5% | 3% |
| Spring Boot 4.2 (Java 25) | 3% | 0% | 2% | 10% | 34% | 2% | 4% | 5% | 3% |
| Express 5.3 | 1% | 0% | 1% | 8% | 9% | 0% | 2% | 2% | 2% |
| Fastify 5.12 | 2% | 0% | 1% | 9% | 11% | 0% | 2% | 3% | 2% |
| NestJS 12.6 | 1% | 0% | 1% | 8% | 10% | 0% | 2% | 3% | 2% |
| Bun 1.4 | 3% | 0% | 2% | 10% | 33% | 3% | 4% | 5% | 3% |
| Deno 2.9 | 3% | 0% | 2% | 10% | 43% | 3% | 3% | 4% | 3% |
| Django 6.1 | 1% | 0% | 0% | 1% | 5% | 0% | 0% | 1% | 0% |
| FastAPI 0.165 | 0% | 0% | 0% | 0% | 7% | 0% | 0% | 0% | 0% |
| Laravel Octane 13.43 | 0% | 0% | 0% | 1% | 3% | 0% | 0% | 0% | 0% |
| Swoole 6.2 (PHP) | 2% | 0% | 1% | 4% | 8% | 0% | 2% | 3% | 2% |
| PostgREST 16.6 | 1% | 0% | 1% | 3% | 24% | 1% | 1% | 2% | 1% |
| Hasura 2.50 (GraphQL) | 1% | 0% | 0% | 3% | 32% | 0% | 0% | 1% | 0% |
| PostGraphile 5.2 (GraphQL) | 2% | 0% | 0% | 4% | 34% | 1% | 1% | 3% | 1% |
Planning time is not included, and a service that sends statements without preparing them makes PostgreSQL plan each one. The numbers are comparable between services in the same column, less so between columns.
Previous: ← Tables · Next: Every Service, One Scorecard →