|
| 1 | +--- |
| 2 | +id: high-performance-pooling |
| 3 | +title: High-performance database connection pooling |
| 4 | +sidebar_label: High-performance pooling |
| 5 | +--- |
| 6 | + |
| 7 | +High-performance pooling is available for CockroachDB and PostgreSQL with an Ory Enterprise License (OEL). It provides additional |
| 8 | +configuration options for managing database connections under variable load. |
| 9 | + |
| 10 | +To activate high-performance pooling, you must set the `pool_min_conns` parameter, otherwise high-performance pooling will not be |
| 11 | +enabled. |
| 12 | + |
| 13 | +- `pool_min_conns` (number): The minimum number of total (in-use and idle) database connections to keep open at all times. After a |
| 14 | + connection closes, the pool may dip below `pool_min_conns` momentarily. Defaults to 0. |
| 15 | +- `pool_max_conns` (number): Sets the maximum number of open connections to the database. Overrides `max_conns`. |
| 16 | +- `pool_max_conn_idle_time` (duration: for example "500ms", "5s", "30m", "1h"): Database connections will be closed after idling |
| 17 | + for this duration. Overrides `max_conn_idle_time`. |
| 18 | +- `pool_max_conn_lifetime` (duration: for example "500ms", "5s", "30m", "1h"): Sets the time after which a connection will be |
| 19 | + closed, irrespective of how long it has been idle. Overrides `max_conn_lifetime`. |
| 20 | +- `pool_max_conn_lifetime_jitter` (duration: for example "500ms", "5s", "30m", "1h"): Jitter to add to the |
| 21 | + `pool_max_conn_lifetime` value. This is useful to avoid thundering herd problems when many connections are closed and re-opened |
| 22 | + at the same time. |
| 23 | +- `pool_health_check_period` (duration: for example "500ms", "5s", "30m", "1h"): Sets the period for health checks to potentially |
| 24 | + kill stale connections. Defaults to "1m". |
| 25 | + |
| 26 | +## When to use high-performance pooling |
| 27 | + |
| 28 | +Standard pooling opens connections on demand and closes them after idle timeout, which can cause connection storms during sudden |
| 29 | +traffic spikes. High-performance pooling maintains `min_pool` persistent connections and includes refresh jitter to prevent |
| 30 | +synchronized resets, without initialization overhead and reducing the risk of database overload during demand surges. |
| 31 | + |
| 32 | +Consider high-performance pooling when your workload exhibits: |
| 33 | + |
| 34 | +- Large, unpredictable traffic spikes |
| 35 | +- Sudden transitions from low to high request volume |
| 36 | +- Time-sensitive operations where connection initialization latency is problematic |
| 37 | + |
| 38 | +For steady-state traffic or gradual load changes, standard pooling may be enough. |
| 39 | + |
| 40 | +## When not to use high-performance pooling |
| 41 | + |
| 42 | +High-performance pooling does not reload TLS certificates while the process is running. If database TLS certificates change, you |
| 43 | +must restart the Ory service to establish connections using the new certificates. Standard pooling supports hot reloading of TLS |
| 44 | +certificates because connections close after idle timeout and reconnect with refreshed credentials. |
0 commit comments