当前位置:网站首页>Alibaba cloud SLB load balancing product basic concept and purchase process

Alibaba cloud SLB load balancing product basic concept and purchase process

2022-07-05 13:00:00 Jiangxl~

Alibaba cloud SLB Basic introduction and purchase of load balancing products

1.SLB The core concept of load balancing products

1.1.SLB Basic concepts of load balancing

SLB—CLB Official documents :https://help.aliyun.com/document_detail/27539.html

Traditional load balancing SLB, Renamed now CLB(Classic Load Balancer) It is to distribute access traffic to multiple back-end cloud servers according to forwarding policies (ECS example ) Traffic distribution control service .CLB The service capability of the application is expanded , Enhanced application availability .

SLB Load balancing is similar to our common Nginx Load balancing , Distribute the traffic requests of users to multiple back-end applications according to different forwarding rules , Improve the concurrency of websites .

SLB Component part

  • SLB example
    • One SLB The instance runs a load balancing service , Used to receive traffic requests from users , Then forward the request to multiple application servers at the back end , Before we use load balancing , You have to create a SLB example , And add backend ECS Cloud server .
    • amount to Nginx Of server{}
  • monitor
    • Listening is used to check client requests and forward them to back-end servers , Monitoring will also check the health of the back-end server .
    • That is, declare the port number used , amount to Nginx Of server { listen 80; }
  • Back end servers
    • Specific services provided ECS Cloud server

This is the picture below SLB Component part , First you need to buy one SLB example , Then declare the listening port , Last sum ECS Binding .

img

1.2.SLB Renamed CLB

With Applied load balancing ALB(Application Load Balancer) The introduction of , primary Load balancing SLB(Server Load Balancer) Now it's called Traditional load balancing CLB(Classic Load Balancer), Load balancing SLB It is the general name of load balancing product family .

Load balancing SLB The product family includes : Applied load balancing ALB、 Traditional load balancing CLB, As shown in the figure below .

The main reason is ALB The birth of ,ALB It is aimed at cloud native ingress Load balancer for , With the birth of cloud primordial , In order to distinguish from traditional load balancing , will SLB Renamed CLB, Then all load balancing is collectively referred to as SLB.

SLB renamed

1.3.CLB Load balancing is highly available

The load balancing instance adopts cluster deployment , Can achieve session synchronization , To eliminate a single point of failure of the server , Enhance redundancy , Guarantee the stability of the service . The four layers of load balancing pass through LVS(Linux Virtual Server)+ keepalived The way to achieve , Layer 7 load balancing passes Tengine( Launched by Taobao Web Server project , stay Nginx On the basis of , Optimized for the needs of websites with large traffic ) Realization .

In order to provide users with more stable and reliable load balancing services , Alibaba cloud load balancing has deployed multiple availability zones in most regions to achieve cross machine room disaster recovery in the same region . When the primary availability zone fails or is unavailable , Load balancing has the ability to ( about 30 second ) Switch to the standby zone and restore service ; When the primary zone is restored , Load balancing will also automatically switch to the primary zone to provide services .

1) single CLB High availability of instances

Alibaba cloud aims to improve the stability of load balancing , We are in the availability zone A Bought one CLB example , Alibaba cloud will also launch one in the random availability zone in the same region CLB example , Act as a zone A in CLB An alternate instance of , When the zone A In case of failure , spare CLB Load balancing will switch in a very short time , By standby CLB Provide services , When the zone A When you recover , Load balancing will automatically switch back to the availability zone A Provide services .

Here's the picture : We bought a CLB example , It's actually two , Lord CLB In the zone A Services provided in , spare CLB In the zone B Run in , our ECS This means that you can no longer run in the same zone , If our ECS All in the availability zone A Run in , Once available A There's a problem , spare CLB Although it has been switched , But our availability zone B There is no service in ECS, Availability zone B It can't connect to the availability zone A, At this point, the service cannot be accessed , To ensure standby after failover CLB Can also provide normal services , We also need to put some ECS Running in the zone B in , Be a backup CLB After the start of work , You can report to the availability zone B Medium ECS Forward the request .

 single CLB High availability

2) many CLB High availability of instances

If the availability requirements of multiple applications are high , You can use more CLB High availability of instances , Create in multiple regions CLB Load balancing instances and multiple ECS example , according to DNS Polling policy , Forward the request to the nearest CLB For instance , Even if it's because of a regional network failure or poisoning , Requests will also be forwarded to other regions CLB in , Achieve high availability of applications .

Here's the picture : This picture is not comprehensive , It should be said that the spare node in the above figure is also drawn in the figure , many CLB High availability , Even in a certain region CLB There will also be backup in case of failure CLB Take over the job , When the whole area is unavailable , There is another region CLB Providing the same service .

3) Back end ECS Instance high availability

Back end ECS The instance is highly available, that is WEB Node high availability , Just add a few more WEB The node is connected to CLB that will do .

1.4.SLB Load balancing product architecture

1)SLB Product architecture

At present, Alibaba cloud provides layer 4 and layer 7 forwarding .

