FreeBSD load balancing based on DNS

Source: Internet
Author: User
Tags time limit

You can use the various techniques mentioned above to improve the performance of your Apache server, and you can increase the performance of your Web server by using a method that adds hardware performance. However, the performance of a single server is always limited, especially when the server needs to run a large number of CGI programs, it is impossible to rely on the above adjustment of the server settings to set up a Web site for the entire internet, like Yahoo and other sites like the high load of the website.

In order to build a high load Web site, you must use a distributed structure with multiple servers. The above mentioned combination of using a proxy server with a Web server, or the way two Web servers collaborate with each other, is a multiple-server structure, but in these multiple-server architectures, each server plays a different role and is an asymmetric architecture. The role of each server in an asymmetric server structure is different, for example, a server to provide static Web pages, while the other to provide dynamic Web pages and so on, so that the web design needs to consider the relationship between different servers, once you want to change the relationship between the server, it will make some Web page connection error , is not conducive to maintenance, scalability is also poor.

Another design structure of the multi-server is symmetrical structure, each server in the symmetrical structure has the equivalent status, can provide the service separately without the assistance of other servers. Then, with some technology, the externally sent requests are evenly distributed to each server in the symmetric structure, and the server receiving the connection request responds independently to the customer's request. In this structure, the technology of evenly distributing external requests to the server is called load balancing technology, because it is not difficult to establish a completely consistent Web server, so load balancing technology becomes the key technology to build a high load Web site.

    • DNS-Based load balancing

The first load balancing technique is implemented by random name parsing in DNS services. In a DNS server, you can configure the same name for several different addresses, which are sent to other name servers, and the client that eventually queries the name will randomly use one of the addresses when parsing the name. Therefore, for the same name, different customer opportunities to get different addresses, so different customers access to different addresses of the Web server, so as to achieve load balancing purposes.

For example, if you want to use three Web servers to respond to www.exampleorg.org.cn HTTP requests back and forth, you can set up data about that domain in the DNS server for that domain, including 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

First, define a real name for each computer, and then define the same alias for them. It is also possible to set the same real name (a record) directly for different addresses, but the method of using aliases is easy to manage.

Since the reverse resolution is only for one computer at this time, each Web server needs to redefine the same name using ServerName, or set the order of name resolution to the HOSTS file first and define itself as www in the Hosts file. To ensure that the name settings for each server are consistent.

Subsequent HTTP requests will then be sent to different addresses if the external client is randomly given a different address to the www.

When you use DNS load balancing, you must try to ensure that different client computers can get a different address evenly. Since DNS data is marked with a refresh time, if the time limit expires, other DNS servers will need to talk to the server to regain the address data, and it is possible to obtain different IP addresses. Therefore, in order to make the address can be randomly allocated, it should make the refresh time as short as possible, different local DNS servers can update the corresponding address, so that the address can be random some. However, setting the expiration time too low will result in a significant increase in DNS traffic, resulting in additional network problems. For compromise reasons, the refresh time is typically set to 1 hours.

One of the problems with DNS load balancing is that once a server fails, the client computer that saved the failed server address will not be able to access the server properly, even if the DNS settings are modified in a timely manner, or if you have to wait for enough time (refresh time) to function.

Although there are many problems, it is a very effective practice, currently used in many Web sites, including Yahoo.

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.