[RFE] Add support to multithread
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
pgbouncer charm |
New
|
Undecided
|
Unassigned |
Bug Description
As per pgbouncer documentation: "PgBouncer is single-threaded and uses one CPU core per instance." [0]
This feature has been added to pgbouncer 1.12, so we should limit it to Focal+.
The solution to set multithreaded pgbouncer is to deploy several processes of it, with slightly different configuration files.
In this, case, set them all with:
so_reuseport = 1 [0]
So these processes will share the same listener port and watch for requests there.
Each pgbouncer should get its own service file (in this case, pgbouncer@
1) PID file: pidfile = /var/run/
2) log file: logfile = /var/log/
3) socket: unix_socket_dir = /var/run/
We should also add a config option to define the number of worker processes:
config:
worker_processes:
type: int
default: 0
description: |
Set the number of concurrent pgbouncer processes running in the host.
If set to 0, pgbouncer count == # of cores.
If set to 1, one single pgbouncer will be set with "so_reuseport=0" option
If set to N>1, then N pgbouncers will be deployed