You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pgcat unsupported web servers are bottlenecked by the number of database connections
driver pool implementations do not release connections well enough to significantly impact active_connections / max_connections ratio; hence pgcat or pgbouncer or similar is much needed at scale
overall results were expected
Go jackc/pgx dropped 7% in RPS between 150 and 9600 VUs (i.e., concurrent request rate)
Go lib/pq dropped 10% in RPS between 150 and 9600 VUs
Rust Actix-web + Sqlx dropped 19% in RPS between 150 and 9600 VUs
Spring Boot Webflux + R2DBC dropped 8.5% in RPS between 150 and 9600 VUs
All four average response time is 1.5s when using 9600 VUs
express.js with node-postgres performance is on par with system languages at low concurrent request rate
Setup
Testing
run docker compose build to build all services (you may need to adjust Docker and Postgres resources for your hardware)
run docker compose up -d postgres to start database
run docker compose up service_name (check compose.yml for list of services)
configure benchmark.js options (vux, duration, or stages)
run k6 run benchmark.js --env URL=http://localhost:8080 (for next.js, use http://localhost:8080/api/tx)
Workload
The workload is for the web server to call the following SQL prepared statement with RNG values.
CREATE OR REPLACEFUNCTIONpublic.pgbench_tx(
p_aid bigint,
p_tid bigint,
p_bid bigint,
p_delta int
)
RETURNS void
LANGUAGE plpgsql
AS $$
BEGINUPDATE pgbench_accounts
SET abalance = abalance + p_delta
WHERE aid = p_aid;
UPDATE pgbench_tellers
SET tbalance = tbalance + p_delta
WHERE tid = p_tid;
UPDATE pgbench_branches
SET bbalance = bbalance + p_delta
WHERE bid = p_bid;
INSERT INTO pgbench_history (tid, bid, aid, delta, mtime, filler)
VALUES (p_tid, p_bid, p_aid, p_delta, now(), repeat('x', 22));
END;
$$;
SQL Schema
pgbench_accounts
aid
integer
bid
integer
abalance
integer
filler
character(84)
pgbench_branches
bid
integer
bbalance
integer
filler
character(88)
pgbench_history
tid
integer
bid
integer
aid
integer
delta
integer
mtime
timestamp without time zone
filler
character(22)
pgbench_tellers
tid
integer
bid
integer
tbalance
integer
filler
character(84)
About
Benchmarks for various web servers and SQL drivers