Repository navigation
Add health-aware, retrying, stable round-robin load balancing - #4
Merged
Merged
Conversation
The subscribe-side proxy previously round-robined across every node in the service index with no health awareness and no failover: dead nodes stayed in rotation, a failed pick dropped the client, and the node list was rebuilt from an unordered HashMap each connection so the counter didn't map to a stable node. - Track a local-only `last_seen` liveness marker on `NodeInfo`, refreshed on direct contact (outbound gossip sync, reverse-connection registration) and seeded on discovery. It is never gossiped or persisted. - `find_service_nodes` now sorts nodes by id for stable round-robin ordering and drops nodes whose marker is stale, failing open to the full set if every node would otherwise be excluded. - `handle_connection` returns a `ConnectOutcome` distinguishing failures before the client stream is touched (safe to retry) from a consumed client. `run_proxy` retries the next node on the former, bounded by MAX_TUNNEL_ATTEMPTS. https://claude.ai/code/session_01BSwoCES9ZqbGdwCu594Dyj
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.
The subscribe-side proxy previously round-robined across every node in the service index with no health awareness and no failover: dead nodes stayed in rotation, a failed pick dropped the client, and the node list was rebuilt from an unordered HashMap each connection so the counter didn't map to a stable node.
last_seenliveness marker onNodeInfo, refreshed on direct contact (outbound gossip sync, reverse-connection registration) and seeded on discovery. It is never gossiped or persisted.find_service_nodesnow sorts nodes by id for stable round-robin ordering and drops nodes whose marker is stale, failing open to the full set if every node would otherwise be excluded.handle_connectionreturns aConnectOutcomedistinguishing failures before the client stream is touched (safe to retry) from a consumed client.run_proxyretries the next node on the former, bounded by MAX_TUNNEL_ATTEMPTS.https://claude.ai/code/session_01BSwoCES9ZqbGdwCu594Dyj