Connection Pooling Beyond PgBouncer: A Custom Approach for Distributed PostgreSQL
summary
A custom connection pooler for Multigress implements the extended query protocol, per-user pools with a per-user fair pools max-min fairness allocator, and cross-gateway prepared statement consolidation that renames and deduplicates prepared plans across gateways to avoid backend blowup. Settings-based routing uses an LRU cache and eight stacks for fast pointer-equality checks, and a three-tier pool architecture (regular / reserved / admin) handles transactions, temp tables and suspended portals; demo shows PgBouncer errors while Multigress preserves temp-table correctness with modest extra hops and ~5–6% latency impact.
AI-written summary · about
