Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the load balance of large-scale website Architecture Design

2025-04-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

Many novices are not very clear about how to achieve load balancing in the architectural design of large-scale websites. in order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can get something.

Load balancing (Load Balancing) is based on the existing network structure. It provides a cheap, effective and transparent way to expand the bandwidth of network devices and servers, increase throughput, enhance network data processing capacity, and improve network flexibility and availability.

A sharp weapon for load balancing of large websites

Global load balancing system (GSLB)

Content caching system (CDN)

Server load balancing system (SLB)

The basic process of DNS domain name resolution

Initial load balancing solution (DNS polling)

Advantages

There is basically no cost, because often this kind of resolution by domain name registrars is free of charge.

Deployment is convenient. In addition to the simple expansion of the network topology, the newly added Web server only needs to add a public network IP.

Shortcoming

Health check, if a server is down, the DNS server is unknowable, and access will still be assigned to this server. It takes at least 3-4 hours or even longer to modify DNS records to take effect.

The distribution is uneven, and if the configuration of several Web servers is different, the pressure they can withstand is different, but the access allocated by DNS resolution is evenly distributed. The unbalanced distribution of user groups leads to the imbalance of DNS parsing.

Session persistence, if it is a site that requires authentication, can be fatal without modifying the software architecture, because DNS parsing cannot persistently assign the access of authenticated users to the same server. Although there is a certain local DNS cache, it is difficult to ensure that the local DNS does not expire during user access, and re-query the server and point to the new server, then the user information saved by the original server can not be brought to the new server, and may be required to be re-authenticated, switching back and forth for a long time, each server saves different information of users, which is also a waste of server resources.

Global load balancing system (GSLB)

advantage

Data center redundant backup

Multi-site traffic optimization

Ensure user experienc

The principle of Global load balancing system (GSLB)

There are many DNS inspection tools online. If you are interested, you can search for them.

Content caching system (CDN)

Static acceleration of content caching system (CDN)

Dynamic acceleration of content caching system (CDN)

Characteristics of dynamic acceleration

Intelligent routing

Transmission Control Protocol (TCP) optimization

HTTP preload

Server load balancing system

Application background

Rapid growth of access traffic

The volume of business is increasing.

User demand

Want to get 7 × 24 uninterrupted availability and faster system response time

Load balancing must meet performance, scalability and reliability

Three access modes of server load balancing system

Common scheduling algorithms for Server load balancing system

Polling (Round Robin)

Weighted polling (Weighted Round Robin)

Minimum connection (Least Connections)

Weighted least connection (Weighted Least Connections)

Health check the purpose of the health check algorithm is to check the health of the real server in the server farm through some probe mechanism, so as to avoid distributing the client's request to the malfunctioning server, so as to improve the HA ability of the business.

At present, the commonly used health check algorithms:

Ping (ICMP)

TCP

HTTP

FTP

System acceleration

Optimization features-SSL acceleration

