Introduction
Odoo applications often face performance issues when many users access the system at the same time. One common reason is too many database connections to PostgreSQL. Install PgBouncer for Odoo Performance to use this lightweight connection pooler that helps Odoo reuse database connections instead of opening new ones every time. This significantly improves performance and stability.
Why PgBouncer for Odoo?
- PostgreSQL has a limited number of connections
- Each Odoo worker uses one database connection
- High traffic can quickly exhaust the limit
- PgBouncer reduces connection overhead by reusing a small set of connections
Step 1: Install PgBouncer
On Ubuntu server, install PgBouncer using:
sudo apt update
sudo apt install pgbouncer
Step 2: Configure PgBouncer
Edit the PgBouncer configuration file:
sudo nano /etc/pgbouncer/pgbouncer.ini
Basic Configuration
[databases]
odoo_db = host=127.0.0.1 port=5432 dbname=odoo_db
[pgbouncer]
listen_addr = *
listen_port = 6432
auth_type = md5
auth_file = /etc/pgbouncer/userlist.txt
pool_mode = transaction
max_client_conn = 500
default_pool_size = 20
Save the file.
Step 3: Configure Odoo to Use PgBouncer
Edit odoo.conf and update the database port:
db_host = 127.0.0.1
db_port = 6432
db_user = odoo
db_password = your_password
Restart Odoo after making changes.
Step 4: Restart PgBouncer
sudo systemctl restart pgbouncer
sudo systemctl enable pgbouncer
Step 5: Verify PgBouncer Is Working
Connect to PgBouncer admin database:
psql -p 6432 -U postgres pgbouncer
Run:
SHOW POOLS;
If PgBouncer is working, you will see active and idle connections.
Conclusion
PgBouncer is an easy and effective way to improve Odoo performance by reducing database connection overhead. With minimal configuration, you can make your Odoo system more stable and scalable.
If you need expert help with How to Install PgBouncer to Improve Odoo Performance, Skynats is here to support you. Our experienced engineers provide reliable DevOps Support Services and Server Management Services to optimize Odoo, fine-tune PostgreSQL, and ensure peak application performance. Contact Skynats today for scalable, secure, and hassle-free Odoo optimization.