Skip to content

Support stateful session affinity for weighted clusters to support use-cases like canary deployment #24741

Open

Description

@sanjaypujare

Title: Support stateful session affinity for weighted clusters to support use-cases like canary deployment

Description:
Currently cookie based stateful session affinity is implemented (see #18207) but it only works within a cluster. When multiple clusters are used for a service and the user would like to maintain session affinity across clusters then it doesn't work.

e.g. client sends a request R1 and Envoy routes it to cluster C1 host C1H1. Envoy inserts a cookie in the response to maintain session affinity to H1. Client copies the cookie value in the next request R2 and because weighted-clusters (canary deployment) is in use, Envoy picks cluster C2 for R2 but the cookie is meaningless for C2 so Envoy picks a new host C2H2 and session affinity is broken. What we want is that Envoy should pick cluster C1 for R2 (because the cookie also has the cluster name encoded in it) and within C1 it should route R2 to C1H1.

[optional Relevant Links:]
istio/api#2469 (comment)
istio/api#2469 (comment)
istio/api#2469 (comment)
istio/api#2469 (comment)

CC @wbpcode

Activity

  1. added
    enhancement
    triage
    on Jan 3, 2023
  2. added
    help wanted
    and removed
    triage
    on Jan 4, 2023
  3. wbpcode commented on Jan 4, 2023

    @wbpcode
    Member

    sound reasonable requirement.

  4. sanjaypujare commented on Jan 4, 2023

    @sanjaypujare
    ContributorAuthor

    sound reasonable requirement.

    Any plans to address it? I am asking based on your comments in istio/api#2469

    We have users who are requesting this feature in Envoy.

  5. wbpcode commented on Jan 4, 2023

    @wbpcode
    Member

    Sorry, I have no bandwidth for this temporarily. I can add this to my TODO list.
    Or are you willing or have time to do some contributions?

  6. sanjaypujare commented on Jan 4, 2023

    @sanjaypujare
    ContributorAuthor

    Sorry, I have no bandwidth for this temporarily. I can add this to my TODO list. Or are you willing or have time to do some contributions?

    No, I cannot do this either. Let's see if we can find some volunteer

  7. adisuissa commented on Dec 6, 2023

    @adisuissa
    Contributor

    Here's the design proposal for supporting this feature.

  8. wbpcode commented on Dec 9, 2023

    @wbpcode
    Member

    ooh, thanks very much for you taking over this @adisuissa. I added two comments to the way to mutate the cluster, and the format.

  9. Tratcher commented on Aug 21, 2024

    @Tratcher

    I also need this in my service. @adisuissa, any progress, or should I try to do it?

  10. markdroth commented on Mar 12, 2026

    @markdroth
    Contributor

    Note that gRPC has already implemented this feature; see gRFC A60 for the design.

    As discussed in #30678, we should keep the Envoy impl compatible with gRPC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/http_filterenhancementhelp wanted

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions