Replica-aware routing public beta
ClickHouse Cloud's replica-aware routing pins requests to a single replica so temporary tables, named sessions, warm local caches and read-after-write consistency work on multi-replica services. Clients opt in with an X-ClickHouse-Replica-Tag HTTP header or, over the native protocol, a TLS SNI override. Envoy, configured through Istio, consistent-hashes either value onto a replica. The native path reuses the existing regional certificate by validating against --host while routing on the SNI, and a Go snippet shows the custom VerifyPeerCertificate needed for that. Stickiness is best-effort and is lost on upgrades, restarts or scaling. It does not isolate workloads and is in public beta for Enterprise tier only.
Related posts
- 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.
- Don't add a read replica until you've read this
incident.io mediumAdeptincident.io moved nearly all Postgres read traffic to a read replica and had to preserve read-after-write consistency without hand-routing each query. Within a request, a Go context flag is tainted on any write or transaction so later reads go to the primary, a simple SELECT-prefix check classifies queries, and a circuit breaker falls back to the primary if the replica is unreachable. Across async boundaries, 0.1–0.5% of queue messages hit NotFound errors because workers ran faster than replication. The fix stamps each message and each mutating API actor (user or API key) with the primary's WAL LSN and checks pg_last_wal_replay_lsn() before reading from the replica. Lagging messages are nacked with exponential backoff, which doubles as backpressure, and replica lag is best monitored in bytes rather than time.
- 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.
- How AdGreetz Processes Millions of Daily Ad Impressions with ClickHouse Cloud
ClickHouse easyNovice
AdGreetz moved its ad impression analytics from AWS Athena to Snowflake and then to ClickHouse Cloud, citing roughly six times lower cost than a small Snowflake standard plan and sub-second rather than multi-second queries. The pipeline ingests 5-6 million impressions a day, peaking at 20-30 million, through Cloudflare Workers. The workers acknowledge each event, enrich it in the background, and insert JSON over HTTP using async inserts, so no Kafka buffering layer is needed. Data is partitioned by time, aggregated with materialized views, isolated per customer with filtering views, and served to partners through Metabase dashboards.
- Building a Paste Service With ClickHouse
ClickHouse mediumAdept
pastila.nl is a minimal paste service whose browser JavaScript sends INSERT and SELECT queries directly to an internet-facing ClickHouse instance. Content is addressed by a 128-bit SipHash plus a 32-bit locality-sensitive fingerprint built from the minimum hash of word shingles. Ordering the primary key by fingerprint keeps similar edits adjacent, so storing every keypress compresses to almost nothing. The schema relies on EPHEMERAL and MATERIALIZED columns and CHECK constraints for hash verification, size limits and entropy-based garbage rejection, and runs on a Replicated database with two-node ClickHouse Keeper across Frankfurt and Ohio behind Route53 geo DNS. The setup deliberately embraces anti-patterns, such as a two-node consensus cluster that loses write availability if either node fails.