Skip to content

Support sticky_session when using weighted_clusters #29027

Closed

Description

@Schtil

You cannot use sticky sessions when using weighted_clusters.
Any hash_policy and lb_policy are ignored(

Configuration example:

static_resources:
  listeners:
  - name: echo_server
    address:
      socket_address:
        address: 0.0.0.0
        port_value: 8080
    filter_chains:
    - filters:
      - name: envoy.filters.network.http_connection_manager
        typed_config:
          "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
          route_config:
            name: ingress_all_routes
            virtual_hosts:
            - name: echo_server
              domains: ['*']
              routes:
              - match:
                  prefix: /
                route:
                  timeout: 30s
                  hash_policy:
                  - header:
                      header_name: "x-request-id"
                  weighted_clusters:
                    runtime_key_prefix: routing.traffic_split.echo_server-all
                    clusters:
                      - name: echo_server-vm2
                        weight: 50
                      - name: echo_server-vm1
                        weight: 50
clusters:
  - name: echo_server-vm1
    type: STRICT_DNS
    lb_policy: RING_HASH
    dns_lookup_family: V4_ONLY
    connect_timeout: 30s
    load_assignment:
      cluster_name: echo_server-vm1
      endpoints:
      - lb_endpoints:
        - endpoint:
            address:
              socket_address:
                address: localhost
                port_value: 8000
  - name: echo_server-vm2
    type: STRICT_DNS
    lb_policy: RING_HASH
    dns_lookup_family: V4_ONLY
    connect_timeout: 30s
    load_assignment:
      cluster_name: echo_server-vm2
      endpoints:
      - lb_endpoints:
        - endpoint:
            address:
              socket_address:
                address: localhost
                port_value: 8001

And with 50 requests for the format:
curl localhost:8080 --header 'x-request-id: 26efbc98-3b7d-11ee-be56-0242ac120002'
Requests are distributed among two clusters rather than one cluster

Activity

  1. added
    triage
    on Aug 15, 2023
  2. Schtil commented on Aug 15, 2023

    @Schtil
    Author

    I found similar questions
    #7276

    My question is more like a feature request than a bug)

  3. added
    enhancement
    no stalebot
    and removed
    triage
    on Aug 15, 2023
  4. yanavlasov commented on Aug 15, 2023

    @yanavlasov
    Contributor

    This feature has been requested before, however nobody found time to implement it. Marking as a feature request.

  5. Tratcher commented on Aug 28, 2024

    @Tratcher

    Similar to #24741 which uses session affinity.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/load balancingenhancementno stalebot

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions