Skip to content

POST Body: Reading JSON In, Writing JSON Out ​

Benchmark · November 2026 · POST body

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:

What this test does ​

The service receives a POST with a JSON body (a row count and a small JSON document), passes the document to a function as jsonb, and returns 10 or 100 rows that each echo it back. It measures reading and parsing a request body, sending JSON to the database, and writing JSON that contains JSON.

It is run at 50, 100 and 200 users at the same time.

The code that ran: the load script scenarios/post-body.js, the PostgreSQL function in init.sql (for the NpgsqlRest SQL file services: perf-post.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.

Eight services return the JSON document as a string

Go, Gin, Django, FastAPI, Swoole, Laravel Octane, Bun and Deno return the echoed jsonb value as a JSON string ("{\"key\": \"value\"}"), not as a nested object. Their numbers are measured correctly, but they do a little less work in this kind of test, and a client has to parse the value a second time. They are marked with † in the tables.

What the numbers say ​

  • Go, Bun, Gin and Deno lead, and all four are among the eight services that return the document as a string (see the box above). Of the services that return it as JSON, the first is .NET 10 · plain Npgsql.
  • NpgsqlRest and hand-written .NET are level: NpgsqlRest 4.1 (JIT, SQL files) does 34,124 requests per second and .NET 10 with Dapper 33,933.
  • With 100 rows the load generator is the limit for most services, and the numbers at the top converge.

Of the 186 tests on this page, the service was out of CPU in 81, the load generator in 88, PostgreSQL in 0, and nothing in 17 (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 the size, 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 (50 users, 10 rows), which the summary tables of the series use.

Users at the same time
Rows in the response
Show
Requests per second: 50 users, 10 rows

↑ longer bar is betterHow many requests each service answered per second, with 50 users sending requests at the same time.

  1. 1Go 1.27 · net/http39,402req/s
  2. 2Bun 1.438,924req/s
  3. 3Gin 1.12 (Go)37,428req/s
  4. 4Deno 2.935,710req/s
  5. 5.NET 10 · plain Npgsql35,111req/s
  6. 6NpgsqlRest 4.1 JIT · SQL files34,124req/sk6 limit
  7. 7NpgsqlRest 3.21 JIT · SQL files33,986req/s
  8. 8.NET 10 · Dapper33,933req/s
  9. 9NpgsqlRest 4.1 JIT · functions33,662req/sk6 limit
  10. 10.NET 11 · plain Npgsql33,516req/sk6 limit
  11. 11NpgsqlRest 3.21 JIT · functions32,818req/s
  12. 12.NET 11 · Dapper31,563req/s
  13. 13NpgsqlRest 4.1 AOT · SQL files31,539req/s
  14. 14NpgsqlRest 3.21 AOT · SQL files31,318req/s
  15. 15NpgsqlRest 4.1 AOT · functions30,669req/s
  16. 16NpgsqlRest 3.21 AOT · functions29,965req/s
  17. 17Actix-web 4.20 (Rust)29,474req/s
  18. 18Axum 0.8 (Rust)29,197req/s
  19. 19Fastify 5.1225,634req/s
  20. 20Spring Boot 4.2 (Java 25)23,782req/s
  21. 21Swoole 6.2 (PHP)22,415req/s
  22. 22Express 5.320,002req/s
  23. 23NestJS 12.618,721req/s
  24. 24.NET 11 · EF Core13,657req/s
  25. 25.NET 10 · EF Core13,442req/s
  26. 26PostGraphile 5.2 (GraphQL)8,782req/s
  27. 27FastAPI 0.1657,645req/s
  28. 28PostgREST 16.66,730req/s
  29. 29Hasura 2.50 (GraphQL)3,376req/s
  30. 30Django 6.12,466req/s
  31. 31Laravel Octane 13.431,842req/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 50 users at the same time, 10 rows, Go 1.27 · net/http is first with 39,402 requests per second, 1.2% ahead of Bun 1.4. 4 of the 31 services are within 10% of the leader, and the slowest does 1,842.

The best of each platform ​

The fastest service of every platform in the main test (50 users, 10 rows). "Compared with the fastest" is its requests per second as a percentage of the service in first place.

PlatformIts fastest servicePlace among the 31Requests per secondCompared with the fastestIts code
GoGo 1.27 · net/http139,402100%main.go
Bun & DenoBun 1.4238,92499%app.ts
.NET.NET 10 · plain Npgsql535,11189%Program.cs
NpgsqlRestNpgsqlRest 4.1 JIT · SQL files634,12487%appsettings.json
RustActix-web 4.20 (Rust)1729,47475%main.rs
Node.jsFastify 5.121925,63465%app.js
JavaSpring Boot 4.2 (Java 25)2023,78260%Application.java
PHPSwoole 6.2 (PHP)2122,41557%server.php
GraphQLPostGraphile 5.2 (GraphQL)268,78222%graphile.config.mjs
PythonFastAPI 0.165277,64519%app.py
PostgRESTPostgREST 16.6286,73017%postgrest.conf

Every measurement of the main test ​

Latency, CPU, memory and time in PostgreSQL for all 31 services
#ServiceRequests/sMedian msp99 msCPU cores usedRequests/s per corePeak memory MBTime in PostgreSQLOut of CPU
1Go 1.27 · net/http †39,4020.873.53.4511,431321%service
2Bun 1.4 †38,9240.993.33.5111,0861642%service
3Gin 1.12 (Go) †37,4280.923.73.4810,763351%service
4Deno 2.9 †35,7101.092.83.629,8723312%service
5.NET 10 · plain Npgsql35,1110.864.03.529,9871051%service
6NpgsqlRest 4.1 JIT · SQL files34,1240.914.22.8811,8331282%k6
7NpgsqlRest 3.21 JIT · SQL files33,9860.924.03.599,4681392%service
8.NET 10 · Dapper33,9330.864.73.639,3541181%service
9NpgsqlRest 4.1 JIT · functions33,6620.934.22.8411,8641382%k6
10.NET 11 · plain Npgsql33,5160.954.23.0610,9371111%k6
11NpgsqlRest 3.21 JIT · functions32,8180.885.03.758,7571512%service
12.NET 11 · Dapper31,5630.994.72.8711,0091161%—
13NpgsqlRest 4.1 AOT · SQL files31,5391.044.23.279,642722%—
14NpgsqlRest 3.21 AOT · SQL files31,3181.074.03.568,797852%service
15NpgsqlRest 4.1 AOT · functions30,6691.084.33.219,548772%—
16NpgsqlRest 3.21 AOT · functions29,9651.045.23.418,781832%service
17Actix-web 4.20 (Rust)29,4741.253.83.428,626311%service
18Axum 0.8 (Rust)29,1971.284.03.438,519201%service
19Fastify 5.1225,6341.574.33.607,1264041%service
20Spring Boot 4.2 (Java 25)23,7821.515.03.496,8081,2182%service
21Swoole 6.2 (PHP) †22,4151.982.83.686,093781%service
22Express 5.320,0022.084.23.775,3004381%service
23NestJS 12.618,7212.274.33.774,9644991%service
24.NET 11 · EF Core13,6572.6110.33.723,6701600%service
25.NET 10 · EF Core13,4423.215.63.763,5721530%service
26PostGraphile 5.2 (GraphQL)8,7824.1214.73.782,3239070%service
27FastAPI 0.165 †7,6455.937.83.812,0052870%service
28PostgREST 16.66,7306.679.12.942,2861011%—
29Hasura 2.50 (GraphQL)3,37614.4020.42.351,4392110%—
30Django 6.1 †2,46618.7832.03.477113630%service
31Laravel Octane 13.43 †1,84222.7850.53.834816740%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.

Service50 users, 10 rows50 users, 100 rows100 users, 10 rows100 users, 100 rows200 users, 10 rows200 users, 100 rows
Go 1.27 · net/http †39,40213,252ᵏ40,29613,574ᵏ39,63613,177ᵏ
Bun 1.4 †38,92413,609ᵏ40,86714,083ᵏ40,88913,674ᵏ
Gin 1.12 (Go) †37,42812,893ᵏ38,68613,497ᵏ38,70713,107ᵏ
Deno 2.9 †35,71014,009ᵏ38,64314,053ᵏ40,46113,565ᵏ
.NET 10 · plain Npgsql35,1116,025ᵏ34,6715,927ᵏ33,3145,767ᵏ
NpgsqlRest 4.1 JIT · SQL files34,124ᵏ6,012ᵏ34,287ᵏ5,942ᵏ32,805ᵏ5,782ᵏ
NpgsqlRest 3.21 JIT · SQL files33,9865,947ᵏ33,7185,898ᵏ33,1345,777ᵏ
.NET 10 · Dapper33,9336,011ᵏ34,6216,029ᵏ33,4525,783ᵏ
NpgsqlRest 4.1 JIT · functions33,662ᵏ6,046ᵏ34,217ᵏ5,947ᵏ32,911ᵏ5,777ᵏ
.NET 11 · plain Npgsql33,516ᵏ5,992ᵏ33,722ᵏ5,926ᵏ32,544ᵏ5,829ᵏ
NpgsqlRest 3.21 JIT · functions32,8185,960ᵏ34,5695,905ᵏ33,3025,769ᵏ
.NET 11 · Dapper31,5635,981ᵏ33,018ᵏ5,922ᵏ32,016ᵏ5,786ᵏ
NpgsqlRest 4.1 AOT · SQL files31,5396,012ᵏ31,9355,925ᵏ30,766ᵏ5,798ᵏ
NpgsqlRest 3.21 AOT · SQL files31,3185,972ᵏ32,0735,905ᵏ31,4685,752ᵏ
NpgsqlRest 4.1 AOT · functions30,6696,028ᵏ31,2455,920ᵏ30,437ᵏ5,783ᵏ
NpgsqlRest 3.21 AOT · functions29,9655,950ᵏ31,8255,882ᵏ31,1895,754ᵏ
Actix-web 4.20 (Rust)29,4746,013ᵏ30,9055,954ᵏ32,4075,827ᵏ
Axum 0.8 (Rust)29,1976,039ᵏ29,8705,948ᵏ30,4955,803ᵏ
Fastify 5.1225,6345,969ᵏ26,8555,922ᵏ27,6885,806ᵏ
Spring Boot 4.2 (Java 25)23,7825,965ᵏ24,3125,878ᵏ23,9755,757ᵏ
Swoole 6.2 (PHP) †22,41511,97822,69912,69322,66112,486
Express 5.320,0025,974ᵏ20,6215,939ᵏ21,2075,780ᵏ
NestJS 12.618,7215,980ᵏ19,2655,918ᵏ19,4595,735ᵏ
.NET 11 · EF Core13,6575,889ᵏ14,2615,856ᵏ14,2725,755ᵏ
.NET 10 · EF Core13,4425,904ᵏ13,6745,873ᵏ13,7965,768ᵏ
PostGraphile 5.2 (GraphQL)8,7821,716ᵏ8,4081,794ᵏ8,3751,823ᵏ
FastAPI 0.165 †7,6453,0017,8873,0607,8133,059
PostgREST 16.66,7305,6246,6575,5585,9915,207
Hasura 2.50 (GraphQL)3,3763,0063,1072,8052,9942,659
Django 6.1 †2,4662,2082,3942,1352,3262,084
Laravel Octane 13.43 †1,8421,6531,8271,6521,8431,662

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. † returns JSON columns as a string.


Previous: ← Minimal Request · Next: Nested JSON →

Comments