-
Notifications
You must be signed in to change notification settings - Fork 360
ClickPipes: Postgres scaling #4238
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
aa12a64
ClickPipes: Postgres scaling
ilidemi 48b71f3
Tweaks
ilidemi d700fee
fix
ilidemi 78e48f5
Links and time
ilidemi 130d4b1
Remove circular deploy dependency
ilidemi 5af36c4
Better guidance, test a caution
ilidemi 71eae51
Feedback
ilidemi d612b20
Rename to DB pipes to avoid confusion with CDC/Snapshot
ilidemi 8cd86e4
Bold the costs
ilidemi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
93 changes: 93 additions & 0 deletions
93
docs/integrations/data-ingestion/clickpipes/postgres/scaling.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
--- | ||
title: 'Scaling CDC ClickPipes via OpenAPI' | ||
description: 'Doc for scaling CDC ClickPipes via OpenAPI' | ||
slug: /integrations/clickpipes/postgres/scaling | ||
sidebar_label: 'Scaling' | ||
--- | ||
|
||
:::caution Most users won't need this API | ||
Default configuration of CDC ClickPipes is designed to handle the majority of workloads out of the box. If you think your workload requires scaling, open a [support case](https://clickhouse.com/support/program) and we'll guide you through the optimal settings for the use case. | ||
::: | ||
|
||
Scaling API may be useful for: | ||
- Large initial loads (over 4 TB) | ||
- Migrating a moderate amount of data at a very high speed (sub-1 hour) | ||
- Supporting over 8 CDC ClickPipes under the same service | ||
|
||
Other signs that scaling may be necessary: | ||
ilidemi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- Initial load is taking longer than 24 hours while the load on the source DB is low | ||
- First consider adjusting the [initial load parallelism and partitioning](/integrations/data-ingestion/clickpipes/postgres/parallel_initial_load) when creating the ClickPipe | ||
- The new rows taking more than 2× the sync interval to appear on the destination table | ||
- As long as there are no [long-running transactions](/integrations/clickpipes/postgres/sync_control#transactions-pg-sync) on the source | ||
|
||
Increasing the CDC scale will proportionally increase your ClickPipes compute costs. If you're scaling up just for the initial loads, it's important to scale down after the snapshot is finished to avoid unexpected charges. For more details on pricing, see [Postgres CDC Pricing](/cloud/manage/billing/overview#clickpipes-for-postgres-cdc). | ||
|
||
## Prerequisites for this process {#prerequisites} | ||
|
||
Before you get started you will need: | ||
|
||
1. [ClickHouse API key](/cloud/manage/openapi) with Admin permissions on the target ClickHouse Cloud service. | ||
2. A CDC ClickPipe (Postgres, MySQL or MongoDB) provisioned in the service at some point in time. CDC infrastructure gets created along with the first ClickPipe, and the scaling endpoints become available from that point onwards. | ||
|
||
## Steps to scale CDC ClickPipes {#cdc-scaling-steps} | ||
|
||
Set the following environment variables before running any commands: | ||
|
||
```bash | ||
ORG_ID=<Your ClickHouse organization ID> | ||
SERVICE_ID=<Your ClickHouse service ID> | ||
KEY_ID=<Your ClickHouse key ID> | ||
KEY_SECRET=<Your ClickHouse key secret> | ||
``` | ||
|
||
Fetch the current scaling configuration (optional): | ||
|
||
```bash | ||
curl --silent --user $KEY_ID:$KEY_SECRET \ | ||
https://api.clickhouse.cloud/v1/organizations/$ORG_ID/services/$SERVICE_ID/clickpipesCdcScaling \ | ||
| jq | ||
|
||
# example result: | ||
{ | ||
"result": { | ||
"replicaCpuMillicores": 2000, | ||
"replicaMemoryGb": 8 | ||
}, | ||
"requestId": "04310d9e-1126-4c03-9b05-2aa884dbecb7", | ||
"status": 200 | ||
} | ||
``` | ||
|
||
Set the desired scaling. Supported configurations include 1..16 CPU cores and memory GB that is 4× the core count: | ||
|
||
```bash | ||
cat <<EOF | tee cdc_scaling.json | ||
{ | ||
"replicaCpuMillicores": 16000, | ||
"replicaMemoryGb": 64 | ||
} | ||
EOF | ||
|
||
curl --silent --user $KEY_ID:$KEY_SECRET \ | ||
-X PATCH -H "Content-Type: application/json" \ | ||
https://api.clickhouse.cloud/v1/organizations/$ORG_ID/services/$SERVICE_ID/clickpipesCdcScaling \ | ||
-d @cdc_scaling.json | jq | ||
``` | ||
|
||
Wait for the command to propagate - this usually takes 3-5 minutes. After the scaling is finished, the GET endpoint will reflect the new values: | ||
|
||
```bash | ||
curl --silent --user $KEY_ID:$KEY_SECRET \ | ||
https://api.clickhouse.cloud/v1/organizations/$ORG_ID/services/$SERVICE_ID/clickpipesCdcScaling \ | ||
| jq | ||
|
||
# example result: | ||
{ | ||
"result": { | ||
"replicaCpuMillicores": 16000, | ||
"replicaMemoryGb": 64 | ||
}, | ||
"requestId": "5a76d642-d29f-45af-a857-8c4d4b947bf0", | ||
"status": 200 | ||
} | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.