Skip to content

Commit 756746e

Browse files
vinckraeneasralnr
authored
fix: high-perf pooling doc (#2332)
* fix: high-perf pooling doc * chore: apply suggestion from code review Co-authored-by: hackerman <3372410+aeneasr@users.noreply.github.com> * chore: apply suggestion from code review Co-authored-by: hackerman <3372410+aeneasr@users.noreply.github.com> * chore: apply suggestions from code review Co-authored-by: Arne Luenser <arne.luenser@ory.sh> * chore: omit slop --------- Co-authored-by: hackerman <3372410+aeneasr@users.noreply.github.com> Co-authored-by: Arne Luenser <arne.luenser@ory.sh>
1 parent 90b4ac2 commit 756746e

File tree

3 files changed

+47
-24
lines changed

3 files changed

+47
-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: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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.

src/sidebar.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,6 +1213,7 @@ const oel: SidebarItemsConfig = [
12131213
items: ["self-hosted/oel/polis/changelog"],
12141214
},
12151215
"self-hosted/oel/monitoring/monitoring",
1216+
"self-hosted/oel/high-performance-pooling",
12161217
]
12171218

12181219
const security: SidebarItemsConfig = [

0 commit comments

Comments
 (0)