By Prashant Mishra, Alibaba Cloud MVP and CEO, Founder Click2Cloud Inc.
A Server Load Balancer is a hardware or virtual software appliance that distributes the application workload across an array of servers, ensuring application availability, elastic scale-out of server resources and supports health management of backend servers and application systems.
Alibaba Cloud Server Load Balancer helps distributes traffic among multiple VM's to improve the service capabilities of your applications.
The Alibaba might be deploying lots of servers in the backend for the UI path. Different servers are deployed in the enterprise infrastructure which is running the same code on the Alibaba UI. Now, how the requests get into each of the servers? For example, a user using the Alibaba website. How does Alibaba know to re-direct a user to an instance? And how the new requests need to go to the new instance? That is when SLB's are useful. SLB helps to clear the traffic on servers and requests every single user to reach to the destination. Alibaba SLB does the routing, for example, the user's request 1 goes to server 1. Request 2 goes to the different server and so on.
Flow of Requests to different servers
All these requests can be from different users or the same user. So, this is server load balancing.
SLB consists of the following components:
SLB instance is a running load balancing service that distributes the incoming traffic to backend servers. To use the SLB service, one must create the SLB instance and then configure the instance with at least one listener and two backend servers.
SLB listener checks the client request and proceeds the request to backend servers according to the configured rules. SLB listeners also perform the health checks (checks whether the two backend servers work properly or not) on the backend server.
Backend servers are the ECS instances added to the SLB instance to process the distributed requests. One can add the ECS instances to the default server group, a VServer group or an active server group for better management.
Overview of SLB Components
Three different commonly used algorithms that companies prefer for setting up an SLB, namely round robin, least connections, and IP hash.
The request of every client goes in a sequence manner where the requests are re-directed to the different services in the Round Robin fashion. So, let's say there are 4 servers in the network as shown in the below diagram. The first request goes to the first server and second goes to the second and so forth. The same fashion is followed for all requests in the feature cycle. So, this is a Round Robin fashion where every server gets a new request every time.
Flow of Round Robin
To do this, the SLB needs to know which processor's which server is having the least number of resources.
Flow of Least Connection
It might take a while for the SLB's to identify which are the servers, which are having the least connections for the least resources. So, it needs to compute, or it needs to get meta-data information from all the servers. So, this might be a little costlier compared to Round Robin fashion.
IP hashing is useful when a client sent a request and the client's request needs to be dedicatedly going to a set of servers. Re-direction can be done based on the client's IP address and only those servers which are specific to that Client's IP will be redirected to that network. This can be another strategy where some specific servers need to be given preference over others.
Flow of IP Hashing
To understand the sticky sessions in SLB, Alibaba is one of the best examples where a user using the Alibaba cart. The user added lots of information into the cart and this cart information is stored in the session which is stored in the client site browser. The browser usually caches all the session information and keeps it and every time a new request is made this session information is shared. The browser keeps the session ID which the server has generated the previous time when a user logged in. The same session id is given every time the request is sent. If the requests are redirected to different servers, then the session id is tending to be lost. Because the first session which was generated by the server 1 might not be visible for the server 2. So, the session information is lost, and users' cart will be disappeared.
This is the problem where a user has sessions which are persisted in their browsers. This is the general use case where a user will have to handle at their application end.
Load Balancer with and without Sticky Sessions
To overcome the problem of session persistence a user can use the common cache, for example, Redis Cache to store their information or need to allow the SLB to go to the same instance every time.
1. Distribute incoming traffic to the network by efficiently distributing requests across multiple servers.
If there are servers which are unavailable or offline then those servers will be removed from the server load balancing setup and the request will not be re-directed to those servers.
So internally the Alibaba SLB maintains the health check of all the available servers, and the requests are redirected only to the available servers.
2. Reliability and high availability are maintained by redirecting requests only to the servers which are available in the network.
3. Ease of use in adding and removing servers in the network as per demand.
For example, let's say Alibaba wants to scale up for a great festival sale or universal sale, which is happening for some special occasion. They know the number of requests which are going to come for the UI is going to be more, so they can scale up and scale down based on the demand. So, Alibaba SLB helps in easily configuring by adding more servers with just a simple configuration change.
When millions of users are accessing the same website during specific time intervals, they face the problems of slow server loading which eventually leads to data loss again and again. In those tricky situations, Alibaba Cloud SLB addresses this issue, distributes all the incoming traffics wisely by creating replicas of servers & overcomes the above said problems. The features of Alibaba Cloud SLB like same-city disaster recovery, traffic distribution, reliability, time management, data security, data flow, cost-effectiveness makes Alibaba SLB more popular to solve server reliability problems.
Alibaba Cloud Product Launch - December 11, 2018
Alibaba Clouder - July 18, 2019
Alibaba Clouder - September 2, 2020
Alibaba Developer - October 24, 2019
Alibaba Clouder - November 10, 2017
Alibaba Clouder - August 24, 2020
Respond to sudden traffic spikes and minimize response time with Server Load BalancerLearn More
Alibaba Cloud Server Load Balancer is built to cope with high volume traffic and each year in November is put to the test during Alibaba’s annual Global Shopping Festival. Alibaba relies on Server Load Balancer to provide uninterrupted service during the festival by switching requests between data centers and transferring transactions to the most available server.Learn More
Deploy custom Alibaba Cloud solutions for business-critical scenarios with Quick Start templates.Learn More
An end-to-end software-defined network solution for multinational enterprises.Learn More
More Posts by PM - C2C_Yuan