ClickhouseProblem & solution
Fixed cadence to seconds: making ClickHouse Cloud autoscaling more reactive
Summary
ClickHouse Cloud’s vertical autoscaling recommender originally ran on a fixed timer, creating latency when workloads suddenly increased and services needed resources before the next scheduled pass. The redesign keeps the periodic sweep as a safety net while adding a reactive fast path, using controller-runtime as an event-processing layer with sources feeding a shared rate-limited work queue and reconciler. The queue provides deduplication, exponential backoff, bounded concurrency, leader election, and metrics, while ClickHouse stores near-real-time signals that a polling source reads; the excerpt notes polling sets a floor on reaction speed. The reactive path is rolling out cautiously in observe-only mode, with periodic reconciliation remaining the main driver, and the stated goal is to trigger scale-ups for critical events such as out-of-memory conditions in seconds rather than waiting for the next scheduled run.
Context
The original recommendation service processed every service on a fixed schedule. This made scale-up decisions wait until the next scheduled pass, even after urgent events such as an out-of-memory condition. The periodic sweep also remains important for continuously verifying usage, adjusting resources, and scaling down when reasonable to avoid paying for unused capacity.
Approach / What changed
The orchestration layer was rebuilt around controller-runtime. A periodic source and a reactive source feed one shared rate-limited work queue, which deduplicates service keys, applies exponential backoff, and bounds concurrency before a shared idempotent reconciler determines the appropriate service size. Near-real-time signals are read from a ClickHouse table through polling, while periodic reconciliation remains the safety net. The reactive path is being introduced in observe-only mode before it drives decisions.
Takeaways
The shared controller-runtime queue separates trigger logic from job-processing concerns, so periodic and reactive sources do not need to coordinate deduplication, retries, or concurrency themselves.
The signal source polls a table rather than consuming a push stream, making its polling interval the lower bound on reaction speed; a restart does not permanently lose an event because later queries can enqueue the service again.
The design favors idempotent, inexpensive recomputation and periodic self-correction because signal volume is modest; guaranteed delivery, strict ordering, or stateful-window correlation would likely require a dedicated streaming platform.
Source and freshness
- Source
- clickhouse.com
- Published
- Added to Yomu
- Last updated
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.