Pgbouncer Odoo

Why will pgbouncer save you?

Because out of the box, Odoo is using standard postGreSQL which is unable to kill ids idle connections.

For that reason, whoever is going to production with multi-user configuration needs pgbouncer to be setup and running. Why? Because PostreSQL keeps opening new connections for Odoo but never closes them. They are kept idle and saturate memory until either the maximum number of allowed connections OR the memory runs out.

The more users you have …. and the more workers and threads you get…. and the faster the problem occurs.

As a typical example, for a server being used by 50 users, the number of open connections can reach up to almost 1000 open connections in one day of work: It will be only a few days before the server crashes.

The “dirty” way would consist in restarting the PostgreSQL service every 24 hours and therefore never letting the idle connections eat up resources….. But for production servers under heavy load…. it would not be enough since some resuests can eat up a lot of resource and open a lot of simulaneous connections.

From my point of view, installing Pg-bouncer will bring many advantages:

  • Stabilize the server and make sure it handles and closes its un-used connections
  • Increase the PostgreSQL performance and therefore make the Odoo system work faster