Make Before Break - Faster Scaling Mechanics for ClickHouse Cloud
ClickHouse Cloud replaced rolling-restart vertical scaling with Make-Before-Break (MBB) scaling: new, correctly sized replicas are added before old ones are removed. This avoids multi-hour resizes, since graceful eviction can wait up to 60 minutes per pod for long-running queries. It also avoids overloading the surviving replicas while one is out of rotation. Ordinal-based StatefulSets cannot remove arbitrary pods, so the operator was refactored to run one StatefulSet per server pod (MultiSTS). Existing services were migrated live through a dedicated migration controller, a mutex so only one controller reconciles a resource at a time, a partial maintenance mode, and Temporal workflows that batch and track thousands of migrations.
Related posts
- Fixed cadence to seconds: making ClickHouse Cloud autoscaling more reactive
ClickHouse mediumAdept
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. Two sources, a slotted periodic sweep and a reactive poller, feed one rate-limited work queue. The queue provides deduplication, exponential backoff, bounded concurrency and leader election without custom code. The reactive signals live in ClickHouse: a materialized view filters breach rows such as soft memory rejections out of the Prometheus metrics firehose into a small TTL'd table ordered by timestamp, which is polled every few seconds with a cheap five-minute window query.
- A Recap on May/June Stability
Neon mediumAdept
Neon's May and June 2025 incidents were caused by a load surge from agentic AI platforms. Database creation rose more than 5x and branch creation more than 50x. In May, US regions hit Kubernetes scaling limits around 10,000–12,000 concurrent database pods: EKS etcd memory, pod start times, network configuration and API rate limits. Stopgap tuning raised risk until the horizontally scaled "Cells" architecture shipped. In June, branch metadata growth in the Postgres-backed control plane caused query plan drift, vacuum pressure and expensive billing queries. Fixes include stricter limits on every workload dimension, tests with high-branch-count scenarios, defensive query rewrites, moving billing data to an analytical store, and splitting start/suspend hot-path logic into a small isolated service.
- Smarter Auto-Scaling for ClickHouse: The Two-Window Approach
ClickHouse mediumAdept
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.
- Supercharging your large ClickHouse data loads - Part 3: Making a large data load resilient
ClickHouse mediumAdept
Multi-day loads of billions to trillions of rows into ClickHouse can survive transient failures by splitting the input into retryable tasks. ClickPipes covers managed ingestion from Kafka. For other sources, the open ClickLoad script loads Parquet files from object storage. Stateless workers claim file-chunk tasks from a KeeperMap-backed table and insert each chunk into a per-worker staging table via INSERT INTO SELECT. On failure they truncate and retry; on success they move partitions to the target table, giving exactly-once storage without costly mutations or deduplication. The design scales roughly linearly with workers and servers (3→6 servers doubled throughput from 4M to 8M rows/s on a 600B-row load), works with any partition key, and also covers projections and materialized views through cloned staging tables.
- Building ClickHouse Cloud From Scratch in a Year
ClickHouse mediumAdept
ClickHouse Cloud was built in about a year on a "shared everything" architecture: compute and storage are separated, object storage (S3/GCS) is the primary store, and local SSDs handle caching and metadata. Control Plane and Data Plane are decoupled by a REST API façade plus SQS/PubSub for async events. Key infrastructure choices were managed Kubernetes (EKS) over kOps, Cilium over Calico for eBPF-based network isolation, Istio/Envoy SNI routing to get around per-account NLB limits, and shared S3 buckets with per-service subpaths to avoid bucket limits. Auto-scaling uses a Knative-style idler that suspends idle pods and a custom scaler with disruption budgets suited to stateful services. Object storage forced extra work on caching, prefetching and write-cost optimization.