Session persistence allows requests from the same IP address to be forwarded to the same backend service. By default, ALB routes each request to a different backend service. However, you can use the session persistence feature to route specific requests to the same real server. This enables applications that require session persistence (such as shopping carts) to function properly.
Background Information
For layer-7 protocols (HTTP/HTTPS), session persistence based on Cookie insertion is supported, where ALB implants a Cookie into the client. The session persistence duration can be configured to a value ranging from 30 to 86400 seconds. Session persistence is related to the balancing method.
|
Weighted round robin (WRR) | Requests are distributed based on the weights of real servers. | Supported based on Cookie insertion |
Weighted least connections (WLC) | Requests are comprehensively scheduled based on the server loads and weights. | Not supported |
Configuring Session Persistence
1. Log in to the ALB console. In the left sidebar, choose ALB > Target Group Management. 2. In the target group management list, locate the corresponding target group and click Edit in the Operation column.
3. On the basic information tab, click the edit icon to the right of Session Persistence.
4. In the displayed dialog box, enable Session Persistence, set Persistence Duration, and click OK.