This article is intended for sharing my experience of what I have learned about Alibaba Cloud Server Load Balancer (SLB) from Alibaba Cloud Academy. Although this is not a new topic to me, I took the ACA course to get my fundamentals right as I believe it is very important. I've also learned a lot of new things, especially topics related to Alibaba Cloud-specific technologies. I gained a deeper understanding on how Alibaba Cloud can help my organization increase its profit by reducing the operating costs.
If you are not familiar with load balancing and scaling, you should browse for free e-learning classes on this subject, and try the Alibaba Cloud Apsara Cloud Certifications to consolidate your knowledge.
Load balancing might seem like a simple concept initially, but this works in conjunction with multiple other services/products, which gives us an opportunity to discuss about some other products.
There are several definitions out there but I would like to explain it in my own terms, it's obvious that primary task is to balance the load (incoming requests between application/servers). To achieve this there are multiple algorithms/methods like Round Robin and Weighted Round Robin.
Based on the OSI model, the level where load balancing is happening varies as described below:
There is also a relatively newer concept in load balancing called Global Server Load Balancing. This method handles the traffic distribution between multiple servers across multiple regions.
I would like to explain my understanding with an example
Think of the above situation where there are 3 clients that want to access your application, but our backend server can take the load of only one Client/Server. In this scenario we have 3 servers named Server 1, Server 2 & Server 3.
Problem: Since all the servers are exposed via different IP's say IP1, IP2 & IP3.
Here we have the Server Load Balancer (SLB) to the rescue. From server side, we have all the IP's mapped to the Server Load Balancer and one public IP exposed. While configuring, we have the option of choosing how we want to distribute the requests to the server. In our scenario, since all the Servers takes the same load, we go with the 'Round Robin' algorithm. This shares all the requests equally.
All clients can now access the Servers over the SLB, preventing the issue of letting each user know what the IP of the SLB is. Also, we can monitor and provide additional security using the SLB IP, which is easier compared to the previous case of 3 IP's
With Alibaba Cloud SLB, this means we have multiple other features available:
OK, enough talk. It's time for a real demonstration.
There are 3 components you need to start with SLB
Login to the Alibaba Cloud Console & Navigate to the ECS Console.
To keep the context of the article I am not going through the creation of ECS instance. You can see that I have two instances named "SLB_BS_1" & "SLB_BS_2" in "Kuala Lumpur" Region.
We will navigate to the SLB Console provided using the quick link provided in the left-hand side menu.
If you are someone like me who haven't created SLB. You will see something familiar to this.
Click on the "Create SLB Instance." You will be redirected to the SLB Console.
If you see there is a minimal configuration during the SLB Creation, options are obvious.
Instance Type: If you choose "Internet" (which is public SLB) you will get charged and If you choose "Intranet" (Private SLB).
Instance Spec: For demonstration purpose I chose the Shared-Performance Instance. Unless prototyping, this "Instance Spec" is not recommended.
Click "Buy Now". Then you console should show something similar to this.
If you click on the SLB's Name, you will see there are no listeners. Click on "Add Listener".
There are 4 steps while creating listener in Alibaba Console.
Here you will select the protocol of your SLB, this decides whether you will be configuring the Layer-4 or Layer-7.
This will be the listening port to your SLB, the incoming traffic to the SLB. To make things simple I kept the same port as in my http web server on ECS Instances. I will leave the rest of the settings to default.
This is where you will associate the ECS instances to the SLB, click on "Add". Under the "Servers Added" section.
Post this you will see a small window slides in with the ECS instances information in that SLB instance region. Click the instances to add
I will keep the "Enable health check" option checked as it gives the summarized information about my ECS Instances.
Click "Next" you will move the "Submit" Screen where all the configuration is checked and you will see success against all the items. Click "Ok."
That's it!! Congratulations, you have configured your first SLB. If you hit the SLB IP, then you should see the Webpage is served from one of the two ECS instances
When I hit for the first time it shows "This is from ECS Instance 02"
When I hit the same URI Again it shows "This is from ECS Instance 01"
I hope this brief tutorial helped understand the concepts and the steps involved in using Server Load Balancer (SLB) on Alibaba Cloud. To summarize,
If you want to learn more about Alibaba Cloud or cloud computing in general, I recommend visiting the Alibaba Cloud Academy, and try the Alibaba Cloud Apsara Cloud Certifications to consolidate your knowledge.
Alibaba Clouder - August 25, 2020
Alibaba Clouder - October 25, 2019
Alibaba Clouder - December 31, 2020
Alibaba Clouder - August 12, 2019
Alibaba Clouder - June 2, 2020
Alibaba Clouder - November 3, 2017
More Posts by Alibaba Clouder