Cluster load balancing technology

xiaoxiao2021-03-06  25

Foreword

At present, whether in the enterprise network, the park is still on the web, such as the Internet, the development of traffic is exceeding the most optimistic estimate in the past, the Internet is booming, the new application is endless, even in accordance with the network at the time, it is also very I will feel it. In particular, the core part of each network, the data flow and calculation intensity have caused a single device to not bear, and how to achieve reasonable traffic distribution between multiple network devices that complete the same function, so that there is no one When the equipment is too busy, the other equipment has not fully utilized the ability to deal with handling capacity, it has become a problem, and the load balancing mechanism has also emerged.

Load balancing is built on existing network structures, which provides a cheap and effective way to extend server bandwidth and increase throughput, enhance network data processing capabilities, improve network flexibility and availability. It mainly completes the following tasks: solve the network congestion problem, service is available, realize geographical location; provide users with better access quality; improve server response speed; improve server and other resources; avoid network key parts Single point failure.

definition

In fact, load balancing is not a "balance" in the traditional sense. In general, it is only handed over to multiple places to be brought to multiple places. If it is called "load sharing", it may be better to understand. To be popular, the role of load balancing is like the turntable system, and the task is divided into everyone to complete, so as not to let a person exhausted. However, this sense of balance is generally static, that is, the "round value" strategy defined in advance.

Unlike the turntable day system, dynamic load balancing analyzes the data packets in real time, master the data traffic in the network, and reasonably assign the task reasonably. The structure is divided into local load balancing and geological load balancing (global load balancing), the former one is to do load balancing on the local server cluster, and the latter is to place the pair of different geographic locations, in different networks and The server cluster is loaded with load balancing.

Server clusters Each service node runs a separate copy of a desired server program, such as web, ftp, telnet, or e-mail server program. For some services (such as those running on the web server), a copy of the program runs on all hosts in the cluster, and network load balancing will workload workloads in these hosts. For other services (eg, e-mail), only one host handle workload, for these services, network load balancing allows network traffic to flow onto a host, and moving the communication to other hosts when the host fails.

Load balancing technology implementation

On the existing network structure, load balancing provides a cheap and effective way to expand server bandwidth and increase throughput, enhance network data processing power, and improve network flexibility and availability. It mainly completes the following tasks:

◆ Solve network congestion issues, service is close to provide, realizing geographical location

◆ Provide users with better access quality

◆ Improve server response speed

◆ Improve the utilization efficiency of servers and other resources

◆ Avoiding a single point failure in the network key

The generalized load balancing can set the special gateway and load balancer, or can be implemented by some dedicated software and protocols. For a network load balancing application, from different levels of networks, specific analysis is performed according to the network bottleneck. From the client application as the starting point longitudinal analysis, refer to the hierarchical model of OSI, we divide the realization of load balancing techniques into client load balancing technology, application server technology, high-level protocol exchange, network access protocol exchange, etc.

Load balancing level

◆ Based on the client's load balancing

This mode refers to the client running a specific program in the network. The program passes the running parameters of the server group periodically or irregularly: CPU usage, the disk IO, memory and other dynamic information, and then according to some choice policy. Find the best server that can provide services and send a local application request to it. If the load information acquisition program is currently invalid, find other alternative servers as the service selection. The entire process is completely transparent to the application, and all work is processed at runtime. Therefore, this is also a dynamic load balancing technology. But this technology has a versatility problem. Because each client must install this special acquisition program; and, in order to ensure the transparent operation of the application layer, you need to modify each application, through dynamic link libraries or embedded methods, will pass the client's access request first pass The acquisition program is sent to the server to redirect. For each application, it is almost re-developed, and the workload is relatively large.

So, this technology is only used in special applications. For example, when performing some proprietary tasks, compares the distributed computing power, there is not much demand for the development of applications. In addition, in the Java architecture model, this mode is often used to achieve distributed load balancing because Java applications are performed based on virtual machines, and one intermediate layer can be designed between application layers and virtual machines to process load balancing.

◆ Application server load balancing technology

If the client's load balancing layer is transplanted to a middle platform, a three-layer structure is formed, the client application does not need to do special modifications, and the transparent intermediate layer application server will request the request to the corresponding service node. A more common implementation means is reverse proxy technology. Using the reverse proxy server, the request can be evenly forwarded to multiple servers, or directly return the cache data, such an acceleration mode can improve the access speed of the static web page to a certain extent, thereby reaching the load balancing.

The benefits of using a reverse agent are that the load balancing and the cache technology of the proxy server can be combined to provide beneficial performance. However, it also has some questions, first of all, it is necessary to develop a reverse proxy server for each service, which is not a relaxed task.

Although the reverse proxy server itself can reach high efficiency, for each agent, the proxy server must maintain two connections, an external connection, a pair connection, so for a particularly high connection request, the load of the proxy server It is very big. The reverse agent can perform load balancing policies for application protocols, each time only access the most idle internal server to provide services. However, as the number of concurrent connections increases, the load of the proxy server itself has become very large, and finally the reverse agent server itself will become the bottleneck of services.

◆ Load balancing based on domain name system

NCSA's extensible Web is the first web system that uses dynamic DNS polling technology. Configure the same name for multiple addresses in DNS, so querying the client will get one of the addresses, so that different customers have access to different servers to achieve the purpose of load balancing. This technology is used in many well-known Web sites: including early Yahoo sites, 163, etc. Dynamic DNS polling is simple, no need for complex configuration and management, generally supporting a class UNIX system over bind8.2 to operate, which is widely used.

DNS load balancing is a simple and effective way, but there are many problems.

First, the domain name server cannot know if the service node is valid. If the service node is invalid, the bang name system will resolve the domain name to the node, causing user access to fail.

Secondly, due to the DNS data refresh time TTL (TIME TO LIVE) flag, once the TTL is exceeded, other DNS servers need to interact with this server to re-obtain address data, it is possible to obtain different IP addresses. Therefore, in order to randomly allocate the address, the TTL should be shorter as possible, and the DNS server of different places can update the corresponding address to reach the random access address. However, TTL is set too short, which will increase the DNS traffic, resulting in additional network problems. Finally, it cannot distinguish between the server, and cannot reflect the current operational state of the server. When using DNS load balancing, you must try to ensure that different customer computers can evenly obtain different addresses. For example, user A may just browse a few web pages, and user B may make a lot of downloads, because the domain name system does not have a suitable load policy, it is only a simple turnt equilibrium, it is easy to send user A to load light sites. And the request for B's request to the load has been very heavy. Therefore, in dynamic balance characteristics, the effect of dynamic DNS polling is not ideal.

◆ High-level protocol content exchange technology

In addition to the above-mentioned load balancing methods, there is a technique that supports load balancing capabilities inside the protocol, ie URL exchange or seven-layer exchange, provides a high-level control method for access traffic. Web content exchange technology Check all HTTP headers, performs load balancing decisions based on information within the header. For example, you can determine how to provide services for personal homepage and image data, and redirectivity in the HTTP protocol.

HTTP runs on the highest layer of TCP connection. The client is directly connected to the server by the TCP service of the constant port number 80, and then sends an HTTP request to the server through the TCP connection. The protocol exchange controls the load according to the content policy, not based on the TCP port number, so it will not cause a retention of traffic.

Since the load balancing device is assigned to multiple servers, it can only be established when the TCP connection is connected, and the HTTP request is passed to determine how the load is balanced. When the click rate of a website reaches hundred or even thousands of times per second, the analysis of the TCP connection, HTTP header information, and the delay of the process have become important, and everything possible to improve the performance of these parts.

There are many information useful for load balancing in HTTP requests and headers. We can learn the URLs and web pages requested by the client from this information. Use this information to boot all image requests to an image server, or call the CGI program based on the database query content according to the URL. To a dedicated high-performance database server.

If the network administrator is familiar with the content switching technology, he can use the web content exchange technology to improve the service to a particular customer according to the cookie field of the HTTP header. If some rules can be found from the HTTP request, it is also possible to make full use of various decisions. In addition to the problem of TCP connection tables, how to find the appropriate HTTP header information and the process of making load balancing decisions is an important issue that affects the performance of Web content exchange technology. If the web server has been optimized for image service, SSL conversation, database transaction services, then flow control, using this level will increase the performance of the network.

◆ Network access protocol exchange

Large-scale networks are generally composed of a large number of dedicated technical equipment, such as including firewalls, routers, third, 4-layer switches, load balancing equipment, buffer servers, and web servers. How to organically combine these technical devices, is a key issue that directly affects network performance. Now many switches provide a fourth floors exchange feature, provide a consistent IP address, and map multiple internal IP addresses, for each TCP and UDP connection request, according to their port number, dynamically select an interior Address, forward packets to this address to achieve the purpose of load balancing. Many hardware vendors integrate this technique in their switches, as a function of their fourth-level exchange, generally adopting random selection, with load balancing policies based on the number of servers or response time to allocate the load. Since the address transformation is relatively close to the low layer of the network, it is possible to integrate it in the hardware device, usually such a hardware device is a local area network switch. The current LAN switches so-called fourth layer switched technology is the exchange of virtual connections in accordance with the IP address and TCP port, and directly transmit the packet directly to the respective port of the destination computer. The initial connection request from the outside is associated with the internal plurality of addresses, respectively, which can be exchanged for these already established virtual connections. Therefore, some local area network switches that have the fourth layer exchange capacity can be used as a hardware load balancer to complete the load balancing of the server.

Since the fourth layer is exchanged based on the hardware chip, its performance is excellent, especially for network transmission speed and exchange speed far exceeding the ordinary packet forwarding. However, it is precisely because it is implemented using hardware, so it is not flexible enough to handle load balancing of several most standard application protocols, such as HTTP. The current load balancing is mainly used to solve the problem of insufficient processing capabilities of the server, so it is not possible to give full play to the advantages of high network bandwidth brought by the switch.

The use of the operating system-based fourth layer exchange technology is therefore born. Through open source Linux, the core function of the fourth layer is done in the core layer of the system, and the data processing of IP packets can be performed in a relatively high-efficiency and stable core space, and its efficiency is not much different from the hardware switching of the proprietary OS. At the same time, it can increase the load balancing strategy support of the exchange core at the core layer or user layer, so it is much higher than the hardware system in flexibility, and there is a better advantage.

◆ Transport link aggregation

In order to support the growing high-band wide application, more and more PCs use more fast links into the network. The distribution of traffic in the network is unbalanced, the core is high, the edge is low, the key department is high, and the general department is low. With the significant increase in computer processing capabilities, people have higher requirements for the processing capabilities of multi-work group LAN. When the interior of the enterprise is increasing (eg web access, document transmission and internal network connection), the data interface of the LAN core portion will generate bottleneck problems, and the bottleneck extends the response time of the customer application request. And the local area network has a dispersed characteristic, and the network itself does not protect the server, a unintentional action (plug like a pin) will let the server are disconnected from the network.

Typically, the countermeasures to solve the bottleneck problem are to improve the capacity of the server link, which exceeds the current demand. For example, you can upgrade from fast Ethernet to Gigabit Ethernet. For large companies, upgrade technology is a long-term, promising solution. However, for many companies, when the demand is not too much money to spend a lot of money and time upgrades, the use of upgrade techniques is very small. In this case, link aggregation techniques provide low-cost solutions to eliminate bottlenecks and unsafe factors on the transport link.

Link aggregation techniques, combining multiple lines of transport capacity into a single logical connection. When the original line meets the needs, and the upgrade of a single line is too expensive or difficult to implement, it is necessary to use multi-line solutions. There are currently five link aggregation technologies to "bundle" multiple lines. The synchronous IMUX system works in the bit layer of T1 / E1, and utilizes multiple synchronized DS1 channel transmission data to achieve load balancing.

IMA is another multi-line reverse multiplexing technique, working in the cell level, can run on a platform using the ATM router.

