---
title: "Smarter Auto-Scaling for ClickHouse: The Two-Window Approach"
description: "ClickHouse Cloud replaced its single 30-hour lookback window for vertical auto-scaling with a two-window recommender."
url: "https://swe.quest/articles/smarter-auto-scaling-for-clickhouse-the-two-window-approach-5a9450c56fbc9543"
canonical: "https://clickhouse.com/blog/smarter-auto-scaling"
source: "ClickHouse"
published: "2026-03-24"
difficulty: "medium"
kind: "Case study"
reading_minutes: 9
tags: ["capacity-planning","cost-optimization","cloud","analytics"]
---

# Smarter Auto-Scaling for ClickHouse: The Two-Window Approach

A post on [ClickHouse](https://swe.quest/sources/clickhouse.md), published 2026-03-24, 9 min read, Case study. Original: [https://clickhouse.com/blog/smarter-auto-scaling](https://clickhouse.com/blog/smarter-auto-scaling)

## Summary

ClickHouse Cloud replaced its single 30-hour lookback window for vertical auto-scaling with a two-window recommender. A 3-hour window drives fast scale-downs, and a 30-hour window drives single-step scale-ups to the longer-term peak. A merge table chooses between the windows, and a hunting check compares the current and previous small-window recommendations so allocation doesn't flip-flop when usage is rising. The old fixed 2x/0.5x CPU thresholds caused cascading scale-ups and oscillations, so they were replaced with target-tracking. Target-tracking scales to peak usage divided by a target utilization set at the geometric mean of the watermarks, which makes scaling reversible and prevents allocation drift. Scale-down latency fell from 30 hours to 3 hours, with fewer oscillations and lower infrastructure cost.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Capacity planning](https://swe.quest/tags/capacity-planning.md) (Reliability & operations)
- [Cost optimization](https://swe.quest/tags/cost-optimization.md) (Reliability & operations)
- [Cloud platforms](https://swe.quest/tags/cloud.md) (Infrastructure)
- [Analytics & OLAP](https://swe.quest/tags/analytics.md) (Data & databases)

## Prerequisites

- vertical auto-scaling ([easy posts on Scaling](https://swe.quest/tags/scalability.md?difficulty=easy))
- CPU/memory utilization metrics ([easy posts on Hardware](https://swe.quest/tags/hardware.md?difficulty=easy))

## Keywords

ClickHouse Cloud, ClickHouse, target-tracking, two-window recommender

## Related posts

- [Fixed cadence to seconds: making ClickHouse Cloud autoscaling more reactive](https://swe.quest/articles/fixed-cadence-to-seconds-making-clickhouse-cloud-autoscaling-more-reactive-1b4745e879b2e9ce.md): ClickHouse · 2026-08-04 · Medium · 13 min read · Kubernetes, Capacity planning, Go, Analytics & OLAP, Event-driven architecture
  ClickHouse Cloud's vertical autoscaling recommender moved from a fixed timer loop to a controller-runtime based design, so services that hit memory pressure get a recommendation in seconds instead of waiting for the next scheduled pass.
- [Building an Auto-Scaling Lambda based on Github's Workflow Job Queue](https://swe.quest/articles/building-an-auto-scaling-lambda-based-on-github-s-workflow-job-queue-4077ceef4fa411b3.md): ClickHouse · 2023-06-15 · Medium · 2 min read · CI/CD, Capacity planning, Cloud platforms, Serverless, Cost optimization
  ClickHouse replaced CloudWatch-alarm-based EC2 Auto Scaling for its self-hosted GitHub Actions runners with a Lambda that reads the workflow job queue, built from GitHub webhook events stored in ClickHouse, and sets desired capacity directly.
- [How Modal uses ClickHouse to power real-time observability for AI workloads](https://swe.quest/articles/how-modal-uses-clickhouse-to-power-real-time-observability-for-ai-workloads-a1efae326a0a9591.md): ClickHouse · 2025-11-05 · Medium · 6 min read · Analytics & OLAP, Observability, Stream processing, Scaling
  Modal powers three customer-facing observability dashboards (function scaling, per-call timeline, latency percentiles) from a single ClickHouse Cloud table ingesting 1–2 million events per minute and holding ~500 billion logs.
- [Make Before Break - Faster Scaling Mechanics for ClickHouse Cloud](https://swe.quest/articles/make-before-break-faster-scaling-mechanics-for-clickhouse-cloud-160bec81b6592a0e.md): ClickHouse · 2025-04-02 · Medium · 17 min read · Kubernetes, Scaling, Deployment, Scheduling, Analytics & OLAP
  ClickHouse Cloud replaced rolling-restart vertical scaling with Make-Before-Break (MBB) scaling: new, correctly sized replicas are added before old ones are removed.
- [How SolarWinds uses ClickHouse BYOC for real-time observability at scale](https://swe.quest/articles/how-solarwinds-uses-clickhouse-byoc-for-real-time-observability-at-scale-39448c307e0eeb75.md): ClickHouse · 2025-03-11 · Medium · 5 min read · Analytics & OLAP, Performance engineering, Observability, Cloud platforms
  SolarWinds ingests about 3 million telemetry messages per second, roughly 550 MB/s with 1 GB bursts, into ClickHouse ReplacingMergeTree tables.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
