Documentation Index
Fetch the complete documentation index at: https://private-7c7dfe99-page-updates.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Introduction
Auto-scaling database resources requires careful balance: scaling up too slowly can risk performance degradation while scaling down too aggressively can trigger constant oscillations. ClickHouse Cloud enables faster scale-downs, minimized scaling oscillations, and substantial infrastructure cost reduction for variable workloads, while maintaining the stability needed for production databases by pairing a two-window recommendation framework with a target-tracking CPU recommendation system.CPU-based Scaling
CPU Scaling is based on target tracking which calculates the exact CPU allocation needed to keep utilization at a target level. A scaling action is only triggered if current CPU utilization falls outside a defined band:| Parameter | Value | Meaning |
|---|---|---|
| Target utilization | 53% | The utilization level ClickHouse aims to maintain |
| High watermark | 75% | Triggers scale-up when CPU exceeds this threshold |
| Low watermark | 37.5% | Triggers scale-down when CPU falls below this threshold |
Example
A service allocated 4 vCPU experiences a spike to 3.8 vCPU usage (~95% utilization), crossing the 75% high watermark. The recommender calculates:3.8 / 0.53 ≈ 7.2 vCPU, and rounds up to the next available size (8 vCPU). Once load subsides and usage drops below 37.5% (1.5 vCPU), the recommender scales back down proportionally.
Memory-based recommendations
ClickHouse Cloud automatically recommends memory sizes based on your service’s actual usage patterns. The recommender analyzes usage over a lookback window and adds headroom to handle spikes and prevent out-of-memory (OOM) errors. The recommender looks at three signals:- Query memory: The peak memory used during query execution
- Resident memory: The peak memory held by the process overall
- OOM events: Whether queries or replicas have recently run out of memory
How headroom is calculated
For query and resident memory, the amount of headroom added depends on how predictable your usage is:- Stable usage (low variation): 1.25x multiplier — more headroom, since usage is consistent and unlikely to spike unexpectedly
- Spiky usage (high variation): 1.1x multiplier — less headroom, to avoid over-provisioning for workloads that already vary widely
Final recommendation
The system takes the highest value across all signals:Two-window recommender
Instead of using a single window, ClickHouse Cloud uses two lookback windows with different time ranges:- Small Window (3 hours): Captures recent usage patterns, enables faster scale-down
- Large Window (30 hours): Ensures we scale up in a single step to the maximum usage seen in the longer lookback window, rather than multiple gradual scale-ups. This is critical because scaling takes time and invalidates local caches; so it is safer to scale up in a single step.