Skip to content

Data and Method ​

Benchmark · November 2026 · Data and Method

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.

Every number in this series can be traced to a file. This page says where the files are, what is in them, how to run the round yourself, how this round relates to the one in July, and lists everything that went wrong or is less than ideal about it.

The dataset ​

Everything is in the benchmark repository, on the branch named after the round: 202611241439. The branch is the code that ran, with the results added: the round ran from commit e4ca9b1, and PostgREST and Swoole were repeated from commit 0454094, which holds their corrections.

FileWhat it is
results_extended.csvStart here. One row per test: throughput, latency percentiles, failed requests, CPU and memory of the service, CPU of PostgreSQL and of the load generator, what was out of CPU, PostgreSQL's own statistics
report.mdThe report generated with the round: every table, without commentary
results.json / results.csvThe results as k6 reported them, and the settings of the run
*_summary.txtThe k6 summary of each of the 1,364 tests
k6/The complete k6 output of each test as JSON: every metric, every percentile
test_log.csvStart and end time of every test, its k6 exit code and parameters, and what PostgreSQL counted during it
stats/CPU and memory of every container, one sample per second, for the whole run
stats/services.csvImage size, startup time and idle memory of every service
stats/environment.jsonThe machine, the versions, the image of every container and its CPU cores
superseded/The original results of the tests that were repeated

The columns of results_extended.csv ​

ColumnMeaning
scenario, tag, vus, records, depth, sizeKbThe test: its type, the service, users at the same time, and its size parameters
requests, rpsRequests in the whole test, and per second (ramp included)
rpsHoldRequests per second after the ramp, at the target number of users
latencyAvg … latencyMaxResponse time in milliseconds: average, median, p90, p95, p99, maximum
ttfbAvg, ttfbP99Time to the first byte of the response
failed, checksPassed, exitCodeFailed requests, the share of passed content checks, the k6 exit code (99: a latency objective was missed)
svcCpuAvg, svcCpuPeakCPU of the service in percent of one core (400 is all four)
svcMemAvgMb, svcMemPeakMbMemory of the service container
pgCpuAvg, k6CpuAvgCPU of PostgreSQL (of 1,600) and of the load generator (of 1,200)
atLimitWhich of the three was at 85% or more of its CPU: service, postgres, k6, combinations, or empty
rpsPerCorerps divided by the CPU cores the service used
pgCalls, pgExecMs, pgRows, pgConnectionsFrom pg_stat_statements: statements executed in the test, time executing them, rows returned; and the connections the service held
pgExecMsPerCall, dbTimeShareExecution time per statement, and that time as a share of the average response time

How the pages were made ​

The charts and tables of this series are written by a script from results_extended.csv and stats/services.csv. The script is in the documentation repository. No number was typed by hand. The definitions used:

  • Rank: the position of a service among the 31 in one test, by requests per second.
  • Speed score: in each test the fastest service is 100% and every other service is its requests per second as a percentage of that. A service's speed score is the average of its 44 percentages. The leaderboard and every "position of 31" are ordered by it.
  • Reference test: the one test of each type that summary tables use (data types: 100 users, 10 rows; minimal request: 100 users; post body: 50 users, 10 rows; nested json: 50 users, depth 1; large payload: 25 users, 100 KB; many parameters: 50 users; table lookup: 50 users; table list page: 50 users; table insert: 50 users).
  • A change between two services or versions ("+8%"): the geometric mean of the ratio over all tests both have.
  • Requests per CPU core: requests per second divided by the average CPU of the service in cores.
  • Out of CPU: average CPU at 85% or more of the cores a part may use.

Run it yourself ​

The repository has a step-by-step guide for renting a server and running a round, and the round runs unattended:

bash
bash
git clone https://github.com/NpgsqlRest/pg_function_load_tests.git && cd pg_function_load_tests/src
docker-compose -f docker-compose.yml -f docker-compose.server-48.yml up --build --detach
./test-services.sh                      # 279 endpoints must answer
PROFILE=server ./run-benchmark.sh       # about 61 hours

PROFILE=local is a short version for a laptop, and ONLY='^go-app|^npgsqlrest' limits a run to some services. An analysis of the method, with what is proposed for the next round, is in ANALYSIS.md.

This round and July 2026 ​

The previous round ran in July 2026 with 20 services. 18 of them are in this round too, almost all in a newer version. It is tempting to put the two rounds next to each other and read off who got faster. Most of the difference between the rounds is the machine, not the software, and this page is mainly about how to tell them apart.

What changed in the method ​

