You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support connection termination for hash based load-balancers
When using long-lived connections (websockets / gRPC) with a hash-based load balancer for the purpose of session affinity between a connection and upstream host, there is a need to be able to kill existing connections during rehashing (host added or removed).
Currently, if a long-lived connection is active and affinitized to a specific host, when rehashing occurs there is a 1/(N hosts) chance of that long-lived connection experiencing a split-brain issue, where the current connection stays active but all new requests are routed to a new/different host.
A simple use case for this is state management on a user / connection basis through the use of a user-id header. If we affinitize all requests (long-lived streams & unary) to a specific upstream host based on the user-id header, we're able to send unary requests directly to the host that also holds the active long-lived connection. This allows us to process the new incoming request and stream data through the long-lived connection. This all works well until we change the host count and rehashing occurs. When rehashing occurs, the long-lived connection stays active on its initial host but new requests can be affinitized to a different host causing the split-brain issue described above. New requests would be forwarded to a different host and said host will not be the "owner" of the long-lived connection.
Supporting connection-termination on rehash ensures that the split-brained long-lived connections would be terminated and affinitized to the appropriate host on reconnect.
@nezdolik sounds great. I think for this it would be good to put together a short design doc before coding. Do you want to take a stab at that and we can discuss?
Support connection termination for hash based load-balancers
When using long-lived connections (websockets / gRPC) with a hash-based load balancer for the purpose of session affinity between a connection and upstream host, there is a need to be able to kill existing connections during rehashing (host added or removed).
Currently, if a long-lived connection is active and affinitized to a specific host, when rehashing occurs there is a 1/(N hosts) chance of that long-lived connection experiencing a split-brain issue, where the current connection stays active but all new requests are routed to a new/different host.
A simple use case for this is state management on a user / connection basis through the use of a
user-id
header. If we affinitize all requests (long-lived streams & unary) to a specific upstream host based on theuser-id
header, we're able to send unary requests directly to the host that also holds the active long-lived connection. This allows us to process the new incoming request and stream data through the long-lived connection. This all works well until we change the host count and rehashing occurs. When rehashing occurs, the long-lived connection stays active on its initial host but new requests can be affinitized to a different host causing the split-brain issue described above. New requests would be forwarded to a different host and said host will not be the "owner" of the long-lived connection.Supporting connection-termination on rehash ensures that the split-brained long-lived connections would be terminated and affinitized to the appropriate host on reconnect.
Relevant Links:
#2819
The text was updated successfully, but these errors were encountered: