Enabling Sticky Session to Improve Accelerate Access
In e-commerce shopping and user login systems, maintaining a sticky session between the client and server is crucial for a seamless user experience. If requests from the same client are distributed to different backend servers, users may need to log in to different servers or operation progress may be interrupted. To address these issues, you can enable sticky session for a backend server group, so that the load balancer can identify the characteristics (such as IP addresses and cookies) of client requests and distribute requests with the same IP address or cookie to the same backend server. This can improve access efficiency and user experience.
Sticky Session
Backend Server Group Protocol |
Load Balancing Algorithm |
Sticky Session Type |
---|---|---|
|
Weighted round robin |
Source IP address |
Weighted least connections |
Source IP address |
|
Source IP hash |
Not supported |
|
|
Weighted round robin |
|
Weighted least connections |
|
|
Source IP hash |
Not supported |
|
QUIC |
Connection ID |
Source IP address |
Sticky Session Type |
Description |
Stickiness Duration (Minutes) |
Scenarios Where Sticky Session Become Invalid |
---|---|---|---|
Source IP address |
The source IP address of each request is calculated using the consistent hashing algorithm to obtain a unique hashing key, and all backend servers are numbered. The system allocates the requests from a client to a particular server based on the generated key. This allows requests from the same IP address are forwarded to the same backend server. |
|
|
Load balancer cookie |
The load balancer generates a cookie after it receives a request from a client. All the subsequent requests with the same cookie are distributed to the same backend server. |
|
|
Application cookie |
The application deployed on the backend server generates a cookie after receiving the first request from the client. All subsequent requests with the cookie are routed to the same backend server. |

- If you set Load Balancing Algorithm to Source IP hash, you do not need to manually enable and configure Sticky Session. Source IP hash allows requests from the same client to be directed to the same server.
- If you set Load Balancing Algorithm to Weighted round robin or Weighted least connections, you need to manually enable and configure Sticky Session.
Constraints
- If you use Cloud Connect connection, Direct Connect or VPN to access ELB, you must select Source IP hash as the load balancing algorithm and disable sticky sessions for ELB.
- Sticky session is enabled by default and is not shown for QUIC backend server groups.
- Dedicated load balancers support Source IP address, Application cookie, and Load balancer cookie.

- Application cookie will be available in more regions. You can see which regions support them on the console.
- For HTTP and HTTPS listeners, enabling or disabling sticky sessions may cause few seconds of service interruption.
- If you enable sticky sessions, traffic to backend servers may be unbalanced. If this happens, disable sticky sessions and check the requests received by each backend server.
Enabling or Disabling Sticky Session
- Go to the backend server group list page.
- On the Backend Server Groups page, locate the backend server group and click Edit in the Operation column.
- In the Modify Backend Server Group dialog box, enable or disable Sticky Session.
If you enable it, select the sticky session type, and set the session stickiness duration.
- Click OK.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot