|
| 1 | +--- |
| 2 | +title: 'Scaling DB ClickPipes via OpenAPI' |
| 3 | +description: 'Doc for scaling DB ClickPipes via OpenAPI' |
| 4 | +slug: /integrations/clickpipes/postgres/scaling |
| 5 | +sidebar_label: 'Scaling' |
| 6 | +--- |
| 7 | + |
| 8 | +:::caution Most users won't need this API |
| 9 | +Default configuration of DB 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. |
| 10 | +::: |
| 11 | + |
| 12 | +Scaling API may be useful for: |
| 13 | +- Large initial loads (over 4 TB) |
| 14 | +- Migrating a moderate amount of data as quickly as possible |
| 15 | +- Supporting over 8 CDC ClickPipes under the same service |
| 16 | + |
| 17 | +Before attempting to scale up, consider: |
| 18 | +- Ensuring the source DB has sufficient available capacity |
| 19 | +- First adjusting [initial load parallelism and partitioning](/integrations/data-ingestion/clickpipes/postgres/parallel_initial_load) when creating a ClickPipe |
| 20 | +- Checking for [long-running transactions](/integrations/clickpipes/postgres/sync_control#transactions-pg-sync) on the source that could be causing CDC delays |
| 21 | + |
| 22 | +**Increasing the 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). |
| 23 | + |
| 24 | +## Prerequisites for this process {#prerequisites} |
| 25 | + |
| 26 | +Before you get started you will need: |
| 27 | + |
| 28 | +1. [ClickHouse API key](/cloud/manage/openapi) with Admin permissions on the target ClickHouse Cloud service. |
| 29 | +2. A DB 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. |
| 30 | + |
| 31 | +## Steps to scale DB ClickPipes {#cdc-scaling-steps} |
| 32 | + |
| 33 | +Set the following environment variables before running any commands: |
| 34 | + |
| 35 | +```bash |
| 36 | +ORG_ID=<Your ClickHouse organization ID> |
| 37 | +SERVICE_ID=<Your ClickHouse service ID> |
| 38 | +KEY_ID=<Your ClickHouse key ID> |
| 39 | +KEY_SECRET=<Your ClickHouse key secret> |
| 40 | +``` |
| 41 | + |
| 42 | +Fetch the current scaling configuration (optional): |
| 43 | + |
| 44 | +```bash |
| 45 | +curl --silent --user $KEY_ID:$KEY_SECRET \ |
| 46 | +https://api.clickhouse.cloud/v1/organizations/$ORG_ID/services/$SERVICE_ID/clickpipesCdcScaling \ |
| 47 | +| jq |
| 48 | + |
| 49 | +# example result: |
| 50 | +{ |
| 51 | + "result": { |
| 52 | + "replicaCpuMillicores": 2000, |
| 53 | + "replicaMemoryGb": 8 |
| 54 | + }, |
| 55 | + "requestId": "04310d9e-1126-4c03-9b05-2aa884dbecb7", |
| 56 | + "status": 200 |
| 57 | +} |
| 58 | +``` |
| 59 | + |
| 60 | +Set the desired scaling. Supported configurations include 1-24 CPU cores with memory (GB) set to 4× the core count: |
| 61 | + |
| 62 | +```bash |
| 63 | +cat <<EOF | tee cdc_scaling.json |
| 64 | +{ |
| 65 | + "replicaCpuMillicores": 24000, |
| 66 | + "replicaMemoryGb": 96 |
| 67 | +} |
| 68 | +EOF |
| 69 | + |
| 70 | +curl --silent --user $KEY_ID:$KEY_SECRET \ |
| 71 | +-X PATCH -H "Content-Type: application/json" \ |
| 72 | +https://api.clickhouse.cloud/v1/organizations/$ORG_ID/services/$SERVICE_ID/clickpipesCdcScaling \ |
| 73 | +-d @cdc_scaling.json | jq |
| 74 | +``` |
| 75 | + |
| 76 | +Wait for the configuration to propagate (typically 3-5 minutes). After the scaling is finished, the GET endpoint will reflect the new values: |
| 77 | + |
| 78 | +```bash |
| 79 | +curl --silent --user $KEY_ID:$KEY_SECRET \ |
| 80 | +https://api.clickhouse.cloud/v1/organizations/$ORG_ID/services/$SERVICE_ID/clickpipesCdcScaling \ |
| 81 | +| jq |
| 82 | + |
| 83 | +# example result: |
| 84 | +{ |
| 85 | + "result": { |
| 86 | + "replicaCpuMillicores": 24000, |
| 87 | + "replicaMemoryGb": 96 |
| 88 | + }, |
| 89 | + "requestId": "5a76d642-d29f-45af-a857-8c4d4b947bf0", |
| 90 | + "status": 200 |
| 91 | +} |
| 92 | +``` |
0 commit comments