Construct high-load network sites using load balancing technology

xiaoxiao2021-03-06  114

Blue forest http://www.lslnet.com, September 23, 2000 11:40

Author: Wang Bo

The rapid growth of the Internet enables multimedia web servers, especially the web server, and the number of visits facing, and the network server needs to provide a large number of concurrent access services. For example, Yahoo will receive millions of access requests every day, so the CPU and I / O processing capability will become a bottleneck for a server that provides large load web services.

Simple improvement hardware performance does not really solve this problem, because the performance of a single server is always limited, in general, a PC server can provide approximately 1,000 concurrent access processing capabilities, a more high-grade dedicated server Ability to support 3000-5000 concurrent access, such capacity is still unable to meet the requirements of large loads. In particular, the network request has bursts. When some major events occur, network access will rise sharply, resulting in a network bottleneck, such as Clinton's Bookbook released online is a significant example. You must use multiple servers to provide network services and assign the network request to these server sharing to provide the ability to handle a lot of concurrent services.

When using multiple servers to assume load, the easiest way is to use different servers in different aspects. When divided by the content provided, a server can be used to provide a news page, while the other is used to provide a game page; or can be split by the server to provide a server to provide static page access, and Other dynamic page access to providing a large amount of consumption of resources is required to provide CGI. However, due to the burst of network access, it is difficult to determine that the load caused by those pages is too large, and if the segmentation of the page segmentation will cause a lot of waste. In fact, pages that have excessive load are often changed. If you want to adjust the server in accordance with load changes, it is bound to cause great problems with management and maintenance. Therefore, this segmentation method can only be the adjustment of the large direction. For large load websites, the fundamental solution also needs to apply load balancing technology.

Multiple servers are symmetrical in the idea of ​​load balancing, each servers can provide services separately without providing services for other servers. Then, through some kind of load sharing, the external transmission request is evenly assigned to a certain server in the symmetrical structure, and the requested server is independently responding to the client's request. Since the Web server that establishes is not complicated, you can use a server synchronous update or shared storage space, etc., the load balancing technology is a critical technique for establishing a high load web site.

Based on the load balancing of a specific server software, many network protocols support the "redirect" function, such as supporting the Location instruction in the HTTP protocol, and receives this instruction will automatically redirect to another URL indicated by Location. Since the send Location directive is more than the execution service request, the load of the web server is much smaller, so the load balancing server can be designed according to this feature. At any time, the web server considers that the load is large, it is no longer directly sent back to the browser request, but it feeds back a LocAction command to get the web page to get the web page on other servers in the server cluster. In this manner, the server itself must support this function, but there are many difficulties that are implemented, such as how the server can guarantee that the server is free, and will not send the Location instruction again? There is no support capabilities in this area, so it is easy to form a dead cycle on the browser. Therefore, this way is actually applied, and the server cluster software implemented in this way is small. Some specific cases can be used to simulate this way to divide the load, while the web server remains simple and efficient, and the Web server will remain in the user's CGI program that avoids the Location loop. To undertake. DNS-based load balancing due to the server software is required to change the software, it is often unpaid, and the load balancing is preferably done outside of server software, so that the advantages of existing server software can be used. The earliest load balancing technology is implemented through a random name parsing in the DNS service. In the DNS server, you can configure the same name for multiple different addresses, and the client that finally queries this name will get this name. One of them is. Therefore, for the same name, different clients get different addresses, and they also access the Web server on different addresses to achieve the purpose of load balancing. For example, if you want to use three web servers to respond to HTTP requests for www.exampleorg.org.cn, you can set the data about this domain in the DNS server of this domain. About this domain includes results similar to the following example: WWW1 in A 192.168.1.1

WWW2 in A 192.168.1.2

Www3 in a 192.168.1.3

WWW in cname www1

WWW in cname www2

WWW in CNAME WWW3

