Skip to content

Commit 12b8602

Browse files
committed
fix: high-perf pooling doc
1 parent 5542a94 commit 12b8602

File tree

3 files changed

+63
-24
lines changed

3 files changed

+63
-24
lines changed

docs/self-hosted/deployment.md

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -70,30 +70,8 @@ DSN=postgres://user:password@host:123/database?sslmode=verify-full
7070

7171
##### High-performance pooling
7272

73-
:::note
74-
75-
High-performance pooling is supported in Ory Enterprise License (OEL) images.
76-
77-
:::
78-
79-
High-performance pooling is built using [pgxpool](https://pkg.go.dev/github.com/jackc/pgx/v5/pgxpool) and provides additional
80-
configuration options to the ones listed under "Standard pooling".
81-
82-
To activate high-performance pooling, you must set at least the `pool_min_conns` parameter; otherwise, high-performance pooling
83-
will not be enabled.
84-
85-
- `pool_min_conns` (number): The minimum number of total (in-use and idle) database connections to keep open at all times. After a
86-
connection closes, the pool may dip below `pool_min_conns` momentarily. Defaults to 0.
87-
- `pool_max_conns` (number): Sets the maximum number of open connections to the database. Overrides `max_conns`.
88-
- `pool_max_conn_idle_time` (duration: for example "500ms", "5s", "30m", "1h"): Database connections will be closed after idling
89-
for this duration. Overrides `max_conn_idle_time`.
90-
- `pool_max_conn_lifetime` (duration: for example "500ms", "5s", "30m", "1h"): Sets the time after which a connection will be
91-
closed, irrespective of how long it has been idle. Overrides `max_conn_lifetime`.
92-
- `pool_max_conn_lifetime_jitter` (duration: for example "500ms", "5s", "30m", "1h"): Jitter to add to the
93-
`pool_max_conn_lifetime` value. This is useful to avoid thundering herd problems when many connections are closed and re-opened
94-
at the same time.
95-
- `pool_health_check_period` (duration: for example "500ms", "5s", "30m", "1h"): Sets the period for health checks to potentially
96-
kill stale connections. Defaults to "1m".
73+
High-performance pooling is supported in Ory Enterprise License (OEL) images. Read more about it in the
74+
[high-performance pooling](./oel/high-performance-pooling) documentation.
9775

9876
### CockroachDB
9977

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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 only in the Ory Enterprise License (OEL). It uses
8+
[pgxpool](https://pkg.go.dev/github.com/jackc/pgx/v5/pgxpool) and provides additional configuration options for managing database
9+
connections under variable load.
10+
11+
To activate high-performance pooling, you must set the `pool_min_conns` parameter, otherwise high-performance pooling will not be
12+
enabled.
13+
14+
- `pool_min_conns` (number): The minimum number of total (in-use and idle) database connections to keep open at all times. After a
15+
connection closes, the pool may dip below `pool_min_conns` momentarily. Defaults to 0.
16+
- `pool_max_conns` (number): Sets the maximum number of open connections to the database. Overrides `max_conns`.
17+
- `pool_max_conn_idle_time` (duration: for example "500ms", "5s", "30m", "1h"): Database connections will be closed after idling
18+
for this duration. Overrides `max_conn_idle_time`.
19+
- `pool_max_conn_lifetime` (duration: for example "500ms", "5s", "30m", "1h"): Sets the time after which a connection will be
20+
closed, irrespective of how long it has been idle. Overrides `max_conn_lifetime`.
21+
- `pool_max_conn_lifetime_jitter` (duration: for example "500ms", "5s", "30m", "1h"): Jitter to add to the
22+
`pool_max_conn_lifetime` value. This is useful to avoid thundering herd problems when many connections are closed and re-opened
23+
at the same time.
24+
- `pool_health_check_period` (duration: for example "500ms", "5s", "30m", "1h"): Sets the period for health checks to potentially
25+
kill stale connections. Defaults to "1m".
26+
27+
## Key differences from standard pooling
28+
29+
### Standard pooling behavior
30+
31+
- Opens connections on demand
32+
- Closes idle connections after timeout
33+
- During traffic spikes, must initialize many new connections simultaneously
34+
- Can cause database overload, timeouts, or connection storms when traffic surges suddenly
35+
36+
### High-performance pooling behavior
37+
38+
- Maintains min_pool connections open at all times
39+
- Traffic spikes use pre-established connections
40+
- Avoids connection initialization overhead during demand peaks
41+
- Reduces risk of overwhelming the database during sudden load increases
42+
43+
### Connection refresh jitter
44+
45+
High-performance pooling includes randomized jitter when refreshing connections. This prevents synchronized connection resets that
46+
could cause momentary overload when all connections attempt to restart simultaneously.
47+
48+
## When to use high-performance pooling
49+
50+
Consider high-performance pooling when your workload exhibits:
51+
52+
- Large, unpredictable traffic spikes
53+
- Sudden transitions from low to high request volume
54+
- Time-sensitive operations where connection initialization latency is problematic
55+
56+
For steady-state traffic or gradual load changes, standard pooling may be enough.
57+
58+
High-performance pooling does not reload TLS certificates while the process is running. If database TLS certificates change, you
59+
must restart the Ory service to establish connections using the new certificates. Standard pooling supports hot reloading of TLS
60+
certificates because connections close after idle timeout and reconnect with refreshed credentials.

src/sidebar.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,6 +1211,7 @@ const oel: SidebarItemsConfig = [
12111211
items: ["self-hosted/oel/polis/changelog"],
12121212
},
12131213
"self-hosted/oel/monitoring/monitoring",
1214+
"self-hosted/oel/high-performance-pooling",
12141215
]
12151216

12161217
const security: SidebarItemsConfig = [

0 commit comments

Comments
 (0)