Several implementation techniques of load balancing

Source: Internet
Author: User

When the vertical expansion of the Web server becomes expensive or difficult, we need to consider the level of server expansion, namely load balancing technology. There are many techniques for load balancing, which we'll cover here.

1.HTTP redirection

We can do this at the code level by setting access to specific pages such as index.php, setting the location value of the header in the PHP code, and returning the redirect instruction. This is actually the Web application itself to implement.

2.DNS Load Balancing

DNS is responsible for mapping between domain names and IP addresses. The DNS server can act as a scheduler (the common policy for DNS is RR Round Robin mode).

Although the load balancing system based on HTTP redirection is constrained by the performance of the primary site, there is no denying that the scheduling strategy in this scenario is flexible enough that you can implement any scheduling strategy you can think of with a Web application.

In contrast, developing custom scheduling policies for DNS servers is not easy, but DNS server software like bind provides a rich scheduling strategy for you to choose from. The DNS server acts as a coarse-grained request scheduler.

3. Reverse Proxy load Balancing

It works at the HTTP level, which is the application layer in the TCP seven layer structure, so load balancing based on reverse proxy is also called seven-tier load balancing.

This scenario load Balancer server is a bottleneck, this effect with the back-end server content processing time is gradually obvious, it is not difficult to explain that the reverse proxy server forwarding operation itself is a cost, such as creating a thread, and back-end server to establish a TCP connection, accept the back-end server returned processing results , parsing HTTP header information, frequent switching of user space and kernel space, and so on, usually not long, but when the backend server is processing the request is very short, the overhead of forwarding is particularly prominent.

4.IP Layer Load Balancer Lvs-nat

We need load balancing below the HTTP level, which must be done by the Linux kernel, because we want the network packet to be forwarded to the other actual server as early as possible before it enters the process user address space from the kernel buffer. And because the scheduler can be used under the application layer, these load-balancing systems can support more network service protocols, such as Ftp,smtp,dns, as well as applications such as streaming media and VoIP.

DNAT: Reverse NAT, place the actual server in the internal network, and the NAT server as the gateway forwards the packets from the client to the actual server on the internal network (the destination address and port of the packet need to be modified). The more famous example is LVs. The NAT scheduler has a high throughput rate because of its lower overhead of requesting forwarding in the kernel.

But the bandwidth of the NAT server becomes a bottleneck. Fortunately, LVS provides another way of load balancing, which is direct routing.

5. Direct Routing Lvs-dr

Unlike the NAT mechanism, the direct-routed load Balancer Scheduler works on the data link layer, simply by modifying the destination MAC address of the packet, forwarding the packet to the actual server, and, importantly, the actual server's response packet is sent directly to the client without the scheduler. For video sites (response packets far exceed the requested packet). For LVS-DR, once the scheduler fails, you can switch LVS-DR to DNS-RR mode right away

6. IP tunneling

Unlike LVS-DR, the actual server can be Lvs-tun the same WAN segment as the scheduler.

Several implementation techniques of load balancing

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.