Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

ClickHouse 19 min read Deep dive mediumAdept

Building a Distributed Cache for S3

ClickHouse Cloud adds a distributed cache that turns the per-node filesystem cache into a shared network service, so every compute node can read hot table data that any other node has fetched. Hot data caching evolved from the OS page cache on local disks, to per-node SSD filesystem caches in front of S3, to this shared layer. Per-node caches went cold whenever nodes were added, replaced or resized, and object storage tail latency (~500 ms) cannot be hidden by parallelism. Intra-zone network latency of 100–250 µs and multi-GB/s throughput make a shared cache feasible, and benchmarks show it beating a self-managed SSD server even from a cold start.

Related posts

  • Observing in style: How Poizon rebuilt its data platform with ClickHouse Enterprise Edition

    ClickHouse mediumAdept

    Poizon moved its distributed-tracing observability store, which ingests petabytes of trace data daily, from self-hosted single-replica ClickHouse on cloud disks to ClickHouse Enterprise Edition on Alibaba Cloud. The new setup separates storage and compute: SharedMergeTree keeps data in object storage, compute nodes are stateless, and new nodes join via Keeper metadata sync without pausing writes or resharding. Writes are spread across nodes with round-robin, switching to weighted round-robin during restarts, and queries use parallel replicas and tuned ORDER BY keys. Reported results are up to 20M rows/sec ingest, up to 2.5x faster queries in some cases, more than 70% lower storage cost and about 60% lower overall infrastructure cost.

  • 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.

  • ClickHouse Newsletter October 2022: A cloud has arrived

    ClickHouse mediumAdept

    ClickHouse Cloud entered public beta, storing data on shared object storage reachable by all nodes, so users no longer configure replication, sharding or rebalancing, and storage costs less than on block storage. Version 22.9 adds an experimental `annoy` ANN vector index, a KeeperMap table engine, `insert_quorum = auto`, INTERSECT/EXCEPT DISTINCT and an official TypeScript Node.js client. The query-of-the-month section shows that more threads can hurt. An S3 insert with `max_threads = 100` exhausts memory, while 4 threads beat autodetection by 33%. Under concurrent load, `max_threads = 1` tripled throughput from 3.8 to 13.1 QPS.

  • A Quadrillion Rows across three Clouds: scaling LogHouse

    ClickHouse mediumAdept

    LogHouse, ClickHouse Cloud's internal logging platform, has grown to 431 PiB uncompressed (27 PiB on disk) and 1.59 quadrillion rows across 36 cells in 33 geoshards on three clouds, ingesting up to 80 GiB/s and 190M rows/s. Writes stay local to each region, with busy regions split into cells keyed by source Kubernetes cluster. Async Inserts cut part creation by 4–24x, and the largest tables moved from monthly to daily partitions once parts hit the max merge size. OTel collectors spill failed batches to S3 so that outages cause delay rather than data loss. On the read side, a three-level Distributed table hierarchy (global, regional, local SharedMergeTree) with region-named shards for pruning gives users one endpoint and sub-second cross-cloud queries.

  • Announcing On-Demand Compute: Instant compute for your most intensive workloads

    ClickHouse easyNovice

    ClickHouse Cloud On-Demand Compute, now in private preview, lets a query run on a shared pool of ClickHouse workers outside the service's own cluster by setting make_distributed_plan and distributed_plan_workers_num. It uses a new multistage distributed execution framework and a cost-based optimizer. Workers are leased for at least 60 seconds and reused by later queries without cold start, and concurrent queries share workers so the pool grows to the largest single request. On TPC-H SF10, it beat a 5-node autoscaling cluster on complex queries and matched it at 25 concurrent queries using 50% less compute, though short simple reads still favor the stateful cluster.

The quest for software engineering knowledge.

Look:
Layout: