In addition to domain name resolution, DNS has three great uses in architecture design
Generally speaking, what is DNS used for?
As shown in the figure above, DNS is generally used for domain resolution, converting the domain into NG's external network IP so that NG can route HTTP requests to the web-server cluster in the intranet.
In the process of architecture design, does DNS have other uses?
At least it can do these three things.
First: User access nearby.
Through smart DNS technology, it can be easily realized that users can access the required resources nearby.
As shown in the figure above, different users access the same resource:
For telecom users, DNS can return the IP of the telecom computer room;
For Unicom users, DNS can return the IP of Unicom computer room;
For education network users, DNS can return the IP of education network computer room;
In this way, the access speed of all users will be accelerated.
Smart DNS technology is an indispensable part of CDN and multi-computer room multi-active architecture.
Second: horizontal expansion of reverse proxy.
Nginx is generally the entrance of the system. If the throughput of Nginx is 100,000 times per second, how can Nginx on the Google homepage withstand 1 million times per second of concurrency?
Some friends said LVS, some friends said F5, both are correct, but these two are essentially scale up solutions, performance always has limits, and they only treat the symptoms but not the root cause.
The correct solution for the scale out solution is: DNS polling.
As shown in the figure above, on the DNS side, for the same domain, multiple nginx external network IPs are configured. Each time DNS resolves a domain request, the poll returns a different IP, so that nginx can be horizontally expanded, achieving the goal of: 1 NG can handle 100,000 throughput, and 10 NGs can handle 1,000,000 throughput.
Third: web-server load balancing.
Before the emergence of reverse proxy technology, the "DNS round-robin" function can be used to evenly distribute traffic to different web-servers. The advantage of this solution is that the architecture has one less layer of network requests, but the disadvantage is that "DNS round-robin" cannot guarantee the availability of the backend web-server.
In addition to ensuring load balancing, reverse proxy also has the ability to keep alive detection. Therefore, after the emergence of reverse proxy technology, DNS round-robin is no longer needed for load balancing.
In summary, in the process of architecture design, in addition to resolving domain names, DNS can also:
First, smart DNS, access the nearest server based on the user IP;
Second, DNS round-robin, horizontal expansion of the reverse proxy layer;
Third, use DNS to implement load balancing;
Know the facts and the reasons.
Ideas are more important than conclusions.