July 2026November 2026
Server8 dedicated vCPUs, 32 GB48 dedicated vCPUs, 192 GB
CPU cores for PostgreSQL216
CPU cores for the load generator212
CPU cores for the service44
PostgreSQL1819
Load generatork6, latest at the timek6 2.4.0, pinned
Services2031
Tests7601,364
Service was the part out of CPU18 of 760 tests558 of 1,364 tests
Resource samplesevery 3 seconds, services onlyevery second, for the services, PostgreSQL and the load generator

In July the service had 4 cores and PostgreSQL and the load generator had 2 each, so in almost every test one of those two ran out of CPU before the service did. This round gave them 16 and 12. The services have the same 4 cores as before and now get to use them.

The controls: the same images in both rounds ​

Four services ran in both rounds from exactly the same published image: the NpgsqlRest 3.21.0 builds. Nothing about them changed, so whatever changed in their numbers is the machine and the method.

Same image in both roundsData typesMinimalPOST bodyNested JSONLarge payloadMany parametersAll 38 shared tests
NpgsqlRest 3.21 AOT · SQL files6.0×3.6×9.5×8.9×2.7×2.8×5.7×
NpgsqlRest 3.21 JIT · SQL files6.1×3.9×9.8×9.0×3.6×3.2×6.1×
NpgsqlRest 3.21 AOT · functions6.1×3.8×9.5×8.9×2.4×3.1×5.8×
NpgsqlRest 3.21 JIT · functions6.2×4.0×9.8×8.9×3.6×3.3×6.1×

The same software answers 5.9 times as many requests on this round's setup, as the geometric mean of the four over the 38 tests both rounds have. Nothing in those services changed. That factor is the new machine and the new split of its cores: in July the database and the load generator, on 2 cores each, were what every fast service was waiting for. It is the yardstick for everything below: a service whose numbers rose by about that much did not get faster, it was let off the leash. And it is the reason no absolute number of this round should be compared with one of July.

Every service that was in both rounds ​

Requests per second in November as a multiple of July, over the tests both rounds have, and that change relative to the controls. A relative change near zero means the service moved with the machine. The last column is the one to read.

ServiceVersion in JulyVersion nowNovember as a multiple of JulyRelative to the controls
Axum 0.8 (Rust)0.8.90.8.96.6×+11%
.NET 10 · Dapper.NET 10.NET 10 (libraries updated)6.6×+11%
Actix-web 4.20 (Rust)1.97.01.100.06.5×+11%
Bun 1.41.3.141.4.56.1×+3%
NpgsqlRest 3.21 JIT · functions3.21.03.21.06.1×control
NpgsqlRest 3.21 JIT · SQL files3.21.03.21.06.1×control
Deno 2.92.9.22.9.86.1×+3%
Go 1.27 · net/http1.261.276.0×+2%
Fastify 5.125.10.05.12.85.9×−1%
NpgsqlRest 3.21 AOT · functions3.21.03.21.05.8×control
NpgsqlRest 3.21 AOT · SQL files3.21.03.21.05.7×control
Swoole 6.2 (PHP)6.2.16.2.65.3×−11%
Spring Boot 4.2 (Java 25)4.1.04.2.05.0×−16%
Express 5.35.2.15.3.04.9×−16%
.NET 10 · EF Core.NET 10.NET 10 (libraries updated)4.4×−25%
PostgREST 16.614.1416.63.6×−39%
FastAPI 0.1650.139.00.165.01.8×−69%
Django 6.16.0.76.1.31.5×−74%

How to read the relative column:

  • Near zero: the service is as fast as it was; the machine explains its change.
  • Clearly positive: it gained more than the machine gave. Either the new version is faster, or the service was held back more than the controls in July (a service that needs little CPU per request was limited mostly by the 2-core database then).
  • Clearly negative: it gained less than the controls. Either the new version is slower, or, far more likely for the large negative numbers, the service was already at its own limit in July and had little to gain from a faster database and load generator. Django and FastAPI were the services that used most of their CPU in July. PostgREST and Swoole are a different case: in July both ran with a setup that held them back (10 connections; four requests at a time), which was corrected in this round, so their change is the machine and the correction together.

One run per test in each round cannot separate those explanations, and differences of a few percent mean nothing here. The page is a map of where to look, not a verdict on any release.

What is new and has no July counterpart ​

  • Services: NpgsqlRest 4.1.0 (four variants), .NET 11 (three styles), .NET 10 with plain Npgsql, Gin, NestJS, Laravel Octane, Hasura and PostGraphile.
  • Removed: NpgsqlRest 3.4.7.
  • Kinds of test: the three table tests.
  • Measurements: CPU of PostgreSQL and of the load generator, what limited each test, time in PostgreSQL per test, throughput after the ramp, startup time, idle memory and image size.