Using the router to implement multi-line is a popular link aggregation technology, the router can assign the packet to each parallel link according to the cache size of the known destination address, or the method of cyclic allocation can also be used. Line distribution packet.

Multiple link PPP, also known as MP or MLP, is a router load balancing technology applied to the PPP package data link. The MP can break the large PPP packet into a small data segment, and then distribute it to a plurality of lines, and can dynamically allocate dial lines based on the current link utilization. This is done although the speed is slow, because the packet segment and additional buffers increase the delay, it can run very well on the low-speed line.

Also, a link aggregation occurs on a server or bridge interface card, which is mapped to the same IP address by multiple ports of the same interface card, and equalize the local Ethernet traffic to achieve increased traffic over the server. . At present, the products on the market have Intel and DLINK multi-port network cards. Generally, 4 100M Ethernet ports are bound to a network card, which greatly improves the network throughput of the server. However, this technology can only be implemented under Win2000 and Linux due to the need for operating system drive layers.

The link aggregation system adds the complexity of the network, but also improves the network reliability, enabling people to use redundant routes on the lines of the critical LAN segments such as servers. For IP systems, VRRP can be considered (virtual routing redundant protocol). VRRP can generate a virtual default gateway address. When the primary router cannot be turned on, the standby router will use this address to continue the LAN communication. In summary, when the performance of the main line is necessary, link aggregation techniques can be employed when the upgrade of single lines is not feasible.

◆ Server clusters with balance strategies

Today, the server must have the ability to provide a large number of concurrent access services, and its processing capabilities and I / O capabilities have become bottlenecks that provide services. If the customer's increase causes the traffic to exceed the range of the server, then its result is inevitable - downtime. Obviously, the limited performance of single servers cannot solve this problem, and one ordinary server can only reach hundreds of thousands of requests per second, and will not handle millions of even more than one second. Request. But if you can make 10 such servers into a system, all requests are allocated to all servers via software technology, then this system completely has millions of or more requests per second. This is the initial basic design idea for realizing load balancing using server clusters.

Early server clusters are usually backed up in the optical fiber mirror card. Let service operators headache is a key server or more applications. Services with large data traffic will not be too low, while the service operators have flowers two servers, but they often only get the performance of a server. The different IP addresses of multiple server network cards into a VIP (Virtual IP address) via address transformation, so that each server is always working. It turns out that the work that needs to be done with a small machine is completed by multiple PC servers. This elastic solution is quite obvious to investment protection - avoiding the huge equipment investment brought by small machine rigid upgrades, and avoiding Repeated investment of personnel training. At the same time, the service operator can adjust the number of servers at any time according to the needs of the business.

Network load balancing improves the availability and scalability of Internet server programs on a web server, FTP server, and other critical task servers. A single computer can provide a limited level of server reliability and scalability. However, by connecting two or more high-grade servers into clusters, network load balancing can provide the reliability and performance required for critical task servers. In order to establish a high-load web site, multiple servers must be used. The combination of proxy servers and web servers mentioned above, or two web servers collaborate, and in the structure of multiple servers, in the structure of these multi-server, each server is different, It belongs to an asymmetric architecture. The role of each server in an asymmetrical server structure is different, such as a server for providing a static web page, while the other is used to provide a dynamic web, and the like. This makes it necessary to consider the relationship between different servers when designing the web page. Once the relationship between the servers will make some web pages, it is not conducive to maintenance, and scalability is also poor.

The network design structure that can carry load balancing is a symmetrical structure, and each server has an equivalent position in a symmetrical structure, and the service can be provided separately without the auxiliary of other servers. Then, the external transmission request can then be uniformly assigned to each server in the symmetric structure evenly, and the server receiving the connection request is independently responding to the customer's request. In this configuration, the Web server is not difficult because the establishment of a Web server is not difficult, so load balancing technology has become a key technique for establishing a high load web site.

In summary, load balancing is a strategy that allows multiple servers or multiple links to jointly assume some heavy calculations or I / O tasks to eliminate network bottlenecks at lower cost, improve network flexibility and reliability.

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

New Post(0)