Before you use the Server Load Balancer (SLB) service, you must add one or more ECS instances as backend servers to an SLB instance to process distributed client requests.
SLB virtualizes the added ECS instances in the same region into an application pool featured with high performance and high availability. You can manage backend servers through a VServer group. Each listener can be associated with a specific server group. Each listener of an SLB instance can forward requests to the backend server that has a specific port.
You can increase or decrease the number of the backend ECS instances at any time and specify the ECS instances that receive requests. However, we recommend that you enable the health check function, and there must be at least one normal ECS instance to maintain service stability.
- SLB does not support cross-region deployment. Make sure that the ECS instances and the SLB instance are in the same region.
- You can use different operating systems for the backend ECS instances of an SLB instance, but the applications deployed in the ECS instances must be the same, and the data must be consistent. We recommend that you use the same operating system for better management and maintenance.
- Up to 50 listeners can be added to an SLB instance. Each listener corresponds to an application deployed on backend ECS instances. The listening port of an SLB instance corresponds to the application port opened on the ECS instance.
- You can specify a weight for each ECS instance in the backend server pool. An ECS instance with a higher weight receives a larger number of connection requests.
- If you enable session persistence, the requests distributed to backend ECS instances
may be imbalanced. To solve this problem, we recommend that you disable session persistence
and check if the problem persists.
When traffic is not distributed evenly, troubleshoot as follows:
- Collect the access logs of the web service within a period of time.
- Check if the numbers of logs of backend ECS instances match SLB configurations. For example, if session persistence is enabled, check the access logs for the same IP address. If different weights are configured for backend ECS instances, calculate whether the percentage of access logs matches the weight.
- When an ECS instance is undergoing live migration, the persistent connections of SLB may be interrupted. You can solve this problem by reconnecting them.
Default server group
A default server group contains ECS instances that receive requests. If a listener is not associated with a VServer group or an active/standby server group, requests are forwarded to ECS instances in the default server group by default.
For more information about how to create a default server group, see Add default servers.
Active/standby server groups
An active/standby server group only contains two ECS instances. One acts as the active server and the other acts as the standby server. No health check is performed on the standby server. When the active server is declared as unhealthy, the system forwards traffic to the standby server. When the active server is declared as healthy and restores service, the traffic is forwarded to the active server again.
If you want to distribute different requests to different backend servers, or configure domain name-based or URL-based forwarding rules, you can use VServer groups.
For more information about how to create a VServer group, see Create a VServer group.