Enterprises with a large number of users often face the following problems: in the case of high concurrency, the response speed of the server is often slow, and in severe cases, the server will directly stop serving. At this time, the business of the enterprise will be interrupted and the normal visit of customers will be affected.
Load balancing came into being.
& ltu> requirements: The minimum requirement for this lab is two cloud servers ECS.
The above figure creates two cloud server ECS instances and one load balancing instance, each with its own flexible IP address.
Enter the flexible IP access of two cloud server ECS in two pages of the browser.
Comparing the visit results of two ECS, it is found that the content of the deployed websites is the same, but the IP of the back-end server is different.
In the Alibaba Cloud login interface, select the user login using RAM.
Log in to the Alibaba Cloud Management Console with the username and password provided by the lab.
& ltimg src = " https://upload-images . jinshu . io/upload _ images/20425542-fa 1 a 73 a6 DC 138 f 09 . png? Imagemogr2/auto-orient/strip% 7c image view 2/2/w/ 1240 "alt =" 4. Log in. png " style = " zoom:50%;" /& gt;
& ltimg src = " https://upload-images . jinshu . io/upload _ images/20425542-4d 17 f 4b 440 d7c 9 a 5 . png? Imagemogr2/auto-orient/strip% 7c image view 2/2/w/ 1240 "alt =" 5. Log in. png " style = " zoom:50%;" /& gt;
After logging in, click Products and Services in the left navigation bar to select Load Balancing.
& ltimg src = " https://upload-images . jinshu . io/upload _ images/20425542-3 bad 79d 4 DD fed 80d . png? imagemogr 2/auto-orient/strip % 7 cimageview 2/2/w/ 1240 " alt = " 6 . png " style = " zoom:67%;" /& gt;
A. Click the instance management on the left in the console, and see the public network service address with load balance in the red box on the right page.
The public network service address is the elastic IP address of the load balancing instance.
B. Enter the public network service address of A in the browser and visit it.
You can see that the IP suffix of the backend server is 13 1(ECS-2), but when we refresh again, the following figure appears.
The IP mantissa of the backend server becomes 130 (the second ECS- 1).
When we constantly refresh, we will find that the back-end server IP is actually converted between the internal and external addresses of these two EC.
Because the weights of the two EC we configured in the second step are the same.
Next, we try to change the weights of the two ECS to see how it works.
A enter the console-select Load Balancing-Instance Management-click Enter Instance-Default Server Group to enter as shown in the figure below.
B. Check both servers-click Modify Weights.
C. Set the weight to 30,90, and the effect is as follows.
D. in the browser, refresh the page with multiple load balancing service addresses, and count the back-end server IP of the page.
It can be found that every 4 refreshes, there will be 3 accesses to the ECS instance with the weight of 90 and 1 access to the ECS instance with the weight of 30.
Users can adjust the request distribution of the load balancer according to the actual situation. Generally, the weight of high-configuration server settings is increased and the weight of low-configuration server settings is decreased. In this way, it can avoid the occurrence of service anomalies caused by high concurrency and low configuration server pressure.
A. Instance Management Interface-Monitoring-Modify Monitoring Configuration
B. Click Modify
C. Turn on session holding, and optionally modify the session holding timeout.
D. Click Next in turn, without modification.
E. Enter the IP address with balanced load in the browser again and refresh it several times. It is found that during the timeout period of session maintenance, requests will only be distributed to one ECS (which ECS is not specified). After the timeout, it will be distributed according to the weight ratio.
A. input examples
B. Lock the aperture
& ltimg src = " https://upload-images . jinshu . io/upload _ images/20425542-e 7 D5 f 08534 CD 1938 . png? imagemogr 2/auto-orient/strip % 7 cimageview 2/2/w/ 1240 " alt = " 28 . png " style = " zoom:67%;" /& gt;
C. Return, as shown in the figure below, and ECS-2 is closed.
D. On the Monitoring page and the Instance Management page, the running status is abnormal.
E. refresh the IP address with load balancing in the browser again. At this point, the request is sent to ECS- 1, and the health check status is normal.