We manage load balancing instances through Alibaba cloud console , Layer 4 traffic requests will first be forwarded to LVS colony , Then it's forwarded to the corresponding ECS example , Layer 7 traffic requests will also be forwarded to LVS colony , Yes LVS According to the corresponding scheduling algorithm , Forward the request to Tengine colony , Again by Tengine The cluster distributes requests to different ECS example .

Why does the seventh floor request go through the fourth floor LVC? The reason is that when our traffic is large, such as 1000w, One Tengine Nodes can bear 10w Concurrent , Although we can add many nodes , But which node traffic should enter Tengine Well , At this time, a four layer device is needed to control , That is, the flow first enters LVC, from LVS According to the scheduling algorithm , Distribute requests to Tengine, Again by Tengine Handle the request specifically ,LVS There is no concurrency limit , Data exchange through the kernel , Very powerful performance .

2) Network traffic graph

Four layer request : First, the request arrives at the core router , Forward the request to LVS colony , Again by LVS Forward the request to the corresponding ECS example .

Seven layer request : First, the request arrives at the core router , The router forwards the request to LVS colony , from LVS Forward the request to Tengine colony ,Tengine According to the requested protocol type , If it is HTTP Then forward the request directly to the backend ECS, If the protocol type is HTTPS, The request will be forwarded to the certificate server , Finally, forward the request to ECS.

Outgoing traffic : Get out as you enter .

1.5. Functional features of load balancing products

function 4 layer CLB7 layer CLB
Scheduling algorithm CLB Support polling 、 Weighted polling (WRR) And consistency hash (CH) Scheduling algorithm . explain Seven layers CLB Consistency hashing is not supported at this time (CH) Scheduling algorithm .
health examination CLB Will check the health of the back-end server . When the backend server is detected to be in poor health , Will stop sending traffic to it , Then forward the traffic to other back-end servers that are running normally .
Conversation retention CLB Provides session retention . During the lifetime of the session , You can forward requests from the same client to the same back-end server .
Access control CLB Support adding blacklists and whitelists , Flexible control of client access .
High availability CLB Traffic can be forwarded to back-end servers in multiple zones . also ,CLB Multi availability zone deployment has been supported in most regions , When the primary availability zone fails , It can automatically switch to the standby zone to provide services .
Security protection combined with yundun , Can provide 5 Gbps The prevention of DDoS Attack power .
Network type support CLB Provide public and private network type load balancing services . You can create a private network CLB Instance to balance the traffic in the VPC , Or create a public network CLB Instance to balance the traffic from the public network .
Monitoring combines Alibaba cloud monitoring services , You can view CLB Connection number 、 Traffic and other information .
IPv6 Address support CLB Support forwarding from IPv6 Client requests .
Keep a health check-up log CLB The health check log within three days is stored by default . You can open OSS service , Store all health check logs in OSS in , Analyze the reason for the exception of the back-end server .
domain name URL forward CLB7 Layer listening supports configuring domain names and URL Forwarding rules , Can be from different domain names and URL Requests are forwarded to different back-end servers .
Certificate management is for HTTPS agreement , Provide unified certificate management services . The certificate does not need to be uploaded to the back-end server , Decryption is processed in CLB on , Reduce the cost of back-end servers CPU expenses .
SNI Support CLB HTTPS Monitoring supports attaching multiple certificates , Forward requests from different access domain names to different back-end server groups .
Redirect CLB Support HTTP Access is redirected to HTTPS.
WS/WSS Native support WebSocket yes HTML5 A new agreement , Provide two-way communication channels between the client and the server , It can better save server resources and bandwidth and achieve real-time communication .
HTTP 2.0 Native support HTTP 2.0(Hypertext Transfer Protocol Version 2) It's the second version of Hypertext Transfer Protocol , Backwards compatible HTTP 1.X Protocol version , At the same time, the performance is greatly improved .

1.6. Application scenarios of load balancing products

  • Applied to high traffic business
  • Extend the application
  • Eliminate single point of failure
  • Disaster tolerance in the same city ( Multi zone disaster recovery )
  • Cross regional disaster recovery

2. Buy CLB Traditional load balancing

One CLB Instances can be configured with multiple load balancers , But the port can only be unique , One CLB Load balancing can only provide one 80 port , Therefore, different applications need to purchase multiple SLB product .

Find the load balancing product in Alibaba cloud console , Enter the console of the load balancing product .

1642406090394

2.1. Create load balancing CLB example

1642406156712

2.2. Set up CLB attribute

Pay as you go mode , The region is North China 2, And ECS In the same region , If our ECS Need to use the public network IP, Then one must be assigned with IPV4 Availability zone of public address , Availability zone A No more IPV4 The public network address , Select the availability zone here G, Select multiple zones for the zone type , Spare zones also need to be allocated IPV4 Availability zone of public address , Select the availability zone here H.

1642406669266

Set the name of the instance to load balancer , The instance specification is simple , The instance type is public ,IP Version is IPV4, The billing method is charging by traffic , Finally, click buy now .

1642407282532

Confirm order information , Open now .

1642407378677

2.3. Check purchased CLB product

In instance management, you can see all the purchased CLB example .

1642407464452

原网站

版权声明
本文为[Jiangxl~]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/186/202207051241209736.html