feat: add support for multiple labeled clickhouse read clusters#3693
Open
amokan wants to merge 12 commits into
Open
feat: add support for multiple labeled clickhouse read clusters#3693amokan wants to merge 12 commits into
amokan wants to merge 12 commits into
Conversation
… backend adaptor; initial read handling in the connection manager
…troller and apply opts for CH queries to be executed on the proper cluster
djwhitt
reviewed
Jul 17, 2026
djwhitt
reviewed
Jul 17, 2026
Ziinc
requested changes
Jul 20, 2026
Ziinc
left a comment
Contributor
There was a problem hiding this comment.
the config handling of read_cluster_url feels like a code smell, doesn't integrate very well with the label mapping system (which i'm fine with)
Ziinc
approved these changes
Jul 20, 2026
Ziinc
left a comment
Contributor
There was a problem hiding this comment.
still needs the header tweak
`lf-endpoint-clickhouse-read-cluster-label`
…-multiple-clickhouse-read-clusters
…-multiple-clickhouse-read-clusters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why?
Every ClickHouse query currently lands on a single cluster, so a heavy workload such as dashboard log scans or a burst of MCP/agent queries can potentially starve resources away from competing queries.
This change allows multiple read-only clusters to be configured for a backend and queries to be routed using an optional
LF-ENDPOINT-CLICKHOUSE-READ-CLUSTER-LABELheader provided to an endpoint, similar to the existingLF-ENDPOINT-BIGQUERY-RESERVATIONheader. Ultimately allowing us to isolate certain classes of queries to their own backing read clusters.Key Changes
read_only_urlsconfig option as well as adefault_read_clusterlabel to fall back to.opts[:read_cluster]and selects a per-label read pool, running one supervisedConnectionManagerand pool per{backend, label}. This follows the existing BigQuery reservation header → opts → adaptor path.read_only_urlsconfig, behavior is identical to today, so this is a no-op until a backend has opted in to this feature.Additional Notes
read_only_urlconfig option will be removed in a later PR