ClickHouse Beta: Sticky Routing for Predictable Data Access

Alps Wang

Alps Wang

Sep 16, 2026 · 1 views

Bridging the Replica Gap

ClickHouse's introduction of replica-aware routing is a significant step forward for its Enterprise tier, directly tackling the often-frustrating issue of session and temporary table state inconsistency across replicas. The elegance of the solution, particularly the HTTP header (X-ClickHouse-Replica-Tag) and native SNI override (--tls-sni-override) methods, demonstrates a pragmatic approach to leveraging existing infrastructure. This feature promises to enhance user experience for interactive applications and ETL pipelines by enabling predictable read-after-write consistency, a critical requirement in many data-driven workflows. The technical explanation, detailing the use of Istio/Envoy and the decoupling of SNI validation from routing, provides valuable insight into the implementation's robustness and scalability considerations.

However, it's crucial to acknowledge the 'best-effort' nature of this stickiness. The blog candidly mentions that events like upgrades, restarts, and scaling can disrupt the routing, leading to potential recreation of session-scoped objects. This caveat is paramount for production environments where guaranteed state persistence is non-negotiable. While the feature addresses replica-specific caches, the acknowledgment that distributed caching is the 'better long term answer' suggests that replica-aware routing might be more of an interim solution for certain performance optimizations rather than a fundamental architectural shift for caching. The Enterprise-only availability also limits its immediate broad impact, though it aligns with ClickHouse's tiered service model. The implications for BYOC (Bring Your Own Cloud) customers are positive, extending the benefit beyond managed ClickHouse Cloud instances.

Key Points

  • Replica-aware routing ensures requests are consistently sent to the same replica.
  • Addresses issues with temporary tables and named sessions not persisting across replicas.
  • Enables read-after-write consistency by guaranteeing reads hit the replica that processed the write.
  • Implemented via HTTP header X-ClickHouse-Replica-Tag or native connection's TLS SNI override (--tls-sni-override).
  • Benefits include consistent session state, warmer replica caches, and improved ETL/interactive app reliability.
  • Built on Istio/Envoy proxy layer, leveraging L7 proxy capabilities for request inspection.
  • Native support cleverly uses SNI override to decouple routing hostname from certificate validation hostname.
  • Stickiness is 'best-effort' and can be disrupted by cluster maintenance (upgrades, restarts, scaling).
  • Feature is currently available in public beta for ClickHouse Enterprise customers.

Article Image


📖 Source: Replica-aware routing public beta

Related Articles

Comments (0)

No comments yet. Be the first to comment!