-
Notifications
You must be signed in to change notification settings - Fork 7
PCSM-312 connection pool size configurable #63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
6dee1ad
4b296a5
9121a58
f7b32e5
92d1de0
0212a70
b15fe79
8b5e1be
7ced4cc
08541e1
b8ded38
c98cae0
08b52e8
443ff3f
d3e1b95
25e3116
8b34dc6
f1256e5
21e4f65
767ed1f
98eb861
474cda1
679a580
cb8cdf4
db467b4
6b71457
c8e543e
12b4ec3
8706aea
e510a51
f4929eb
cfad366
68bb56e
c52a49f
56a4fb9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,3 +47,90 @@ | |
| | `PCSM_REPL_WORKER_QUEUE_SIZE` | Defines the maximum number of replication events that each replication worker thread can queue before processing. | `5000` | | ||
| | `PCSM_REPL_BULK_OPS_SIZE` | Defines the maximum number of operations that can be grouped together into a single bulk apply batch during replication. | `5000` | | ||
|
|
||
|
|
||
| ## MongoDB connection string | ||
|
|
||
| !!! admonition "Version added: 0.10.0" | ||
|
|
||
| PCSM supports the MongoDB `maxPoolSize` connection string option, which controls the maximum number of connections the MongoDB Go driver can maintain in its connection pool. | ||
|
Check notice on line 55 in docs/install/parameters.md
|
||
|
|
||
| You can set this option in the source and/or target MongoDB connection strings using `--source` and `--target` command-line options or through the `PCSM_SOURCE_URI` and `PCSM_TARGET_URI` environment variables. | ||
|
rasika-chivate marked this conversation as resolved.
|
||
|
|
||
| ### Syntax | ||
|
|
||
| Append `maxPoolSize` as a query parameter to your connection string: | ||
|
|
||
| Without existing query parameters: | ||
|
|
||
| ~~~text | ||
| mongodb://host:port/?maxPoolSize=500 | ||
| ~~~ | ||
|
|
||
| With existing query parameters: | ||
|
|
||
| ~~~text | ||
| mongodb://host:port/?replicaSet=rs0&maxPoolSize=500 | ||
| ~~~ | ||
|
|
||
| ??? example "Example: maxPoolSize=500" | ||
|
|
||
| ```{.bash data-prompt="$"} | ||
|
Copilot marked this conversation as resolved.
|
||
| $ pcsm --source='mongodb://rs00:30000/?maxPoolSize=500' --target='mongodb://rs10:30100' --log-level='debug' | ||
| ``` | ||
|
|
||
| Output | ||
| ```{.text .no-copy} | ||
| 2026-06-24 15:16:40.691 INF Percona ClusterSync for MongoDB v0.10.0 3eb82dd 2026-06-24_09:36_UTC | ||
| 2026-06-24 15:16:40.692 INF Config: source client compressors: [snappy zstd zlib] s=connect | ||
| 2026-06-24 15:16:40.692 INF Config: source client maxPoolSize: 500 s=connect | ||
| 2026-06-24 15:16:40.711 INF Connected to source cluster [Percona Server for MongoDB 8.0.16-5]: mongodb://rs00:30000 | ||
| 2026-06-24 15:16:40.711 INF Config: target client compressors: [snappy zstd zlib] s=connect | ||
| 2026-06-24 15:16:40.711 INF Config: target client maxPoolSize: 100 (driver default) s=connect | ||
| 2026-06-24 15:16:40.724 INF Connected to target cluster [Percona Server for MongoDB 8.0.16-5]: mongodb://rs10:30100 | ||
| 2026-06-24 15:16:40.728 INF Checking Recovery Data for "pcsm" s=recovery | ||
| 2026-06-24 15:16:40.729 INF Recovery Data not found s=recovery | ||
| 2026-06-24 15:16:40.729 INF Starting HTTP server at http://localhost:2242 | ||
|
Comment on lines
+83
to
+92
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These samples use the pre-0.10.0 timestamp format. #69 switches PCSM to RFC 3339 UTC and restamps every log sample in the docs, and this section is marked 0.10.0, so these would ship stale. Can we restamp these and any other examples in the right format eg. 2026-06-24T15:16:40.691Z? |
||
| ``` | ||
|
|
||
| ### How maxPoolSize works | ||
|
Check warning on line 95 in docs/install/parameters.md
|
||
|
|
||
| | **Configuration** | **Behavior** | | ||
| | --------------- | -------- | | ||
| | Not set | Driver defaults to **100** connections | | ||
| | `maxPoolSize=N` | Driver caps the pool at **N** connections | | ||
| | `maxPoolSize=0` | Removes the limit, allowing the driver to create as many connections as needed. | | ||
|
|
||
|
|
||
| ??? example "Example: maxPoolSize not defined" | ||
|
|
||
| ```{.bash data-prompt="$"} | ||
|
Copilot marked this conversation as resolved.
|
||
| $ pcsm --source='mongodb://rs00:30000' --target='mongodb://rs10:30100' --log-level='debug' | ||
| ``` | ||
|
|
||
| Output | ||
| ```{.text .no-copy} | ||
| 2026-06-24 15:15:04.503 INF Percona ClusterSync for MongoDB v0.10.0 3eb82dd 2026-06-24_09:36_UTC | ||
| 2026-06-24 15:15:04.504 INF Config: source client compressors: [snappy zstd zlib] s=connect | ||
| 2026-06-24 15:15:04.504 INF Config: source client maxPoolSize: 100 (driver default) s=connect | ||
| 2026-06-24 15:15:04.525 INF Connected to source cluster [Percona Server for MongoDB 8.0.16-5]: mongodb://rs00:30000 | ||
| 2026-06-24 15:15:04.525 INF Config: target client compressors: [snappy zstd zlib] s=connect | ||
| 2026-06-24 15:15:04.525 INF Config: target client maxPoolSize: 100 (driver default) s=connect | ||
| 2026-06-24 15:15:04.533 INF Connected to target cluster [Percona Server for MongoDB 8.0.16-5]: mongodb://rs10:30100 | ||
| 2026-06-24 15:15:04.546 INF Checking Recovery Data for "pcsm" s=recovery | ||
| 2026-06-24 15:15:04.546 INF Recovery Data not found s=recovery | ||
| 2026-06-24 15:15:04.546 INF Starting HTTP server at http://localhost:2242 | ||
| ``` | ||
|
Copilot marked this conversation as resolved.
|
||
|
|
||
| ### Recommendations | ||
|
Copilot marked this conversation as resolved.
|
||
|
|
||
| For the best clone performance, size the connection pool to match or exceed the number of clone workers. | ||
|
|
||
| | Cluster | Recommended `maxPoolSize` | | ||
| | ------- | ----------------------------------- | | ||
| | Source | At least `--clone-num-read-workers` | | ||
| | Target | At least `--clone-num-insert-workers` | | ||
|
|
||
| When PCSM starts, it logs the effective `maxPoolSize` for both the source and target clients. | ||
|
Check notice on line 133 in docs/install/parameters.md
|
||
|
|
||
| !!! note | ||
| `maxPoolSize` applies independently to each MongoDB server or `mongos` instance that the client connects to. It does not define a single global connection limit for the entire client. | ||
|
Check notice on line 136 in docs/install/parameters.md
|
||
Uh oh!
There was an error while loading. Please reload this page.