forked from canonical/pgbouncer-k8s-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.yaml
61 lines (50 loc) · 2.19 KB
/
config.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.
options:
listen_port:
default: 6432
description: |
The port on which pgbouncer listens for traffic. Corresponds to
listen_port in pgbouncer config.
type: int
pool_mode:
default: session
description: |
Specifies when a server connection can be reused by other clients. Can
be one of the following values:
session
Server is released back to pool after client disconnects. Default.
transaction
Server is released back to pool after transaction finishes.
statement
Server is released back to pool after query finishes. Transactions
spanning multiple statements are disallowed in this mode.
type: string
max_db_connections:
default: 100
description: |
Do not allow more than this many server connections per database
(regardless of user). This considers the PgBouncer database that the
client has connected to, not the PostgreSQL database of the outgoing
connection.
Note that when you hit the limit, closing a client connection to one pool
will not immediately allow a server connection to be established for
another pool, because the server connection for the first pool is still
open. Once the server connection closes (due to idle timeout), a new
server connection will immediately be opened for the waiting pool.
This is used to calculate the following pgbouncer.ini config options,
which are documented in the pgbouncer config docs here:
https://www.pgbouncer.org/config.html.
- Firstly, the number of pgbouncer instances is calculated based on the
number of CPU cores in the current deployment.
- effective DB connections = max_db_connections / pgbouncer instances
- default_pool_size = effective connections / 2
- min_pool_size = effective connections / 4
- reserve_pool_size = effective connections / 4
If max_db_connections is set to 0, the derivatives are set thusly, based
on pgbouncer defaults:
- default_pool_size = 20
- min_pool_size = 10
- reserve_pool_size = 10
0 = unlimited.
type: int