Alibaba Cloud provides the Layer-4 (TCP protocol and UDP protocol) and Layer-7 (HTTP protocol and HTTPS protocol) load balancing services. Deployed in clusters, Server Load Balancer can synchronize sessions to protect the ECS instances from single points of failure (SPOFs). This improves the redundancy and guarantees the service stability.
Layer 4 uses the open source software LVS (Linux Virtual Server) with keepalived to achieve load balancing, and also makes some customization to it according to the cloud computing requirements.
Layer 7 uses Tengine to achieve load balancing. Tengine is a Web server project sponsored by Taobao. Based on Nginx, Tengine adds a wide range of advanced features dedicated for high-traffic websites.
As shown in the following figure, the layer-4 load balancing in each region is actually run in a cluster consisting of multiple LVS machines. The cluster deployment model greatly guarantees the availability, stability and scalability of the load balancing services in abnormal circumstances.
Additionally, the LVS machine in the LVS cluster uses multicast packets to synchronize sessions to other LVS machines. As shown in the following figure, the session A established on LVS1 is synchronized to other LVS machines after three packets are transferred. In normal situations, the session request is sent to LVS1 as the solid line shows. If LVS1 becomes abnormal or is being maintained, the session request will be sent to other machines that work normally, as the dotted line shows. In this way, you can perform hot upgrades, machine failure maintenance, and cluster maintenance without affecting business applications.
Note: When the connection is not established (three-way handshake is not completed), or a connection has been established but the session synchronization mechanism is not triggered, the hot upgrade does not guarantee that the connection is not interrupted and the client needs to re-initiate the connection.