The HTTP/1.1 keep-alive load comparison used for the changelog numbers since 4.0.0 (the BenchmarkDotNet
--endpoints benchmarks are JIT only and measure single requests; this measures the published npgsqlrest
builds under load, JIT and native AOT).
Files:
setup.sql: the database: a text value, a PL/pgSQL function with five queries, a POST with four parameters, 100 rows, one 170 KB json value, and a text value and 100 rows withuser_context.LoadGen.cs.txt,loadgen.csproj.txt: the load generator. They are kept as.txtso the solution does not build them; copy them to a directory asProgram.csandloadgen.csprojanddotnet build -c Release -o out. Per endpoint it warms up, then measures the response time on 1 connection, requests per second on 32, and CPU per request on 8 (the server's fromps, PostgreSQL's from the container's cgroup).run.sh <rounds> <seconds>: expectsbuilds/<variant>/directories next to it (jit…started withdotnet NpgsqlRestClient.dll,aot…with./NpgsqlRestClient), the load generator inloadgen/out/, and the PostgreSQL containernpgsqlrest-benchmark-pgon port 55432. Variants rotate by one position every round. Rows go toresults.tsv: label, endpoint, response bytes, response time in µs, requests per second, server CPU in µs per request, PostgreSQL CPU in µs per request.
Before running: publish both versions the same way (the previous release from a git worktree of its tag), and
delete any appsettings.Development.json from the publish directories, or the builds run with different settings.
Read Baselines/ for earlier results and the cautions that apply (order effects, connection reset settings).