Optimization function-HTTP compression HTTP compression is a method of transferring compressed text content between Web servers and browsers. F5 HTTP [Compression Technology] (https://zm10.sm-tc.cn/?src=l4uLj8XQ0IWXlpuekNGdnpabitGckJLQjJqejZyXwIiQjZvC2rrK2se62se92rrI2r282r7G2rrJ2se%2B2sfP2rrJ2sa82r652ZmNwo6doIyano2cl6Cah5%2FZlprCiouZxw%3D%3D&uid=96961868b00c02996d71d0627348e454&restype=1&from=derive&depth=2&v=1&link_type=12) reduces [application delivery] (https://zm10.sm-tc.cn/?src=l4uLj8XQ0IWXlpuekNGdnpabitGckJLQjJqejZyXwIiQjZvC2rrK2r2%2B2sbL2rrI2sbL2r7H2rrL2r2%2B2r7L2rrL2r292sbH2ZmNwo6doIyano2cl6Cah5%2FZlprCiouZxw%3D%3D&uid=96961868b00c02996d71d0627348e454&restype=1&from=derive&depth=2&v=1&link_type=12) time and optimizes bandwidth) through BIG-IP systems with intelligent compression capabilities. HTTP compression uses a general compression algorithm to compress HTML, JavaScript, or CSS files. The biggest advantage of compression is that it reduces the amount of data transmitted through the network, thus improving the access speed of the client browser. Optimization function-connection reuse

Optimization function-TCP cach

Session persistence session persistence-client source IP session persistence source IP address session persistence means that connections or requests from the same source IP address are considered to be the same user, and these connections / requests from the same source IP address are forwarded to the same server during the session persistence period according to the session persistence policy. Session persistence-Cookie session persistence when load sharing cannot be achieved by using session persistence based on source address, for example, the source IP address of the connection request from the client is relatively fixed, and such problems can usually be caused by session persistence based on the application layer. Cookie usually exists in the HTTP header, and now HTTP-based applications are widely used. Therefore, Cookie-based session persistence appears more and more in server load balancing solutions. Limitations: invalid for non-HTTP protocols, or Cookie disabled for clients. Session persistence-URL hash (Hash) Hash session persistence one of the basic concepts of session persistence is to choose which server to assign requests to based on a Hash factor and the calculated results of how many servers exist in the background. The characteristic of hash session persistence is that when the health state of the background server does not change, the server to which each specific Hash factor is assigned is fixed. Its biggest advantage is that hash session persistence can not have session persistence table, but only determine which server is assigned according to the calculation results, especially in some cases where the cost of session persistence table query is far greater than Hash computing overhead, using Hash session persistence can improve the processing capacity and response speed of the system.

URL hash session persistence is usually aimed at the application scenario where the Cache server is used in the background, Hash calculation is carried out for URL, and the requests of the same URL are allocated to the same Cache server. In this way, for the Cache server farm in the background, the content stored on each Cache server is different, which improves the utilization of the Cache server.

Case study: Web server judges the URL visited by the user, and redirects the non-https request to the http site. As a result, the user keeps redirecting the 302jump. Reason analysis: using the load balancing SSL acceleration function, we can see that all user requests come from http on the server side. Solution: enable SSL acceleration throughout the station. Case study of Session (2)-user Session loss failure phenomenon: the user submits data on the http site to the https site with the same domain name, and the web program throws the exception of session loss, and the user fails to submit the data. Reason analysis: http and https are considered as two independent services on load balancer devices, resulting in two independent TCP links, which will hit different real servers, resulting in the loss of session. Solution: enable session persistence based on real servers on load balancing devices. Case study (3)-the source IP of the client cannot get the fault: the server cannot get the IP address of the user's external network and sees a large number of IP addresses from the specific network segment of the internal network. Reason analysis: the load balancing device enables the user source address translation (SNAT) mode and modifies the user source IP in the TCP message. Solution: the load balancer device will rewrite the XMQR-for value with the user's public network IP, and the server will obtain the x-forwarded-for value of the request header header in the http protocol as the user source IP. The IIS log displays the user source IP in the form of an installation plug-in. Selection of server load balancing equipment

1. Price factor

Hardware: F5, Citrix, Redware, A10

Software: LVS, Nginx, Haproxy, zen loadbalance

two。 Performance

4ax 7 layer throughput (per bps)

Number of new connections on layer 7 (in CPS)

Number of concurrent connections

Functional module performance metrics (ssl acceleration, HTTP compression, memory Cache)

3. Meet real and future needs

1) if you confirm that the load balancer device is the simplest layer 4 processing for all applications, then the theoretically selected layer 4 performance of the load balancer device is slightly higher than the actual performance requirements.

2) if you confirm that the processing of all applications by the load balancer device is a simple layer 7 processing, then the theoretically selected layer 7 performance of the load balancer device is slightly higher than the actual performance requirements.

3) if both layer 4 and layer 7 applications are processed by the load balancer device, it is recommended to consider the load balancer device according to the performance of the layer 7 application.

4) if you confirm that your application needs complex layer 4 or layer 7 processing, such as strategic distribution according to the address of the client, processing based on the contents of tcp, and processing based on HTTP headers or HTTP messages, then the recommended load balancing device layer 7 performance is twice as high as the real performance requirements.

5) if the load balancer device has mixed complex traffic processing and some functional modules are enabled, then the recommended load balancer device layer 7 performance is 3 times the real performance requirement.

6) considering that the equipment needs to run under light load in order to be more stable, it is possible to increase the performance by 30% on top of the above.

7) if we want to meet the development needs of the next few years, on the basis of the above, we also need to set aside the additional performance needed for future development.

8) due to different architectures of different load balancer equipment manufacturers, some devices may perform better in complex environments. This customer can compare and judge, but generally speaking, the above recommendations are suitable for the equipment of all manufacturers.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report