> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-fbfa8bee.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Manual horizontal scaling in ClickHouse Cloud

# Horizontal scaling

export const ScalePlanFeatureBadge = ({feature = 'This feature', linking_verb_are = false}) => {
  return <div className="scalePlanFeatureContainer">
            <div className="scalePlanFeatureBadge">
                Scale plan feature
            </div>
            <div>
                <p>{feature} {linking_verb_are ? 'are' : 'is'} available in the Scale and Enterprise plans. To upgrade, visit the plans page in the cloud console.</p>
            </div>
        </div>;
};

export const Image = ({img, alt, size}) => {
  return <Frame>
      <img src={img} alt={alt} />
    </Frame>;
};

<h2 id="manual-horizontal-scaling">
  Manual horizontal scaling
</h2>

You can use ClickHouse Cloud [public APIs](/api-reference/organization/get-list-of-available-organizations#/paths/~1v1~1organizations~1:organizationId~1services~1:serviceId~1scaling/patch) to scale your service by updating the scaling settings for the service or adjust the number of replicas from the cloud console.

**Scale** and **Enterprise** tiers also support single-replica services. Services once scaled out, can be scaled back in to a minimum of a single replica. Note that single replica services have reduced availability and aren't recommended for production usage.

<Note>
  Services can scale horizontally to a maximum of 20 replicas. If you need additional replicas, please contact our support team.
</Note>

<h3 id="horizontal-scaling-via-api">
  Horizontal scaling via API
</h3>

To horizontally scale a cluster, issue a `PATCH` request via the API to adjust the number of replicas. The screenshots below show an API call to scale out a `3` replica cluster to `6` replicas, and the corresponding response.

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-fbfa8bee/fnZpjDPmkG606nII/images/cloud/manage/scaling-patch-request.png?fit=max&auto=format&n=fnZpjDPmkG606nII&q=85&s=a03700b8c359de6359dc86a506299aea" size="lg" alt="Scaling PATCH request" border width="1600" height="538" data-path="images/cloud/manage/scaling-patch-request.png" />

*`PATCH` request to update `numReplicas`*

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-fbfa8bee/fnZpjDPmkG606nII/images/cloud/manage/scaling-patch-response.png?fit=max&auto=format&n=fnZpjDPmkG606nII&q=85&s=20e280f40d0fa647e63fc22704cf117e" size="md" alt="Scaling PATCH response" border width="1122" height="1166" data-path="images/cloud/manage/scaling-patch-response.png" />

*Response from `PATCH` request*

If you issue a new scaling request or multiple requests in succession, while one is already in progress, the scaling service will ignore the intermediate states and converge on the final replica count.

<h3 id="horizontal-scaling-via-ui">
  Horizontal scaling via UI
</h3>

To scale a service horizontally from the UI, you can adjust the number of replicas for the service on the **Settings** page.

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-fbfa8bee/fnZpjDPmkG606nII/images/cloud/manage/scaling-configure.png?fit=max&auto=format&n=fnZpjDPmkG606nII&q=85&s=1bcb2f024a548eece78e8f9d227424d4" size="md" alt="Scaling configuration settings" border width="1330" height="624" data-path="images/cloud/manage/scaling-configure.png" />

*Service scaling settings from the ClickHouse Cloud console*

Once the service has scaled, the metrics dashboard in the cloud console should show the correct allocation to the service. The screenshot below shows the cluster having scaled to total memory of `96 GiB`, which is `6` replicas, each with `16 GiB` memory allocation.

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-fbfa8bee/fnZpjDPmkG606nII/images/cloud/manage/scaling-memory-allocation.png?fit=max&auto=format&n=fnZpjDPmkG606nII&q=85&s=bbe210caf9f488ff9a2252e693b0baa5" size="md" alt="Scaling memory allocation" border width="1282" height="402" data-path="images/cloud/manage/scaling-memory-allocation.png" />
