A feasible solution for high-performance server load balancing

Source: Internet
Author: User

The interviewer is always fond of asking some questions about Server Load balancer. I don't know if they are really involved or self-satisfied. I just want to say, when you deny others' ideas, whether it is better to seriously consider others' ideas than yours.

This means that multiple users request services. The server is a cluster, and a layer of load balancing is added between the customer and the server so that each user can request services normally, in addition, the Server Load balancer can allocate user requests to a suitable server. In this way, the server can work in the optimal state.

But for this problem, most people provide solutions based on socket and epool, but in this solution, a machine will process the load of-Mbps of traffic. Another solution is provided below. Network-based packet capture solution.

Platform: Linux + sugon no-copy Nic

Sugon's zero-Copy Service provides a gigabit nic and a 10-Gigabit Nic. To put it bluntly, the packet capture speed is 10000 Mbps and Mbps.

 
________________________| Clients | -----> | balancer | -------------> | servers | _______ | _________ | ________ |

You can modify data packets to perform load balancing. For example, when a client requests a balancer, the balancer selects an appropriate server for processing based on the situation of multiple servers, and then changes the destination IP address of the data packet to the IP address of the selected server, the target Mac is changed to the MAC of the server, and the source MAC is changed to the MAC of the balancer itself. Then, the modified package can be sent out through the NIC. This package will be processed by the corresponding server. For the packets returned by the server, we change the source IP address to the balancer IP address, the source MAC address to the balancer MAC address, the target MAC address to the client MAC address, and then send the packets through the NIC. In this way, the basic functions of balancer are implemented. Note that we must maintain a client-server correspondence. This correspondence is easy to maintain and highly efficient. In addition, there is no overhead to modify the Mac and IP addresses of data packets.

Now let's take a look at the advantages of this solution over the previous one.

Because the balancer sends and receives packets in two directions, the peak traffic to be processed must be halved. If you use an Eni of Mbps, the two-way processing capability is 5000 Mbps. (The network adapter that can capture the traffic at Mbps is not what I said. We used this network adapter to process the traffic at 7 Gbit/s, because we really cannot get more traffic .) That is to say, such a balancer matches 20 balancer in Socket mode. Further calculate the account. If there were 100 balancer instances, then now only five balancer instances are needed, then the 95 servers saved are not small overhead, however, the cost of electricity and maintenance for 95 servers is also saved.

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.