Server Load balancer Technology for enterprise website servers

Source: Internet
Author: User

With the rapid growth of the Internet, network servers, especially Web servers, need to provide a large number of concurrent access services as the number of visitors increases rapidly. For example, Sohu receives millions of access requests every day. Therefore, CPU and I/O processing capabilities will soon become a bottleneck for servers that provide large-load Web Services.

Under the idea of Server Load balancer, multiple servers are symmetric. Each server has an equivalent status and can provide external services independently without the assistance of other servers. Then, a server Load balancer technology is used to evenly distribute external requests to a server in the symmetric structure, and the server that receives the requests independently responds to the client requests. Because it is not complex to create a web server with the same content, you can use methods such as synchronous server updates or shared storage space. Therefore, Server Load balancer technology becomes a key technology for building a high-load web site. The schematic of the Server Load balancer. Website load balancing policy1. Server Load balancer based on specific server software many network protocols support the "redirection" function. For example, HTTP supports location commands, the browser that receives this command will automatically redirect to another URL specified by location. Since sending location commands is much less load on Web servers than executing service requests, you can design a server with Load Balancing Based on this function. When the Web server considers itself to be overloaded, it will not directly send back the webpage requested by the browser, but return a location command, let the browser go to other servers in the server cluster to obtain the required webpage. In this way, the server itself must support this function, but it is difficult to implement it. For example, how can a server ensure that its redirected server is relatively idle, the location command will not be sent again. Neither the location command nor the browser has the support capability in this aspect. This makes it easy to form an endless loop in the browser. Therefore, this method is rarely used in practical applications, and there are few server cluster software implemented using this method. In some cases, you can use CGI (including FastCGI or mod_perl extension to improve performance) to simulate this method to share the load, while the Web server still maintains a concise and efficient feature, in this case, the user's CGI program is responsible for tasks that avoid location loops. 2. DNS-Based Server Load balancer because the server software-based Server Load balancer needs to change the software, it is often not worth the candle. Server Load balancer should be completed outside the server software, in this way, the advantages of existing server software can be used. The earliest load balancing technology was implemented through random name resolution in the DNS service. In the DNS server, you can configure the same name for multiple different addresses, the client that finally queries the name will get an address when parsing the name. Therefore, for the same name, different customers get different addresses and access the Web servers at different addresses to achieve load balancing. For example, if you want to use three web servers to respond to HTTP requests from www.ghq.net back and forth, you can set the DNS server for the domain to include the 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 external clients may randomly obtain different WWW addresses, then the subsequent HTTP request is sent to different addresses. The advantage of DNS load balancing is that it is simple and easy, and the server can be located anywhere on the Internet. Currently, it is used on websites including yahoo. However, it also has many disadvantages. One drawback is that to ensure the timely updating of DNS data, the DNS refresh time is usually set to a small value, if it is too small, it will cause too much extra network traffic and cannot take effect immediately after the DNS data is changed. The second point is that DNS Server Load balancer cannot know the differences between servers, it cannot allocate more requests to servers with better performance, nor understand the current status of the server, or even the occasional situation where customer requests are concentrated on a server. 3. Reverse Proxy Server Load balancer uses a proxy server to forward requests to internal Web servers. Using this acceleration mode can obviously increase the access speed of static Web pages. Therefore, you can also consider using this technology to allow the proxy server to evenly forward requests to one of multiple internal Web servers, so as to achieve load balancing. This proxy method is different from the common proxy method. The standard proxy method is that the customer uses the proxy to access multiple external web servers. This proxy method is used by multiple customers to access internal web servers, it is also called reverse proxy mode. Implementing this reverse proxy capability is not a very complex task, but it requires a very high efficiency in Server Load balancer. This is not very simple to implement. For each proxy, the proxy server must open two connections, one for external connections and the other for internal connections. Therefore, when the number of connection requests is very large, the load on the proxy server is very large. In the end, the reverse proxy server will become a service bottleneck. For example, when the mod_rproxy module of Apache is used to implement load balancing, the number of concurrent connections provided is limited by the number of concurrent connections of Apache. Generally, it can be used to balance the load of sites that consume a large amount of resources for each connection, such as searching. The advantage of reverse proxy is that it can combine Server Load balancer with the high-speed cache technology of the proxy server to provide beneficial performance and additional security, external customers cannot directly access real servers. In addition, load balancing policies can be implemented to evenly distribute loads to internal servers without the occasional occurrence of Concentrated Loads on a server. 4. Nat-Based Server Load balancer technology converts network addresses to internal addresses and external addresses so that computers with internal addresses can access external networks, when a computer in an external network accesses an external address owned by the address translation gateway, the address translation gateway can forward it to a mapped internal address. Therefore, if the address translation gateway can evenly convert each connection to a different internal server address, then the computers in the external network will communicate with the server on the address they have obtained, this achieves load balancing. Address translation can be implemented through software or hardware. Hardware-based operations are generally called exchanges. When the exchange must save TCP connection information, such operations on the OSI network layer are called layer-4 exchanges. An important feature that allows you to switch the network address of a server Load balancer instance to a layer-4 switch. Because it is based on a customized hardware chip, it has excellent performance, many vswitches claim to have a layer-4 switching capability of mb-800mb. The use of software to achieve Load Balancing Based on Network Address Translation requires a lot of practical, in addition to the solutions provided by some vendors, A more effective way is to use free software to complete this task. This includes the NAT Implementation Method in the Linux virtual server project, or the revised version of natd under FreeBSD. Generally speaking, this software method is used to implement address translation. The bandwidth limit of the central server Load balancer is exceeded. Under the condition of MB of fast Ethernet, the bandwidth can be up to 80 Mb, however, in practice, only 40 mb-60 MB of available bandwidth may be available. 5. In the extended Server Load balancer technology, network address translation is used to achieve load balancing. No doubt all network connections must pass the central server Load balancer. If the load is particularly high, as a result, the number of backend servers is no longer several or more than a dozen, but hundreds or even more. Even hardware switches with excellent performance may encounter bottlenecks. At this point, the problem will be changed to how to distribute multiple servers to multiple locations on each Internet to distribute the network burden. Of course, this can be achieved through the comprehensive use of DNS and Nat methods, but a better way is to use a half-center load balancing method. In this semi-Central Load Balancing mode, when a customer request is sent to the server Load balancer, the central server Load balancer packages the request and sends it to a server, the server's response request is not returned to the central server Load balancer, but directly to the customer. Therefore, the central server Load balancer is only responsible for receiving and forwarding requests, and the network load is low. Similarly, the hardware implementation method of this method is very expensive, but different vendors have different special features, such as SSL support. This method is complex, so it is difficult to implement and has a very high starting point. In the current situation, websites do not need such a large processing capability. In short, we compared the above five load balancing methods, DNS is the easiest and most commonly used to meet general needs. However, if you need further management and control, you can select the reverse proxy or NAT mode. It is important to select the primary dependency buffer between the two methods, the maximum number of concurrent accesses is equal. If the CGI program that has a severe load impact on the website is developed by the website itself, you can also consider using location in the program to support load balancing. The semi-centralized load balancing method is not required at least in the current situation in China.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.