For NpgsqlRest, the comparison that matters is inside this round, where both versions ran on the same machine in the same hours: NpgsqlRest 4.1 against 3.21.

Everything that went wrong or is less than ideal ​

Three of these are open issues in the repository, where a pull request can fix them for the next round: JSON returned as a string, the Rust services and prepared statements, and the load generator as the limit.

PostgreSQL ran out of connection slots during the first run. max_connections was 2,000, the value of the previous round with 20 services. Most services keep a pool of up to 100 connections open once they have been under load, also while paused, and 31 services exceed 2,000 together. PostgreSQL refused 4.36 million connection attempts during 367 minutes of the 61 hours. 193 tests ran in those minutes; 56 of them had failed requests. All 193 were repeated on the same server with max_connections=5000, and the repeated results replace the originals everywhere in this series. The originals, and the count of refusals per minute from the PostgreSQL log, are in the dataset. The repeated tests ran with fewer idle connections open on PostgreSQL than the tests that were kept, which is a difference in conditions; current PostgreSQL versions handle idle connections cheaply.

The load generator was out of CPU in 380 of 1,364 tests. k6 parses every response as JSON to check it. For large responses that costs more than producing them. In those tests the fastest services are measured lower than they are. The next round should check large responses by size only (issue 11).

Eight services return jsonb as a string in the POST body and nested JSON kinds of test (Go, Gin, Django, FastAPI, Swoole and Laravel Octane in both; Bun and Deno in the first). The content checks of those kinds of test fail for them, as they did in July; nothing recorded that then. Requests do not fail and the numbers are measured correctly, but those services do less work there. It was left unchanged to stay comparable with July, and should be fixed for the next round (issue 9).

The Rust services do not use prepared statements. They format values into the SQL text, as they have since they were added. It costs them on the PostgreSQL side (issue 10).

Two services were corrected and run again ​

After the first run, two services turned out to have been held back by how they were set up in this benchmark. Both showed the same signs in the data: they were never out of CPU, and they held far fewer database connections than the others.

  • PostgREST had 10 database connections, not 100. Its configuration file asks for 100, but the container takes its settings from environment variables and never read that file, so it ran with its default of 10. It was the same in July 2026.
  • The Swoole service answered four requests at a time. Its database calls blocked the worker, so its 4 workers served one request each, with 4 connections (issue 12, fixed). It was the same in July, where nobody noticed: the database was the ceiling for every service then, and four workers were enough to reach it.

Both were fixed (the change), and all 88 of their tests were run again on a second server of the same type (Hetzner CCX63, the same CPU model, kernel and Docker version). To see whether the second machine gives the same numbers as the first, two services that had not changed ran with them: NpgsqlRest 3.21 (AOT, functions) in all 44 tests came out at 98.5% of its first results (median 99.7%; the single-user tests were about 10% lower, the others within 1%), and Go in 9 tests at 101.3%. On that evidence the corrected results were put into the round as they are, without adjustment. The original results of both services are in superseded/.

What the correction changed: on average over its 44 tests PostgREST answers 1.6 times as many requests as in the first run (up to 3.4 times in a single test), and the Swoole service 2.1 times as many (up to 7.5 times). The average is pulled down by the tests where nothing changed: those with a single user, and those where the load generator was the limit in both runs. PostgREST still does not use all its CPU in any test, now with 100 connections, so what limits it is inside PostgREST. The Swoole service is now out of CPU in most tests, like the other fast services.

Laravel Octane has 16 workers, each with one connection, where the other services have a pool of about 100. That is how Octane works: a worker handles one request at a time.

Hasura calls wrapper functions. It can expose a function only when it returns a set of a table it tracks, so for Hasura alone there are select * from functions around the benchmark functions. PostgreSQL inlines them.

The server's firewall was not applied during the first run. PostgreSQL and the service ports were reachable from the internet. The PostgreSQL log shows 115 failed logins from scanners, all with user names that do not exist in the database, and no sign of a successful one. Stray requests from scanners may have reached the services during tests; at thousands of requests per second from the load generator they cannot be seen in the results.

One run per test. There is no repetition and so no measure of noise. A difference of a few percent between two services is not a finding.

Closed-loop load. All latency numbers are from virtual users that wait for an answer before sending the next request.

Checked data only. The table tests use 54 MB of data that fits in memory. Reads never touch the disk.


Previous: ← Compare Any Two

Comments