news.volyx.in

We scaled PgBouncer to 4x throughput (clickhouse.com)

153 points by saisrirampur · 7 hours ago · 24 comments on HN

Article summary

The article discusses how ClickHouse Managed Postgres scaled PgBouncer to 4x throughput by running a fleet of processes, utilizing multiple CPU cores, and implementing peering to enable query cancellation across processes. This approach allows the pooler to handle increased concurrency without becoming a bottleneck. The setup uses the so_reuseport feature to load-balance incoming connections across the processes. The result is a significant increase in throughput, with the fleet of processes handling 4x more transactions per second than a single process.

Main themes

  • PgBouncer scaling
  • Connection pooling
  • Concurrency handling
  • Postgres performance
  • Load balancing
  • so_reuseport feature

What commenters say

  • Using HAProxy with multiple PGBouncer instances may not be the most efficient approach due to the extra network hop.
  • The so_reuseport feature is a more efficient solution than using an extra userspace hop.
  • Other scalable PgBouncer alternatives, such as Odyssey, are available and worth considering.
  • PgBouncer's peering feature is a built-in and simple solution for enabling query cancellation across processes.
  • Some users have successfully used other connection pooling tools, such as pgdog, to scale their Postgres instances.
  • The choice of connection pooling tool depends on specific use cases and requirements.
  • Having too many connections to Postgres can be inefficient, and a smaller number of connections can be sufficient for scaling.
  • The use of so_reuseport and peering can be applied to other scenarios beyond PgBouncer, such as torrent clients.