@bastani/atomic 0.10.14-alpha.1 → 0.10.15-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/dist/_shared/dist-KOELCESV.js +2 -2
- package/dist/_shared/fork-row-index-UAUAQRD5.js +2 -2
- package/dist/_shared/lib-4PES5P4V.js +2 -2
- package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js +3 -3
- package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +3 -3
- package/dist/_shared/mode-shared-2QJSCUM6.js +3 -3
- package/dist/_shared/p1a-prewarm-XIU57JHF.js +3 -3
- package/dist/_shared/runtime-O4KCSG4C.js +2 -2
- package/dist/_shared/{sdk-B5LEWGGI.js → sdk-OHKMDJ74.js} +27 -5
- package/dist/_shared/{sdk-B5LEWGGI.js.map → sdk-OHKMDJ74.js.map} +1 -1
- package/dist/_shared/session-data-AHTU7IS6.js +2 -2
- package/dist/_shared/startup-0-0-Q3MWKUK4.js +2 -2
- package/dist/_shared/startup-0-1-M6OWAYHH.js +2 -2
- package/dist/_shared/{startup-0-2-5QHPCEON.js → startup-0-2-2HUMCPKX.js} +14 -16
- package/dist/_shared/startup-0-2-2HUMCPKX.js.map +1 -0
- package/dist/_shared/startup-0-3-4ZYBYQNM.js +3 -3
- package/dist/_shared/startup-0-4-ZMJV547D.js +3 -3
- package/dist/_shared/startup-0-5-YDW47QX6.js +3 -3
- package/dist/_shared/startup-10-0-TDQNBDDL.js +3 -3
- package/dist/_shared/startup-14-0-MLX36RBG.js +1 -1
- package/dist/_shared/startup-15-0-YUKGAC63.js +1 -1
- package/dist/_shared/startup-15-1-4S7FLMNG.js +6 -30
- package/dist/_shared/startup-15-1-4S7FLMNG.js.map +1 -1
- package/dist/_shared/startup-8-0-34CBHPZH.js +3 -3
- package/dist/_shared/startup-8-1-LZFXSD3Z.js +3 -3
- package/dist/_shared/storage-command-7MGXLJGZ.js +2 -2
- package/dist/_shared/storage-status-K7PX2RXA.js +3 -3
- package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +2 -2
- package/dist/_shared/tree-outline-MUEPK5B7.js +2 -2
- package/dist/builtin/intercom/index.bundle.mjs +1 -1
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/index.bundle.mjs +1 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +1 -1
- package/dist/builtin/web-access/index.bundle.mjs +1 -1
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/cli/auth-cli.code.js +1 -1
- package/dist/cli/auth-cli.impl.js +3 -3
- package/dist/cli/auth-cli.js +3 -3
- package/dist/cli/blueprint-command.impl.js +3 -3
- package/dist/cli/blueprint-command.js +3 -3
- package/dist/cli/intercom-command.code.js +3 -3
- package/dist/cli/intercom-command.impl.js +3 -3
- package/dist/cli/intercom-command.js +3 -3
- package/dist/cli/list-models.impl.js +3 -3
- package/dist/cli/list-models.js +3 -3
- package/dist/cli/session-picker.code.js +1 -1
- package/dist/cli/session-picker.impl.js +3 -3
- package/dist/cli/session-picker.js +3 -3
- package/dist/cli/startup-ui.code.js +1 -1
- package/dist/cli/startup-ui.impl.js +3 -3
- package/dist/cli/startup-ui.js +3 -3
- package/dist/cli/storage-command.impl.js +3 -3
- package/dist/cli/storage-command.js +3 -3
- package/dist/cli/storage-search-session.code.js +1 -1
- package/dist/cli/storage-search-session.impl.js +3 -3
- package/dist/cli/storage-search-session.js +3 -3
- package/dist/cli/team-command.code.js +1 -1
- package/dist/cli/team-command.impl.js +3 -3
- package/dist/cli/team-command.js +3 -3
- package/dist/cli.js +2 -2
- package/dist/core/compaction/compactor.d.ts +0 -8
- package/dist/core/debug.impl.js +3 -3
- package/dist/core/debug.js +3 -3
- package/dist/core/export-html/card-projection.impl.js +3 -3
- package/dist/core/export-html/card-projection.js +3 -3
- package/dist/core/export-html/index.code.js +2 -2
- package/dist/core/export-html/index.impl.js +3 -3
- package/dist/core/export-html/index.js +3 -3
- package/dist/core/export-html/json-spans.impl.js +3 -3
- package/dist/core/export-html/json-spans.js +3 -3
- package/dist/core/export-html/oversized-render-inputs.impl.js +3 -3
- package/dist/core/export-html/oversized-render-inputs.js +3 -3
- package/dist/core/export-html/tool-renderer.impl.js +3 -3
- package/dist/core/export-html/tool-renderer.js +3 -3
- package/dist/core/extensions/jiti-loader.impl.js +3 -3
- package/dist/core/extensions/jiti-loader.js +3 -3
- package/dist/core/extensions/jiti-static-loader.impl.js +3 -3
- package/dist/core/extensions/jiti-static-loader.js +3 -3
- package/dist/core/extensions/loader-host-modules.impl.js +3 -3
- package/dist/core/extensions/loader-host-modules.js +3 -3
- package/dist/core/intercom-broker-control-host.code.js +1 -1
- package/dist/core/intercom-broker-control-host.impl.js +3 -3
- package/dist/core/intercom-broker-control-host.js +3 -3
- package/dist/core/intercom-broker-control.code.js +2 -2
- package/dist/core/intercom-broker-control.impl.js +3 -3
- package/dist/core/intercom-broker-control.js +3 -3
- package/dist/core/package-manager-storage-adapters.impl.js +3 -3
- package/dist/core/package-manager-storage-adapters.js +3 -3
- package/dist/core/sdk.code.js +1 -1
- package/dist/core/sdk.impl.js +3 -3
- package/dist/core/sdk.js +3 -3
- package/dist/core/session-manager-core.js +3 -3
- package/dist/core/session-manager-list.impl.js +3 -3
- package/dist/core/session-manager-list.js +3 -3
- package/dist/core/session-manager.impl.js +3 -3
- package/dist/core/session-manager.js +3 -3
- package/dist/core/session-storage.impl.js +3 -3
- package/dist/core/session-storage.js +3 -3
- package/dist/core/storage/index.js +2 -2
- package/dist/core/storage/node-sqlite-thread.js +2 -2
- package/dist/core/storage/node-sqlite.js +2 -2
- package/dist/core/storage/offline-snapshot-file.impl.js +3 -3
- package/dist/core/storage/offline-snapshot-file.js +3 -3
- package/dist/core/storage/provider.js +2 -2
- package/dist/core/storage/selection.js +2 -2
- package/dist/core/storage/session/branch-fork-source.code.js +2 -2
- package/dist/core/storage/session/branch-fork-source.impl.js +3 -3
- package/dist/core/storage/session/branch-fork-source.js +3 -3
- package/dist/core/storage/session/card-view.impl.js +3 -3
- package/dist/core/storage/session/card-view.js +3 -3
- package/dist/core/storage/session/child-reader.code.js +2 -2
- package/dist/core/storage/session/child-reader.impl.js +3 -3
- package/dist/core/storage/session/child-reader.js +3 -3
- package/dist/core/storage/session/chunked-resume-projection.impl.js +3 -3
- package/dist/core/storage/session/chunked-resume-projection.js +3 -3
- package/dist/core/storage/session/expanded-child-details.code.js +2 -2
- package/dist/core/storage/session/expanded-child-details.impl.js +3 -3
- package/dist/core/storage/session/expanded-child-details.js +3 -3
- package/dist/core/storage/session/fork-row-bytes.impl.js +3 -3
- package/dist/core/storage/session/fork-row-bytes.js +3 -3
- package/dist/core/storage/session/fork-row-index.impl.js +3 -3
- package/dist/core/storage/session/fork-row-index.js +3 -3
- package/dist/core/storage/session/fork-staging.code.js +1 -1
- package/dist/core/storage/session/fork-staging.impl.js +3 -3
- package/dist/core/storage/session/fork-staging.js +3 -3
- package/dist/core/storage/session/fork-window.code.js +2 -2
- package/dist/core/storage/session/fork-window.impl.js +3 -3
- package/dist/core/storage/session/fork-window.js +3 -3
- package/dist/core/storage/session/history-pages.impl.js +3 -3
- package/dist/core/storage/session/history-pages.js +3 -3
- package/dist/core/storage/session/jsonl-entry-projection.impl.js +3 -3
- package/dist/core/storage/session/jsonl-entry-projection.js +3 -3
- package/dist/core/storage/session/jsonl-session-store.impl.js +3 -3
- package/dist/core/storage/session/jsonl-session-store.js +3 -3
- package/dist/core/storage/session/memory-session-store.impl.js +3 -3
- package/dist/core/storage/session/memory-session-store.js +3 -3
- package/dist/core/storage/session/pinned-branch-resume.code.js +2 -2
- package/dist/core/storage/session/pinned-branch-resume.impl.js +3 -3
- package/dist/core/storage/session/pinned-branch-resume.js +3 -3
- package/dist/core/storage/session/released-history-files.code.js +1 -1
- package/dist/core/storage/session/released-history-files.impl.js +3 -3
- package/dist/core/storage/session/released-history-files.js +3 -3
- package/dist/core/storage/session/resident-fork-rows.impl.js +3 -3
- package/dist/core/storage/session/resident-fork-rows.js +3 -3
- package/dist/core/storage/session/session-resume.impl.js +3 -3
- package/dist/core/storage/session/session-resume.js +3 -3
- package/dist/core/storage/session/snapshot-cut.impl.js +3 -3
- package/dist/core/storage/session/snapshot-cut.js +3 -3
- package/dist/core/storage/session/snapshot-history.code.js +2 -2
- package/dist/core/storage/session/snapshot-history.impl.js +3 -3
- package/dist/core/storage/session/snapshot-history.js +3 -3
- package/dist/core/storage/session/sql-session-store.code.js +1 -1
- package/dist/core/storage/session/sql-session-store.impl.js +3 -3
- package/dist/core/storage/session/sql-session-store.js +3 -3
- package/dist/core/storage/session/tree-outline.impl.js +3 -3
- package/dist/core/storage/session/tree-outline.js +3 -3
- package/dist/core/storage/session/tree-presentation.impl.js +3 -3
- package/dist/core/storage/session/tree-presentation.js +3 -3
- package/dist/core/storage/storage-status.impl.js +3 -3
- package/dist/core/storage/storage-status.js +3 -3
- package/dist/core/storage/team.impl.js +3 -3
- package/dist/core/storage/team.js +3 -3
- package/dist/core/structured-output/index.code.js +1 -1
- package/dist/core/structured-output/index.impl.js +3 -3
- package/dist/core/structured-output/index.js +3 -3
- package/dist/core/tasks/task-completion-entry.impl.js +3 -3
- package/dist/core/tasks/task-completion-entry.js +3 -3
- package/dist/core/tasks/task-file-history.code.js +2 -2
- package/dist/core/tasks/task-file-history.impl.js +3 -3
- package/dist/core/tasks/task-file-history.js +3 -3
- package/dist/core/tasks/task-reference-archive.code.js +2 -2
- package/dist/core/tasks/task-reference-archive.js +3 -3
- package/dist/core/tasks/task-reference-identity.js +3 -3
- package/dist/core/tasks/task-reference-stream.impl.js +3 -3
- package/dist/core/tasks/task-reference-stream.js +3 -3
- package/dist/core/tasks/task-unsaved-answer.impl.js +3 -3
- package/dist/core/tasks/task-unsaved-answer.js +3 -3
- package/dist/core/tasks/task-view-source.impl.js +3 -3
- package/dist/core/tasks/task-view-source.js +3 -3
- package/dist/core/tools/read-url.impl.js +3 -3
- package/dist/core/tools/read-url.js +3 -3
- package/dist/core/worktree-snapshot/blob-store.js +2 -2
- package/dist/core/worktree-snapshot/errors.code.js +1 -1
- package/dist/core/worktree-snapshot/errors.impl.js +3 -3
- package/dist/core/worktree-snapshot/errors.js +3 -3
- package/dist/core/worktree-snapshot/session-index-reset.impl.js +3 -3
- package/dist/core/worktree-snapshot/session-index-reset.js +3 -3
- package/dist/extensions/codemode/execute.impl.js +3 -3
- package/dist/extensions/codemode/execute.js +3 -3
- package/dist/extensions/codemode/renderer.impl.js +3 -3
- package/dist/extensions/codemode/renderer.js +3 -3
- package/dist/extensions/mcp/cli.code.js +1 -1
- package/dist/extensions/mcp/cli.impl.js +3 -3
- package/dist/extensions/mcp/cli.js +3 -3
- package/dist/extensions/mcp/cli.lazy.code.js +2 -2
- package/dist/extensions/mcp/cli.lazy.impl.js +3 -3
- package/dist/extensions/mcp/cli.lazy.js +3 -3
- package/dist/extensions/mcp/runtime.code.js +1 -1
- package/dist/extensions/mcp/runtime.impl.js +3 -3
- package/dist/extensions/mcp/runtime.js +3 -3
- package/dist/index.d.ts +21 -1
- package/dist/index.js +2 -2
- package/dist/main-first-time-setup.code.js +1 -1
- package/dist/main-first-time-setup.impl.js +3 -3
- package/dist/main-first-time-setup.js +3 -3
- package/dist/modes/interactive/components/stored-tree-view.code.js +2 -2
- package/dist/modes/interactive/components/stored-tree-view.impl.js +3 -3
- package/dist/modes/interactive/components/stored-tree-view.js +3 -3
- package/dist/modes/interactive/components/user-message-selector-archive.impl.js +3 -3
- package/dist/modes/interactive/components/user-message-selector-archive.js +3 -3
- package/dist/modes/print-mode.js +1 -1
- package/dist/package-manager-cli.code.js +2 -2
- package/dist/package-manager-cli.impl.js +3 -3
- package/dist/package-manager-cli.js +3 -3
- package/dist/startup-files.json +1 -1
- package/dist/startup-stages/6.js +1 -1
- package/dist/utils/startup-database-spare.code.js +1 -1
- package/dist/utils/startup-database-spare.impl.js +3 -3
- package/dist/utils/startup-database-spare.js +3 -3
- package/dist/utils/tools-manager.impl.js +3 -3
- package/dist/utils/tools-manager.js +3 -3
- package/docs/background-tasks/reference.md +182 -0
- package/docs/background-tasks.md +98 -405
- package/docs/build.md +67 -27
- package/docs/changelog.mdx +9 -0
- package/docs/codemode.md +108 -39
- package/docs/compaction/branch-summaries.md +54 -0
- package/docs/compaction/custom-compactors.md +161 -0
- package/docs/compaction/memory-compaction.md +77 -0
- package/docs/compaction/reference.md +86 -38
- package/docs/compaction.md +51 -252
- package/docs/computer-use.md +169 -321
- package/docs/containerization.md +71 -57
- package/docs/custom-provider/api-reference.md +119 -25
- package/docs/custom-provider/oauth.md +114 -132
- package/docs/custom-provider/override.md +37 -27
- package/docs/custom-provider/registration.md +107 -83
- package/docs/custom-provider/streaming.md +85 -71
- package/docs/custom-provider.md +85 -52
- package/docs/development.md +39 -29
- package/docs/docs.json +76 -63
- package/docs/environment-variables.md +94 -44
- package/docs/extensions/api-reference.md +86 -43
- package/docs/extensions/authoring.md +162 -154
- package/docs/extensions/events.md +80 -25
- package/docs/extensions/examples.md +90 -85
- package/docs/extensions/ui.md +206 -82
- package/docs/extensions.md +79 -108
- package/docs/getting-started/authentication.md +67 -36
- package/docs/getting-started/first-session.md +53 -43
- package/docs/getting-started/installation.md +116 -89
- package/docs/getting-started/project-instructions.md +48 -34
- package/docs/guides/configuration.md +82 -20
- package/docs/guides/non-interactive.md +66 -24
- package/docs/guides/resume-on-any-machine.md +135 -82
- package/docs/guides/team-setup.md +114 -105
- package/docs/guides.md +76 -32
- package/docs/herdr.md +15 -16
- package/docs/how-atomic-works.md +140 -0
- package/docs/index.md +58 -44
- package/docs/intercom/operations.md +141 -151
- package/docs/intercom/reference.md +85 -108
- package/docs/intercom.md +84 -145
- package/docs/json.md +120 -67
- package/docs/keybindings.md +85 -49
- package/docs/libraries/agent-core.md +137 -275
- package/docs/libraries/ai.md +100 -84
- package/docs/libraries/codemode.md +210 -300
- package/docs/libraries/schema.md +59 -53
- package/docs/libraries/storage-postgres.md +49 -35
- package/docs/libraries/telemetry.md +153 -354
- package/docs/libraries/tui.md +265 -393
- package/docs/libraries.md +42 -26
- package/docs/llama-cpp.md +171 -161
- package/docs/mcp-servers.md +90 -51
- package/docs/models/choose-a-model.md +188 -0
- package/docs/models/reference.md +74 -30
- package/docs/models.md +153 -88
- package/docs/orchestration/migrating-workflows.md +23 -16
- package/docs/orchestration/patterns.md +39 -44
- package/docs/orchestration.md +65 -26
- package/docs/packages/authoring.md +51 -29
- package/docs/packages/reference.md +42 -21
- package/docs/packages.md +69 -58
- package/docs/programmatic.md +118 -24
- package/docs/prompt-templates.md +84 -83
- package/docs/providers/reference.md +43 -48
- package/docs/providers.md +219 -451
- package/docs/quickstart.md +140 -120
- package/docs/reference/cli.md +135 -97
- package/docs/reference.md +20 -18
- package/docs/rpc/examples.md +76 -20
- package/docs/rpc/extension-ui.md +64 -38
- package/docs/rpc/protocol.md +361 -110
- package/docs/rpc.md +57 -17
- package/docs/sdk/reference.md +409 -534
- package/docs/sdk/storage.md +53 -13
- package/docs/sdk/structured-decisions.md +82 -56
- package/docs/sdk/web-server.md +57 -43
- package/docs/sdk.md +106 -84
- package/docs/security.md +42 -64
- package/docs/session-format.md +62 -38
- package/docs/sessions.md +99 -214
- package/docs/settings.md +165 -195
- package/docs/shell-aliases.md +9 -6
- package/docs/skills/authoring.md +69 -48
- package/docs/skills/reference.md +51 -20
- package/docs/skills.md +99 -148
- package/docs/slash-commands.md +129 -0
- package/docs/storage/custom-adapters.md +160 -85
- package/docs/storage/jsonl.md +81 -66
- package/docs/storage/postgres/pgbouncer.md +120 -126
- package/docs/storage/postgres/tuning.md +120 -143
- package/docs/storage/postgres.md +314 -330
- package/docs/storage/sqlite.md +71 -42
- package/docs/storage.md +298 -302
- package/docs/subagents/authoring.md +55 -38
- package/docs/subagents/reference.md +73 -33
- package/docs/subagents.md +119 -187
- package/docs/terminal-setup.md +50 -38
- package/docs/termux.md +67 -41
- package/docs/themes/reference.md +23 -19
- package/docs/themes.md +142 -127
- package/docs/tmux.md +47 -55
- package/docs/tools.md +147 -109
- package/docs/tui/reference.md +166 -214
- package/docs/tui.md +196 -341
- package/docs/usage.md +118 -138
- package/docs/verification.md +79 -51
- package/docs/web-access.md +121 -101
- package/docs/windows.md +26 -27
- package/docs/worktree-snapshots/reference.md +245 -0
- package/docs/worktree-snapshots.md +71 -259
- package/package.json +8 -8
- package/dist/_shared/startup-0-2-5QHPCEON.js.map +0 -1
- package/docs/guides/intercom.md +0 -32
- package/docs/guides/orchestration.md +0 -28
- package/docs/guides/subagents.md +0 -37
|
@@ -1,57 +1,51 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "
|
|
2
|
+
title: "Use PgBouncer with PostgreSQL"
|
|
3
3
|
sidebarTitle: "PgBouncer"
|
|
4
|
-
description: "
|
|
4
|
+
description: "Run PgBouncer in transaction mode between Atomic and PostgreSQL when agent processes exceed the server's connection limit, with TLS, SCRAM auth, pool sizing, and checks."
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
PgBouncer is a
|
|
7
|
+
PgBouncer is a lightweight connection pooler that sits between Atomic and PostgreSQL. Thousands of client connections from Atomic terminate at PgBouncer, which multiplexes their transactions over a few dozen server connections to PostgreSQL.
|
|
8
8
|
|
|
9
|
-
This guide
|
|
9
|
+
This guide builds on [PostgreSQL setup](/storage/postgres) and uses these placeholder names:
|
|
10
10
|
|
|
11
|
-
|
|
|
11
|
+
| Placeholder | Meaning |
|
|
12
12
|
| --- | --- |
|
|
13
|
-
| `db.example.com` |
|
|
14
|
-
| `pgbouncer.example.com` |
|
|
15
|
-
| `atomic` |
|
|
16
|
-
| `atomic_runtime` |
|
|
17
|
-
| `pgbouncer_auth` |
|
|
13
|
+
| `db.example.com` | PostgreSQL server hostname |
|
|
14
|
+
| `pgbouncer.example.com` | PgBouncer server hostname |
|
|
15
|
+
| `atomic` | Atomic database name |
|
|
16
|
+
| `atomic_runtime` | Runtime role that agent machines connect as |
|
|
17
|
+
| `pgbouncer_auth` | Restricted lookup role PgBouncer uses to verify passwords |
|
|
18
18
|
|
|
19
19
|
## When you need PgBouncer
|
|
20
20
|
|
|
21
|
-
Every connection an Atomic process opens counts against PostgreSQL's `max_connections
|
|
21
|
+
Every connection an Atomic process opens counts against PostgreSQL's `max_connections` ([count your connections](/storage/postgres#count-the-connections-atomic-needs)):
|
|
22
22
|
|
|
23
|
-
-
|
|
24
|
-
-
|
|
23
|
+
- **Agent process:** up to `maxConnections + readerMaxConnections`
|
|
24
|
+
- **Intercom broker:** up to `maxConnections + readerMaxConnections + 1` (for wake-ups)
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
If PostgreSQL cannot spare at least `maxConnections: 2` per process across your fleet, deploy PgBouncer.
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
With PgBouncer, those 300 processes connect to PgBouncer instead. The 150 brokers keep one direct connection each for wake-ups, which leaves 287 − 150 = 137 for PgBouncer. The configuration below shares 85 connections to PostgreSQL between all 300 processes: a pool of 80 plus 5 in reserve. With the brokers' connections, that is 235, which fits in 287.
|
|
28
|
+
**Example:** 150 CI runners each run 1 agent and 1 Intercom broker (300 processes, 150 brokers) against a server with `max_connections = 300`, 3 reserved admin slots, and 10 non-Atomic clients (287 slots available). Even at `maxConnections: 1` and `readerMaxConnections: 0`, the fleet needs `300 + 150 = 450` connections. With PgBouncer, all 300 processes connect to PgBouncer, the 150 brokers hold 1 direct wake-up connection each (`287 − 150 = 137` slots left), and PgBouncer multiplexes all 300 processes over an 85-connection server pool (`80 + 5` reserve, totaling 235 server connections).
|
|
31
29
|
|
|
32
30
|
## How Atomic works with PgBouncer
|
|
33
31
|
|
|
34
|
-
**Transaction mode.** Run PgBouncer
|
|
35
|
-
|
|
36
|
-
- Settings that Atomic changes, such as the schema it uses and its time limits, last only for the transaction that set them.
|
|
37
|
-
- Locks that Atomic takes are released when the transaction ends.
|
|
38
|
-
- A statement outside a transaction is a transaction of its own.
|
|
39
|
-
|
|
40
|
-
So nothing Atomic does depends on keeping the same connection to PostgreSQL between transactions. Do not use statement mode, which breaks transactions.
|
|
32
|
+
**Transaction mode.** Run PgBouncer with `pool_mode = transaction`. PgBouncer lends a PostgreSQL backend connection to a client for one transaction and returns it to the pool as soon as the transaction commits or rolls back. Atomic scopes every session setting (`search_path`, timeouts) and advisory lock to the transaction, so nothing depends on pinning a backend connection between transactions.
|
|
41
33
|
|
|
42
|
-
|
|
34
|
+
<Warning>
|
|
35
|
+
Never use `pool_mode = statement` with Atomic—statement pooling breaks multi-statement transactions.
|
|
36
|
+
</Warning>
|
|
43
37
|
|
|
44
|
-
|
|
38
|
+
**Direct wake-ups via `listenUrl`.** Intercom brokers receive instant message notices via PostgreSQL `LISTEN`/`NOTIFY`, which requires a persistent backend connection that transaction pooling cannot maintain. Point `listenUrl` directly at PostgreSQL so each broker opens one direct `atomic-listen` connection while all other queries flow through PgBouncer.
|
|
45
39
|
|
|
46
|
-
|
|
40
|
+
If you omit `listenUrl`, Atomic detects the pooler and falls back to polling wake-up hints every 0.5 seconds (instead of instant notifications with a 5-second hint poll and 30-second backup outbox scan). Messages still arrive, at slightly higher latency and query volume.
|
|
47
41
|
|
|
48
|
-
|
|
42
|
+
**Prepared statements.** PostgreSQL plans a prepared statement once and reuses the plan. PgBouncer 1.21+ tracks prepared statements across transaction pooling when `max_prepared_statements > 0` (PgBouncer 1.24+ defaults this to `200`). Atomic probes PgBouncer on its first connection and configures prepared statements automatically:
|
|
49
43
|
|
|
50
|
-
- **PgBouncer 1.21
|
|
51
|
-
- **
|
|
52
|
-
- **
|
|
44
|
+
- **PgBouncer 1.21+ with `max_prepared_statements > 0`:** enabled automatically.
|
|
45
|
+
- **Older PgBouncer, `max_prepared_statements = 0`, Supavisor, or unknown poolers:** disabled automatically to avoid missing-statement errors.
|
|
46
|
+
- **Pooler on a port other than `6432` or `6543`:** Atomic may not infer a pooler automatically—set `listenUrl` or `maxPreparedStatements: 0`.
|
|
53
47
|
|
|
54
|
-
|
|
48
|
+
Setting `maxPreparedStatements` explicitly overrides auto-detection (`0` forces off, `256` forces on). If PgBouncer's `max_prepared_statements` is later lowered to `0` at runtime, Atomic retries the failed query once and disables prepared statements for the remainder of the process.
|
|
55
49
|
|
|
56
50
|
```text
|
|
57
51
|
agent processes ──> PgBouncer :6432 ──> PostgreSQL :5432
|
|
@@ -63,25 +57,25 @@ Intercom brokers ──> PgBouncer :6432 ──> PostgreSQL :5432
|
|
|
63
57
|
|
|
64
58
|
### Connection limits
|
|
65
59
|
|
|
66
|
-
PostgreSQL
|
|
60
|
+
Size PostgreSQL's `max_connections` (requires restart) to cover:
|
|
67
61
|
|
|
68
|
-
- PgBouncer's
|
|
69
|
-
- One wake-up connection per Intercom broker
|
|
70
|
-
- Administrators, monitoring, and other applications
|
|
62
|
+
- PgBouncer's server pool (`default_pool_size + reserve_pool_size`)
|
|
63
|
+
- One wake-up connection per Intercom broker (when using `listenUrl`)
|
|
64
|
+
- Administrators, monitoring, and other applications
|
|
71
65
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
To stop Atomic's runtime role from taking every slot, you can cap it. The cap counts every connection the role opens, including PgBouncer's connections for that role. Set it to PgBouncer's pool plus one wake-up connection per broker, plus a margin. In the example in [When you need PgBouncer](#when-you-need-pgbouncer), that is 85 + 150 = 235, plus a margin:
|
|
66
|
+
Cap `atomic_runtime` so a runaway fleet cannot exhaust admin slots. The cap includes both PgBouncer's pooled connections for `atomic_runtime` and direct broker wake-up connections (for the 150-runner example: `85 + 150 = 235`, plus margin):
|
|
75
67
|
|
|
76
68
|
```sql
|
|
77
69
|
ALTER ROLE atomic_runtime CONNECTION LIMIT 250;
|
|
78
70
|
```
|
|
79
71
|
|
|
80
|
-
Raise
|
|
72
|
+
Raise this cap if PgBouncer logs `too many connections for role "atomic_runtime"`.
|
|
81
73
|
|
|
82
74
|
### A role for password lookups
|
|
83
75
|
|
|
84
|
-
|
|
76
|
+
Instead of duplicating user passwords in PgBouncer, configure `auth_query` with a restricted lookup role (`pgbouncer_auth`). Creating this function requires a superuser; on managed services without superuser access, use the provider's built-in pooler or list roles in PgBouncer's `auth_file`.
|
|
77
|
+
|
|
78
|
+
Connected to the `atomic` database as a superuser, run:
|
|
85
79
|
|
|
86
80
|
```sql
|
|
87
81
|
CREATE ROLE pgbouncer_auth LOGIN PASSWORD '<auth role password>';
|
|
@@ -101,15 +95,11 @@ REVOKE ALL ON FUNCTION pgbouncer.get_auth(text) FROM PUBLIC;
|
|
|
101
95
|
GRANT EXECUTE ON FUNCTION pgbouncer.get_auth(text) TO pgbouncer_auth;
|
|
102
96
|
```
|
|
103
97
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
When you change a role's password with `ALTER ROLE`, PgBouncer uses the new one at once. You do not need to reload it.
|
|
107
|
-
|
|
108
|
-
Passwords must use SCRAM, PostgreSQL's default since version 14. Check with `SHOW password_encoding;`, which should say `scram-sha-256`.
|
|
98
|
+
`SECURITY DEFINER` lets `pgbouncer_auth` look up only the allowlisted non-superuser roles without direct access to `pg_authid`. List every role Atomic machines log in as, and keep `RETURNS TABLE`—a scalar/record null row causes PgBouncer to log `auth_query response contained null user name`. Password changes via `ALTER ROLE` take effect immediately without reloading PgBouncer. Verify SCRAM encoding with `SHOW password_encoding;` (`scram-sha-256`).
|
|
109
99
|
|
|
110
100
|
### Who may connect
|
|
111
101
|
|
|
112
|
-
|
|
102
|
+
Allow PgBouncer, agent hosts (for direct `listenUrl` wake-ups), and your migration host over TLS in `pg_hba.conf`, then reload with `SELECT pg_reload_conf();`:
|
|
113
103
|
|
|
114
104
|
```text
|
|
115
105
|
# TYPE DATABASE USER ADDRESS METHOD
|
|
@@ -119,11 +109,11 @@ hostssl atomic atomic_runtime 10.0.2.0/24 scram-sha-256
|
|
|
119
109
|
hostssl atomic atomic_owner 10.0.3.10/32 scram-sha-256
|
|
120
110
|
```
|
|
121
111
|
|
|
122
|
-
Here `10.0.1.5` is PgBouncer, `10.0.2.0/24` is the
|
|
112
|
+
Here `10.0.1.5` is PgBouncer, `10.0.2.0/24` is the agent subnet, and `10.0.3.10` runs `atomic storage migrate` directly against PostgreSQL on port `5432` (never through PgBouncer).
|
|
123
113
|
|
|
124
114
|
## Configure PgBouncer
|
|
125
115
|
|
|
126
|
-
|
|
116
|
+
Save this configuration (for PgBouncer 1.21+) as `/etc/pgbouncer/pgbouncer.ini`:
|
|
127
117
|
|
|
128
118
|
```ini
|
|
129
119
|
;; Which databases PgBouncer offers, and where each one really is.
|
|
@@ -183,29 +173,31 @@ query_wait_timeout = 120
|
|
|
183
173
|
stats_users = pgbouncer_auth
|
|
184
174
|
```
|
|
185
175
|
|
|
186
|
-
Save
|
|
176
|
+
Save `pgbouncer_auth`'s password in `/etc/pgbouncer/userlist.txt`, readable only by the PgBouncer service user:
|
|
187
177
|
|
|
188
178
|
```text
|
|
189
179
|
"pgbouncer_auth" "<auth role password>"
|
|
190
180
|
```
|
|
191
181
|
|
|
192
|
-
|
|
182
|
+
Only `pgbouncer_auth` needs its password in `userlist.txt`; all other role passwords remain solely inside PostgreSQL.
|
|
193
183
|
|
|
194
184
|
### Choose the pool sizes
|
|
195
185
|
|
|
196
|
-
- **`default_pool_size
|
|
197
|
-
- **`reserve_pool_size
|
|
198
|
-
- **`max_db_connections
|
|
199
|
-
- **`max_client_conn
|
|
200
|
-
- **Lock waits hold
|
|
186
|
+
- **`default_pool_size`:** Server connections PgBouncer opens for `atomic_runtime`. Must not exceed PostgreSQL's remaining capacity (`max_connections` minus reserved slots, broker wake-ups, other clients, and `reserve_pool_size`—132 in the 150-runner example). Start near 2× server CPU cores (for example `32` on a 16-core server; `80` above assumes ~40 cores) and raise only if `cl_waiting > 0` in `SHOW POOLS` while PostgreSQL CPU has headroom. Higher network latency between agents and PostgreSQL requires a slightly larger pool.
|
|
187
|
+
- **`reserve_pool_size`:** Burst slots lent after a client waits `reserve_pool_timeout` seconds.
|
|
188
|
+
- **`max_db_connections`:** Hard cap on total server connections for `atomic` (`default_pool_size + reserve_pool_size`).
|
|
189
|
+
- **`max_client_conn`:** Client connections accepted by PgBouncer. Set well above `processes × (maxConnections + readerMaxConnections)`, and raise the OS open-file limit (`ulimit -n` / `LimitNOFILE`) above `max_client_conn`.
|
|
190
|
+
- **Lock waits hold pool slots:** Transactions waiting on locks retain their PostgreSQL backend connection. If `cl_waiting` climbs while `sv_active` hits the cap, raise `default_pool_size` and `max_db_connections` within `max_connections`.
|
|
201
191
|
|
|
202
|
-
|
|
192
|
+
Behind PgBouncer, keep Atomic's `maxConnections` at its default of `8` or higher—PgBouncer queues client transactions for its server pool.
|
|
203
193
|
|
|
204
194
|
### Start PgBouncer
|
|
205
195
|
|
|
206
|
-
Start PgBouncer
|
|
196
|
+
Start PgBouncer (`pgbouncer -d /etc/pgbouncer/pgbouncer.ini` or `systemctl restart pgbouncer`). After subsequent edits to `pgbouncer.ini`, run `RELOAD;` on PgBouncer's admin console.
|
|
207
197
|
|
|
208
|
-
|
|
198
|
+
<Warning>
|
|
199
|
+
**Ubuntu and Debian default `LimitNOFILE=1024`.** The distro unit starts PgBouncer with only 1,024 file descriptors—too low for `max_client_conn = 5000` (logged as `kernel file descriptor limit: 1024`). Raise the limit with a systemd drop-in, then run `systemctl daemon-reload && systemctl restart pgbouncer`:
|
|
200
|
+
</Warning>
|
|
209
201
|
|
|
210
202
|
```ini
|
|
211
203
|
# /etc/systemd/system/pgbouncer.service.d/limits.conf
|
|
@@ -213,37 +205,41 @@ The Ubuntu and Debian service starts PgBouncer with a limit of 1024 open files,
|
|
|
213
205
|
LimitNOFILE=16384
|
|
214
206
|
```
|
|
215
207
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
208
|
+
<Note>
|
|
209
|
+
If PgBouncer runs on the PostgreSQL host and connects via `127.0.0.1`, PostgreSQL's certificate typically does not include `127.0.0.1`. Use `server_tls_sslmode = verify-ca`, or connect via the hostname on the server certificate.
|
|
210
|
+
</Note>
|
|
219
211
|
|
|
220
212
|
## Configure Atomic
|
|
221
213
|
|
|
222
|
-
Point `url` at PgBouncer and `listenUrl` at PostgreSQL
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
214
|
+
Point `url` at PgBouncer and `listenUrl` directly at PostgreSQL (both use `atomic_runtime` and the same password). On each agent machine:
|
|
215
|
+
|
|
216
|
+
<Steps>
|
|
217
|
+
<Step title="Join the database through PgBouncer">
|
|
218
|
+
```bash
|
|
219
|
+
(umask 077; printf 'Runtime password: '; read -rs password; printf '\n'; printf '%s' "$password" > ~/atomic-db-password)
|
|
220
|
+
atomic storage join 'postgresql://atomic_runtime@pgbouncer.example.com:6432/atomic' --password-file ~/atomic-db-password
|
|
221
|
+
rm ~/atomic-db-password # atomic storage join keeps its own copy
|
|
222
|
+
```
|
|
223
|
+
</Step>
|
|
224
|
+
<Step title="Add listenUrl to ~/.atomic/agent/settings.json">
|
|
225
|
+
`atomic storage join` does not set `listenUrl`, so add the direct PostgreSQL endpoint:
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
jq '.storage.options.listenUrl = "postgresql://atomic_runtime@db.example.com:5432/atomic"' ~/.atomic/agent/settings.json > ~/.atomic/agent/settings.json.new \
|
|
229
|
+
&& mv ~/.atomic/agent/settings.json.new ~/.atomic/agent/settings.json
|
|
230
|
+
```
|
|
231
|
+
</Step>
|
|
232
|
+
<Step title="Restart Intercom and verify wake-ups">
|
|
233
|
+
```bash
|
|
234
|
+
atomic intercom restart
|
|
235
|
+
atomic storage status
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Confirm `atomic storage status` reports `wake-ups: LISTEN/NOTIFY`.
|
|
239
|
+
</Step>
|
|
240
|
+
</Steps>
|
|
241
|
+
|
|
242
|
+
The resulting `~/.atomic/agent/settings.json` entry looks like this (keep the exact `storage-token.<id>` filename that `atomic storage join` created on your machine; `storage-token.example` is a placeholder):
|
|
247
243
|
|
|
248
244
|
```json
|
|
249
245
|
{
|
|
@@ -254,14 +250,14 @@ The setting in `~/.atomic/agent/settings.json` then looks like this. `atomic sto
|
|
|
254
250
|
"listenUrl": "postgresql://atomic_runtime@db.example.com:5432/atomic",
|
|
255
251
|
"maxConnections": 8
|
|
256
252
|
},
|
|
257
|
-
"secrets": { "password": { "file": "agent/storage-token.
|
|
253
|
+
"secrets": { "password": { "file": "agent/storage-token.example" } }
|
|
258
254
|
}
|
|
259
255
|
}
|
|
260
256
|
```
|
|
261
257
|
|
|
262
|
-
Atomic
|
|
258
|
+
Atomic verifies the certificate and hostname of both PgBouncer and PostgreSQL; append `?sslrootcert=/path/to/root.crt` if signed by a private CA (see [TLS](/storage/postgres#tls)).
|
|
263
259
|
|
|
264
|
-
|
|
260
|
+
Equivalent SDK configuration:
|
|
265
261
|
|
|
266
262
|
```typescript
|
|
267
263
|
import { openPostgresDatabase } from "@bastani/atomic-storage-postgres";
|
|
@@ -276,28 +272,26 @@ const database = await openPostgresDatabase({
|
|
|
276
272
|
|
|
277
273
|
## Check that it works
|
|
278
274
|
|
|
279
|
-
**Atomic
|
|
275
|
+
**Atomic:** Run `atomic storage status` on an agent host and confirm `wake-ups: LISTEN/NOTIFY` (or `wake-ups: connecting` immediately after restart). If it shows `polling only, notifications do not pass the URL's transaction pooler`, check that `listenUrl` points directly to PostgreSQL.
|
|
280
276
|
|
|
281
|
-
**PgBouncer
|
|
277
|
+
**PgBouncer:** Inspect the `atomic` / `atomic_runtime` row via PgBouncer's console:
|
|
282
278
|
|
|
283
279
|
```bash
|
|
284
280
|
psql -h pgbouncer.example.com -p 6432 -U pgbouncer_auth pgbouncer -c 'SHOW POOLS'
|
|
285
281
|
```
|
|
286
282
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
| Column | Meaning | What to look for |
|
|
283
|
+
| Column | Meaning | Healthy value |
|
|
290
284
|
| --- | --- | --- |
|
|
291
|
-
| `cl_active` |
|
|
292
|
-
| `cl_waiting` | Clients waiting for a PostgreSQL
|
|
293
|
-
| `sv_active` | PostgreSQL connections
|
|
294
|
-
| `sv_idle` | PostgreSQL connections
|
|
295
|
-
| `maxwait` |
|
|
296
|
-
| `pool_mode` |
|
|
285
|
+
| `cl_active` | Client connections to PgBouncer | Roughly total Atomic client pool connections |
|
|
286
|
+
| `cl_waiting` | Clients waiting for a PostgreSQL backend | `0` most of the time; sustained `> 0` indicates pool saturation or slow queries |
|
|
287
|
+
| `sv_active` | Active PostgreSQL server connections | At most `default_pool_size + reserve_pool_size` |
|
|
288
|
+
| `sv_idle` | Ready PostgreSQL server connections | Some idle connections are normal |
|
|
289
|
+
| `maxwait` | Seconds the oldest waiting client has waited | `< 1` second |
|
|
290
|
+
| `pool_mode` | Active pooling mode | `transaction` |
|
|
297
291
|
|
|
298
|
-
`SHOW CLIENTS`
|
|
292
|
+
Use `SHOW CLIENTS` and `SHOW STATS` for per-client details and query/wait totals.
|
|
299
293
|
|
|
300
|
-
**PostgreSQL
|
|
294
|
+
**PostgreSQL:** Verify pooled (`atomic`) and direct wake-up (`atomic-listen`) counts on the database server:
|
|
301
295
|
|
|
302
296
|
```sql
|
|
303
297
|
SELECT application_name, state, count(*)
|
|
@@ -307,38 +301,38 @@ GROUP BY 1, 2
|
|
|
307
301
|
ORDER BY 3 DESC;
|
|
308
302
|
```
|
|
309
303
|
|
|
310
|
-
|
|
304
|
+
`atomic` connections should stay at or below PgBouncer's `max_db_connections`, with one `atomic-listen` connection per broker.
|
|
311
305
|
|
|
312
306
|
## Common errors
|
|
313
307
|
|
|
314
|
-
Atomic
|
|
308
|
+
Atomic wraps these causes in `StorageUnavailableError` or `StorageTransientError`:
|
|
315
309
|
|
|
316
310
|
| Message | Cause | Fix |
|
|
317
311
|
| --- | --- | --- |
|
|
318
|
-
| `no more connections allowed (max_client_conn)` |
|
|
319
|
-
| `query_wait_timeout` |
|
|
320
|
-
| `SSL required` |
|
|
321
|
-
| `SASL authentication failed` |
|
|
322
|
-
| `wake-ups: polling only, notifications do not pass the URL's transaction pooler`
|
|
323
|
-
| `too many connections for role "atomic_runtime"` |
|
|
324
|
-
| `sorry, too many clients already` | PostgreSQL
|
|
325
|
-
| `prepared statement "atomic_…" does not exist` |
|
|
326
|
-
| `unsupported startup parameter: <name>` |
|
|
327
|
-
| `bouncer config error
|
|
328
|
-
| `kernel file descriptor limit: 1024`
|
|
312
|
+
| `no more connections allowed (max_client_conn)` | Client connections exceeded `max_client_conn`. | Raise `max_client_conn` and `LimitNOFILE`. |
|
|
313
|
+
| `query_wait_timeout` | Client waited past `query_wait_timeout` for a server connection. | Check `cl_waiting` / `maxwait` in `SHOW POOLS`, raise `default_pool_size` if PostgreSQL has capacity, or check [active waits](/storage/postgres#check-the-effect). |
|
|
314
|
+
| `SSL required` | Connected without TLS (Atomic skips TLS for `localhost` by default). | Append `?sslmode=verify-full&sslrootcert=/path/to/root.crt` to `url`. |
|
|
315
|
+
| `SASL authentication failed` | Wrong password, unknown role, missing `[databases]` entry, or missing `pgbouncer.get_auth`. | Verify password, role allowlist, database entry, and lookup function. |
|
|
316
|
+
| `wake-ups: polling only, notifications do not pass the URL's transaction pooler` | `listenUrl` is unset or points at PgBouncer. | Point `listenUrl` directly at PostgreSQL. |
|
|
317
|
+
| `too many connections for role "atomic_runtime"` | Role `CONNECTION LIMIT` is below PgBouncer's pool plus broker wake-ups. | Raise `CONNECTION LIMIT` or lower `default_pool_size`. |
|
|
318
|
+
| `sorry, too many clients already` | PostgreSQL `max_connections` is too low for pool + wake-ups + other clients. | Raise `max_connections` or lower `default_pool_size` and `max_db_connections`. |
|
|
319
|
+
| `prepared statement "atomic_…" does not exist` | Prepared statements forced on behind a pooler that drops them, or `max_prepared_statements` was zeroed at runtime. | Set `max_prepared_statements > 0` in PgBouncer 1.21+, or set `maxPreparedStatements: 0` in Atomic. |
|
|
320
|
+
| `unsupported startup parameter: <name>` | Another client sent a startup parameter PgBouncer does not forward (Atomic sends only `application_name`). | Add that parameter to `ignore_startup_parameters` (never add `application_name`). |
|
|
321
|
+
| `bouncer config error` / `auth_query response contained null user name` | `pgbouncer.get_auth` returned a null row for an unknown role. | Declare with `RETURNS TABLE` as in [A role for password lookups](#a-role-for-password-lookups). |
|
|
322
|
+
| `kernel file descriptor limit: 1024` | Service `LimitNOFILE` is below `max_client_conn`. | Raise `LimitNOFILE` (see [Start PgBouncer](#start-pgbouncer)). |
|
|
329
323
|
|
|
330
324
|
## Managed services
|
|
331
325
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
326
|
+
| Provider | Pooled endpoint (`url`) | Direct endpoint (`listenUrl`) | Prepared statements |
|
|
327
|
+
| --- | --- | --- | --- |
|
|
328
|
+
| **Supabase** | Supavisor transaction mode on port `6543` | Direct host on port `5432` | Leave `maxPreparedStatements` unset (auto-disabled behind Supavisor) |
|
|
329
|
+
| **Neon** | `-pooler` host (PgBouncer transaction mode) | Same host without `-pooler` | Auto-detected |
|
|
330
|
+
| **Azure Flexible Server** | Built-in PgBouncer (`pgbouncer.enabled`) on port `6432` | Same host on port `5432` | Auto-detected |
|
|
331
|
+
| **Amazon RDS Proxy** | Proxy endpoint (port `5432`) | DB instance endpoint | Set `maxPreparedStatements: 0` explicitly (port `5432` does not auto-detect a pooler) |
|
|
338
332
|
|
|
339
333
|
## Related pages
|
|
340
334
|
|
|
341
|
-
- [Tuning for many concurrent agents](/storage/postgres#tuning-for-many-concurrent-agents):
|
|
342
|
-
- [Tune PostgreSQL for many agents](/storage/postgres/tuning):
|
|
343
|
-
- [Connection poolers](/storage/postgres#connection-poolers) and [Wake-ups](/storage/postgres#wake-ups)
|
|
344
|
-
- [PgBouncer
|
|
335
|
+
- [Tuning for many concurrent agents](/storage/postgres#tuning-for-many-concurrent-agents): connection arithmetic and `maxConnections` sizing.
|
|
336
|
+
- [Tune PostgreSQL for many agents](/storage/postgres/tuning): server memory, `pg_stat_statements`, autovacuum, and `lz4` compression.
|
|
337
|
+
- [Connection poolers](/storage/postgres#connection-poolers) and [Wake-ups](/storage/postgres#wake-ups).
|
|
338
|
+
- [PgBouncer configuration reference](https://www.pgbouncer.org/config.html).
|