Benchmarking PostgreSQL Connection Pooling with PgBouncer (7518)
V
VOTION CORE CONTRIBUTOR
SYSTEM WRITER•
12 min read
Introduction
Connection pooling is a critical layer for scaling PostgreSQL workloads. This article presents a rigorous benchmark of PgBouncer 1.21 (build 7518) under varying concurrency profiles, isolating kernel‑level network parameters, pool modes, and transaction‑vs‑statement pooling trade‑offs.
Architecture Overview
The test harness consists of three bare‑metal nodes: a client generator (pgbench), a PgBouncer instance, and a PostgreSQL 16 primary. All nodes run Ubuntu 22.04 with tuned sysctl settings (net.core.somaxconn=65535, net.ipv4.tcp_tw_reuse=1). The diagram below illustrates the traffic flow and where latency is measured.
eBPF/XDP kernel filter evaluates TCP/UDP frames directly on server NIC.
Benchmark Methodology
We executed pgbench with a custom script simulating a mixed OLTP workload (70% SELECT, 20% UPDATE, 10% INSERT). Each run lasted 10 minutes with a 2‑minute warm‑up. Metrics captured: transactions per second (TPS), 99th‑percentile latency, CPU utilization on PgBouncer, and socket queue depth. Tests were repeated across pool modes: session, transaction, and statement.
CODE_COMPILER // BASELINE PGBOUNCER CONFIG
V8_SANDBOX_LIVE
// Input Javascript:JS (ES6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Press Ctrl + Enter to run
// EXECUTION_LOGS:
[ Ready for execution context... ]
CODE_COMPILER // PGBENCH MIXED OLTP SCRIPT
V8_SANDBOX_LIVE
// Input Javascript:JS (ES6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Press Ctrl + Enter to run
// EXECUTION_LOGS:
[ Ready for execution context... ]
Hardware Performance Benchmark Telemetry
4.9x HIGHER THROUGHPUT
Votion Edge Bare-Metal Cluster420
Standard Virtual Hypervisor (AWS / GCP)85
METRIC: Random Disk IOPS (k)TELEMETRY: REAL-TIME HARDWARE HARDENING AUDIT
Results Analysis
Transaction pooling delivered the highest throughput (≈ 42k TPS) with 99th‑percentile latency under 4 ms at 500 concurrent clients. Session pooling saturated at 300 clients due to PostgreSQL backend connection limits, while statement pooling showed 15% higher CPU on PgBouncer due to frequent query parsing. The chart above visualizes TPS vs. client count for each pool mode.
Hardware Performance Benchmark Telemetry
4.9x HIGHER THROUGHPUT
Votion Edge Bare-Metal Cluster420
Standard Virtual Hypervisor (AWS / GCP)85
METRIC: Random Disk IOPS (k)TELEMETRY: REAL-TIME HARDWARE HARDENING AUDIT
Tuning Parameters
Key knobs that moved the needle: increasing default_pool_size to 200 reduced queue wait by 40%; enabling tcp_defer_accept on the kernel cut SYN‑ACK latency; setting application_name_add_host = 1 improved observability. The following snippet shows the tuned configuration used for the final run.
PgBouncer 7518 proves to be a robust, low‑overhead connection pooler for high‑concurrency PostgreSQL workloads. Transaction pooling with a properly sized pool and kernel‑level TCP tuning yields near‑linear scaling up to the database’s max_connections. For workloads requiring session‑level features (prepared statements, SET commands), session pooling remains viable but requires careful capacity planning. The provided configurations and benchmark scripts serve as a reproducible baseline for your own infrastructure validation.
Essential tokens required for DDoS mitigation, load balancing, and maintaining secure session states across the Votion Cloud network. Cannot be disabled.
Telemetry Data
Anonymous usage statistics that help us optimize routing paths, reduce global latency, and improve the dashboard interface.
Targeting Protocols
Allows third-party integration for tailored cloud hosting offers and advanced enterprise outreach.
Telemetry & Session Data Protocols
We utilize localized encryption tokens and telemetry data to maintain node stability, mitigate DDoS vectors, and deliver an ultra-low latency experience.Do you authorize the secure handshake?
SYS_KVM_02 AISECURE
PING: 0.12ms•MODEL: LLAMA_4_SCOUT•SHIELD: ACTIVE
CORE_AI_WARP_SYSTEM INITIALIZED • VERSION 3.8.4
votion@ai:~$
System operational. I am Votion Cloud's automated terminal core. Ready to diagnose cloud architectures, routing parameters, or server specifications. Type your command.