tencent cloud

Feedback

Session Persistence

Last updated: 2023-12-26 10:46:12

    Overview

    The cart service has multiple running Pods, requiring the session persistence feature to ensure that requests from the same user are routed to the same Pod and the user's cart information will not be lost. Session persistence is as shown below:
    

    Directions

    Implement the session persistence feature by setting the DestinationRule loading balancing policy of the cart service, with UserID in the request header for consistent hashing.
    apiVersion: networking.istio.io/v1alpha3
    kind: DestinationRule
    metadata:
    name: cart
    namespace: base
    spec:
    host: cart
    trafficPolicy:
    loadBalancer:
    consistentHash:
    httpHeaderName: UserID
    exportTo:
    - '*'
    After the configuration, click YOUR CART multiple times or ADD TO CART after login to call the cart service to verify whether requests from the same user are routed to the same Pod. The name of the Pod providing the cart service can be viewed in the bottom-left floating window, which is the same for requests from the same user. Requests from the same user are load balanced to the same Pod as shown below:
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support