Skip to content

Resources: Memory, CPU, Startup and Size ​

Benchmark · November 2026 · Resources

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.
Highlight:

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.

The most memory each service used in any test

↓ shorter bar is betterMegabytes of memory at the worst moment of all 44 tests.

  1. 1Go 1.27 · net/http80MB
  2. 2Gin 1.12 (Go)98MB
  3. 3NpgsqlRest 4.1 AOT · functions133MB
  4. 4Axum 0.8 (Rust)133MB
  5. 5Actix-web 4.20 (Rust)137MB
  6. 6PostgREST 16.6142MB
  7. 7Swoole 6.2 (PHP)146MB
  8. 8NpgsqlRest 4.1 AOT · SQL files190MB
  9. 9NpgsqlRest 4.1 JIT · functions205MB
  10. 10NpgsqlRest 4.1 JIT · SQL files224MB
  11. 11.NET 10 · Dapper289MB
  12. 12Bun 1.4292MB
  13. 13FastAPI 0.165303MB
  14. 14.NET 10 · EF Core312MB
  15. 15.NET 10 · plain Npgsql317MB
  16. 16.NET 11 · Dapper319MB
  17. 17.NET 11 · plain Npgsql341MB
  18. 18.NET 11 · EF Core348MB
  19. 19NpgsqlRest 3.21 AOT · functions365MB
  20. 20NpgsqlRest 3.21 JIT · functions422MB
  21. 21NpgsqlRest 3.21 AOT · SQL files436MB
  22. 22NpgsqlRest 3.21 JIT · SQL files542MB
  23. 23Deno 2.9553MB
  24. 24Express 5.3746MB
  25. 25Django 6.1769MB
  26. 26Fastify 5.12774MB
  27. 27NestJS 12.6810MB
  28. 28Laravel Octane 13.43977MB
  29. 29PostGraphile 5.2 (GraphQL)1,309MB
  30. 30Spring Boot 4.2 (Java 25)1,620MB
  31. 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.

ServiceData typesMinimal requestPOST bodyNested JSONLarge payloadMany parametersTable lookupTable list pageTable insertHighest
Go 1.27 · net/http54604842805050504880
Gin 1.12 (Go)57635142984845534998
NpgsqlRest 4.1 AOT · functions10510483651331289788118133
Axum 0.8 (Rust)3329222213337222223133
Actix-web 4.20 (Rust)3634333213783838232137
PostgREST 16.61421251018013786888896142
Swoole 6.2 (PHP)78898684146142142142145146
NpgsqlRest 4.1 AOT · SQL files10410874821791908990110190
NpgsqlRest 4.1 JIT · functions147167163129204197195152157204
NpgsqlRest 4.1 JIT · SQL files156161142130224191192166154224
.NET 10 · Dapper147131123114289275165187163289
Bun 1.4277176186172292169163174163292
FastAPI 0.165303291288288299298298296297303
.NET 10 · EF Core165189175172312290235244247312
.NET 10 · plain Npgsql128129116106317254135137135317
.NET 11 · Dapper143135147119319280201185160319
.NET 11 · plain Npgsql138125118120341281152164153341
.NET 11 · EF Core153181178167348294221220231348
NpgsqlRest 3.21 AOT · functions165109125101365305198143158365
NpgsqlRest 3.21 JIT · functions166179166140422394280280252422
NpgsqlRest 3.21 AOT · SQL files17711511096436347124126166436
NpgsqlRest 3.21 JIT · SQL files160163153149542394223208228542
Deno 2.9553395389299464401396401396553
Express 5.3746433447450724615645652647746
Django 6.1769443435447601507519530543769
Fastify 5.12774410424428761544536545543774
NestJS 12.6787521507506810672697690700810
Laravel Octane 13.43680663748815898910921951977977
PostGraphile 5.2 (GraphQL)1,0589949078441,3091,1201,0439719401,309
Spring Boot 4.2 (Java 25)1,1581,1881,2441,2751,3131,5891,5991,6091,6201,620
Hasura 2.50 (GraphQL)3182312212122,5712061992072082,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.

Memory when idle

↓ shorter bar is betterMegabytes the service holds ten seconds after it started, before it has served any load.

  1. 1Axum 0.8 (Rust)2.6MB
  2. 2Actix-web 4.20 (Rust)3.4MB
  3. 3Go 1.27 · net/http4.9MB
  4. 4Gin 1.12 (Go)5.2MB
  5. 5PostgREST 16.67.2MB
  6. 6Swoole 6.2 (PHP)14.4MB
  7. 7NpgsqlRest 3.21 AOT · functions21.3MB
  8. 8NpgsqlRest 3.21 AOT · SQL files22.1MB
  9. 9NpgsqlRest 4.1 AOT · functions22.8MB
  10. 10NpgsqlRest 4.1 AOT · SQL files23.9MB
  11. 11.NET 10 · plain Npgsql32.4MB
  12. 12.NET 11 · plain Npgsql33.1MB
  13. 13.NET 10 · Dapper33.5MB
  14. 14.NET 11 · Dapper33.9MB
  15. 15NpgsqlRest 4.1 JIT · functions38.9MB
  16. 16NpgsqlRest 4.1 JIT · SQL files39.4MB
  17. 17Bun 1.443.1MB
  18. 18.NET 10 · EF Core45.5MB
  19. 19.NET 11 · EF Core46.5MB
  20. 20NpgsqlRest 3.21 JIT · functions47.6MB
  21. 21NpgsqlRest 3.21 JIT · SQL files48.6MB
  22. 22Deno 2.990.0MB
  23. 23Express 5.3102.7MB
  24. 24Fastify 5.12123.6MB
  25. 25Django 6.1133.6MB
  26. 26Hasura 2.50 (GraphQL)159.1MB
  27. 27FastAPI 0.165188.9MB
  28. 28Spring Boot 4.2 (Java 25)202.6MB
  29. 29NestJS 12.6210.5MB
  30. 30PostGraphile 5.2 (GraphQL)372.2MB
  31. 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.

Time to the first answer

↓ shorter bar is betterMilliseconds from starting the service until it answers its first request correctly. 1,000 ms is one second.

  1. 1Actix-web 4.20 (Rust)47ms
  2. 2Axum 0.8 (Rust)51ms
  3. 3Go 1.27 · net/http53ms
  4. 4Gin 1.12 (Go)55ms
  5. 5Swoole 6.2 (PHP)111ms
  6. 6Bun 1.4153ms
  7. 7PostgREST 16.6165ms
  8. 8Deno 2.9167ms
  9. 9NpgsqlRest 3.21 AOT · SQL files195ms
  10. 10NpgsqlRest 3.21 AOT · functions231ms
  11. 11NpgsqlRest 4.1 AOT · SQL files244ms
  12. 12NpgsqlRest 4.1 AOT · functions287ms
  13. 13Express 5.3322ms
  14. 14Fastify 5.12372ms
  15. 15Django 6.1373ms
  16. 16.NET 11 · Dapper506ms
  17. 17.NET 11 · plain Npgsql508ms
  18. 18.NET 10 · plain Npgsql547ms
  19. 19FastAPI 0.165600ms
  20. 20.NET 10 · Dapper603ms
  21. 21NestJS 12.6827ms
  22. 22PostGraphile 5.2 (GraphQL)943ms
  23. 23.NET 10 · EF Core998ms
  24. 24.NET 11 · EF Core1,019ms
  25. 25NpgsqlRest 3.21 JIT · functions1,064ms
  26. 26NpgsqlRest 3.21 JIT · SQL files1,104ms
  27. 27Laravel Octane 13.431,166ms
  28. 28NpgsqlRest 4.1 JIT · functions1,213ms
  29. 29NpgsqlRest 4.1 JIT · SQL files1,254ms
  30. 30Hasura 2.50 (GraphQL)2,365ms
  31. 31Spring Boot 4.2 (Java 25)2,518ms

Image size ​

Size of the container image

↓ shorter bar is betterMegabytes to download and store in order to run the service.

  1. 1Go 1.27 · net/http8MB
  2. 2Gin 1.12 (Go)12MB
  3. 3PostgREST 16.620MB
  4. 4Axum 0.8 (Rust)29MB
  5. 5Actix-web 4.20 (Rust)30MB
  6. 6NpgsqlRest 3.21 AOT · SQL files58MB
  7. 7NpgsqlRest 3.21 AOT · functions58MB
  8. 8NpgsqlRest 4.1 AOT · SQL files59MB
  9. 9NpgsqlRest 4.1 AOT · functions59MB
  10. 10FastAPI 0.16562MB
  11. 11Django 6.167MB
  12. 12Deno 2.970MB
  13. 13NestJS 12.685MB
  14. 14Express 5.385MB
  15. 15Fastify 5.1288MB
  16. 16.NET 10 · plain Npgsql94MB
  17. 17.NET 10 · Dapper94MB
  18. 18.NET 10 · EF Core96MB
  19. 19Spring Boot 4.2 (Java 25)96MB
  20. 20Bun 1.4100MB
  21. 21.NET 11 · plain Npgsql108MB
  22. 22.NET 11 · Dapper108MB
  23. 23NpgsqlRest 3.21 JIT · SQL files108MB
  24. 24NpgsqlRest 3.21 JIT · functions108MB
  25. 25.NET 11 · EF Core110MB
  26. 26NpgsqlRest 4.1 JIT · SQL files123MB
  27. 27NpgsqlRest 4.1 JIT · functions123MB
  28. 28Hasura 2.50 (GraphQL)206MB
  29. 29Swoole 6.2 (PHP)220MB
  30. 30PostGraphile 5.2 (GraphQL)220MB
  31. 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.

Requests per second for each CPU core the service used

↑ longer bar is betterHow much work a service gets out of one CPU core, averaged over all 44 tests.

  1. 1NpgsqlRest 4.1 JIT · SQL files4,131req/s per core
  2. 2NpgsqlRest 4.1 JIT · functions4,079req/s per core
  3. 3Actix-web 4.20 (Rust)3,949req/s per core
  4. 4Axum 0.8 (Rust)3,861req/s per core
  5. 5Gin 1.12 (Go)3,846req/s per core
  6. 6Go 1.27 · net/http3,674req/s per core
  7. 7Bun 1.43,630req/s per core
  8. 8.NET 11 · plain Npgsql3,569req/s per core
  9. 9NpgsqlRest 4.1 AOT · SQL files3,557req/s per core
  10. 10Deno 2.93,549req/s per core
  11. 11NpgsqlRest 4.1 AOT · functions3,539req/s per core
  12. 12.NET 11 · Dapper3,474req/s per core
  13. 13.NET 10 · plain Npgsql2,960req/s per core
  14. 14.NET 10 · Dapper2,876req/s per core
  15. 15Swoole 6.2 (PHP)2,861req/s per core
  16. 16NpgsqlRest 3.21 AOT · SQL files2,842req/s per core
  17. 17NpgsqlRest 3.21 JIT · SQL files2,829req/s per core
  18. 18NpgsqlRest 3.21 AOT · functions2,828req/s per core
  19. 19NpgsqlRest 3.21 JIT · functions2,779req/s per core
  20. 20Fastify 5.122,612req/s per core
  21. 21Spring Boot 4.2 (Java 25)2,470req/s per core
  22. 22NestJS 12.62,008req/s per core
  23. 23Express 5.32,005req/s per core
  24. 24.NET 11 · EF Core1,758req/s per core
  25. 25.NET 10 · EF Core1,604req/s per core
  26. 26PostgREST 16.61,508req/s per core
  27. 27Hasura 2.50 (GraphQL)942req/s per core
  28. 28PostGraphile 5.2 (GraphQL)832req/s per core
  29. 29FastAPI 0.165783req/s per core
  30. 30Django 6.1432req/s per core
  31. 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.

ServiceData typesMinimal requestPOST bodyNested JSONLarge payloadMany parametersTable lookupTable list pageTable insert
NpgsqlRest 3.21 AOT · SQL files3%0%2%11%7%0%3%4%1%
NpgsqlRest 3.21 AOT · functions3%0%2%10%36%0%3%4%3%
NpgsqlRest 3.21 JIT · SQL files3%0%2%11%7%0%3%4%1%
NpgsqlRest 3.21 JIT · functions3%0%2%10%37%0%3%5%3%
NpgsqlRest 4.1 AOT · SQL files3%0%2%11%12%0%3%4%1%
NpgsqlRest 4.1 AOT · functions3%0%2%10%57%0%3%4%3%
NpgsqlRest 4.1 JIT · SQL files3%0%2%11%12%0%3%5%1%
NpgsqlRest 4.1 JIT · functions3%0%2%10%59%0%3%5%3%
.NET 10 · Dapper2%0%1%5%4%0%2%2%4%
.NET 10 · EF Core1%0%0%3%3%0%1%1%3%
.NET 10 · plain Npgsql2%0%1%5%4%0%2%3%4%
.NET 11 · Dapper2%0%1%5%3%0%2%2%4%
.NET 11 · EF Core1%0%0%3%3%0%1%1%3%
.NET 11 · plain Npgsql2%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/http2%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.31%0%1%8%9%0%2%2%2%
Fastify 5.122%0%1%9%11%0%2%3%2%
NestJS 12.61%0%1%8%10%0%2%3%2%
Bun 1.43%0%2%10%33%3%4%5%3%
Deno 2.93%0%2%10%43%3%3%4%3%
Django 6.11%0%0%1%5%0%0%1%0%
FastAPI 0.1650%0%0%0%7%0%0%0%0%
Laravel Octane 13.430%0%0%1%3%0%0%0%0%
Swoole 6.2 (PHP)2%0%1%4%8%0%2%3%2%
PostgREST 16.61%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 →

Comments