Since then, the external client may randomly get the different addresses of WWW, then subsequent HTTP requests are sent to different addresses. The advantage of the DNS load balancing is simple, easy, and the server can be located in any location of the Internet, which is currently used on a Web site including Yahoo. However, it also has many shortcomings, and a disadvantage is to ensure that DNS data is updated in time, generally set less DNS's refresh time, but it will cause too much additional network traffic, and change DNS data. It is not necessary to take effect immediately; the second point is that the DNS load balancing cannot know the difference between the server. It cannot be used as a multi-allocation request for a server with better performance, nor can it understand the current state of the server, and even the customer request is concentrated. The accidental situation on a server. Reverse proxy load balancing Using proxy servers to forward requests to internal web servers, using this acceleration mode clearly enhances access speed of static web pages. Therefore, it is also possible to consider using this technique, allowing the proxy server to uniformly forward the request to one of the multiple internal web servers to achieve the purpose of load balancing. This proxy method is different from the normal proxy method, and the standard agent method is that the customer uses the agent to access multiple external web servers, and this proxy method is a number of customers using it to access the internal web server, so it is also called reverse direction. Proxy mode. Implementing this reverse proxy capacity is not a particularly complex task, but is required to be particularly high in load balancing, so that it is not very simple. Every time a proxy, the proxy server must open two connections, one is an external connection, one is a pair connection, so when the number of requests is very large, the agent load is very large, in the end The reverse proxy server will become the bottleneck of service. For example, when using Apache's Mod_rProxy module to implement load balancing, the number of concurrent connections provided is limited by the number of concurrent connections in Apache itself. Generally speaking, it can be used to use it for a large number of connections, but each connection requires a large number of sites that deplete the resource for load balancing, such as search. The benefits of using the reverse agent are to combine the high-speed cache technology of the load balancing and proxy servers, provide beneficial performance, additional security, and external customers cannot directly access real servers. And implement a better load balancing strategy, which can be distributed to the internal server very balanced, and no load concentration into an accidental phenomenon of a server. NAT-based load balancing technology network address is converted to switch between internal addresses and external addresses, so that the computer with internal address can access the external network, and when the computer accessed the address conversion gateway in the external network The address conversion gateway can forward it to a mapping internal address. Therefore, if the address conversion gateway can uniformly convert each connection to a different internal server address, the computer in the external network is communicated with the server that is converted to the address obtained, thereby achieving the purpose of load balancing. Address conversion can be implemented by software, or by hardware. Using hardware mode is generally referred to as switching, and when the exchange must be saved, this operation of the OSI network layer is referred to as a fourth layer exchange. Network addresses that support load balancing are an important feature of the fourth-floors switch, because it is based on custom hardware chips, there is excellent performance, many switches claim to have 400MB-800MB of fourth floors, but there are some information It shows that most of the switches are no longer available in such a fast speed, but only support the third layer or even the second floors.

However, for most sites, current load balancing is mainly to solve the web server processing capacity bottleneck, not network transmission capabilities, and many sites Internet connection bandwidth is more than 10MB, only very small sites can have higher speed network connections. Therefore, there is generally no expensive equipment such as these load balancers. Using software methods to implement a load balancing based on network address translation, it is necessary to actually, in addition to some manufacturers' solutions, more efficient methods are to use free free software to complete this task. These include NAT implementations in Linux Virtual Server Project, or this author's revision of NATD under FreeBSD. Generally, this software is used to implement address translation, and the center load balancer exists with bandwidth limit. Under 100MB fast Ethernet conditions, it can get a bandwidth of up to 80MB, but in practical applications, only 40MB- 60MB of available bandwidth. Extended load balancing technology uses network address translation to implement load balancing, there is no doubt that all network connections must pass through the center load balancer, then if the load is particularly large, so that the number of servers in the background is no longer a few, ten There are several, but hundreds of or even more, even if you use performance-effective hardware switches, you will also encounter bottlenecks. At this point, the problem will transition to how many servers are distributed to multiple locations of each Internet, and the network burden is dispersed. Of course, this can be achieved by integrated using DNS and NAT, however, a better way is to use a half center load balancing mode.

In this half-central load balancing mode, that is, when the customer requests to send to the load balancer, the center load balancer will pack and send it to a server, and the server's response request is no longer returned »Center load balancer However, it is directly returned to the customer, so the center load balancer is only responsible for accepting and forwarding requests, and its network burden is smaller.

The above picture from Linux Virtual Server Project, the request / response process of this load sharing capability implemented by IP tunnel, at this time, each background server needs to be transformed to deceive browser customers, think it responds. For the correct response.

Similarly, this way is also very expensive, but will have different special functions depending on the manufacturer, such as support for SSL, etc.

Because this method is more complicated, it is more difficult to achieve, its starting point is also very high, and the website does not need such a large handling ability.

Compared with the above load balancing mode, DNS is easier, most common, can meet the general needs. However, if further management and control is required, it can be used in reverse proxy or NAT mode. These two main selection main dependent buffers are not very important, and the maximum number of concurrent access is the conditions. If the CGI program that is very powerful on the website is developed by the website, it can also be considered to support load balancing in the program. The semi-centralized load balancing method is not required in the current domestic situation.

Excerpted from: http://freebsd.online.ha.cn

转载请注明原文地址:https://www.9cbs.com/read-124705.html

New Post(0)