vitabaks / postgresql_cluster

PostgreSQL High-Availability Cluster (based on Patroni). Automating with Ansible.
https://postgresql-cluster.org
MIT License
1.69k stars 410 forks source link

PgBouncer: Connect via Unix socket instead of TCP/IP #498

Closed vitabaks closed 11 months ago

vitabaks commented 11 months ago

This PR introduces an improvement to the PgBouncer configuration by switching the connection method to PostgreSQL from TCP/IP to Unix socket directory. \ This change can improve performance by reducing latency, this is important for databases with a large number of high-frequency calls with a low latency requirement.

Example:

127.0.0.1 Unix socket Difference %
latency 3.585 ms 2.007 ms -44.02%
TPS 27474 47640 +73.40%

Details here and here