Can DNS round robin be completely replaced?

Can DNS round robin be completely replaced?

 

 

Someone will have the following opinion

 

  1. Adding lvs and keepalived to the front end of nginx can replace "DNS polling"
  2. F5 can handle high availability, scalability, and load balancing at the access layer, and can replace "DNS polling"

    Whether "DNS round-robin" is an outdated technology, and whether it can be replaced by other solutions, the technical evolution of the access layer architecture is what this article will discuss in detail.

 

 

 

 

problem domain

 

    Nginx, lvs, keepalived, f5, DNS polling, whenever these technologies are mentioned, the following issues of the access layer are often discussed:

 

  1. Availability: if any machine hangs, the service is not affected
  2. Scalability: Whether the performance of the system can be expanded by adding machines
  3. Reverse proxy + load balancing: whether the request is evenly distributed to the back-end operation unit execution

 

 

 

Technology Introduction

 

    1. nginx : a high-performance web-server and software for implementing reverse proxy

 

    2. lvs : Linux Virtual Server, using cluster technology to achieve a high-performance, high-availability, load-balancing server at the Linux operating system level

 

    3. keepalived : a software used to detect the survivability of service status, commonly used for high availability

 

    4. f5 : a high-performance, high-availability, load-balancing hardware device (sounds similar to lvs?)

 

    5. DNS polling : a technology that expands web-server performance and implements load balancing by setting multiple IP resolutions for a domain name on DNS-server

 

 

 

 

 

Access Layer Technology Evolution

 

 

【Streaking Era > Stand-alone Architecture】

 

  1. The browser resolves the domain name to ip through DNS-server
  2. Browser access web-server through ip

   

    shortcoming

 

  • Non-high availability: web-server hangs up when the entire system hangs
  • Poor scalability: when the throughput reaches the upper limit of the web-server, the capacity cannot be expanded
  • Load balancing: a single machine does not involve load balancing

 

 

 

【Simple Expansion Solution > DNS Polling】

 

       Assuming that the throughput of tomcat is 1000 times per second, when the total throughput of the system reaches 3000, how to expand the capacity is the first problem to be solved. DNS polling is an easy solution:

 

  1. Deploy several more copies of web-server, 1 tomcat can resist 1000, deploy 3 tomcats can resist 3000
  2. At the DNS-server level, the domain name resolves to a different ip each time

    advantage

 

  • Zero cost: just configure a few more IPs on the DNS-server, and the function is not charged
  • Simple deployment: deploy several more web-servers, the original system architecture does not need any modification
  • Load balancing: It has become multiple machines, but the load is basically balanced

 

    shortcoming

 

  • Non-high availability: DNS-server is only responsible for domain name resolution ip. Whether the service corresponding to this ip is available is not guaranteed by DNS-server. If a web-server is down, some services will be affected.
  • Non-real-time capacity expansion: DNS resolution has a valid period
  • Exposed too many external network IPs

 

 

 


 【Simple expansion plan > nginx】

 

       The performance of tomcat is poor, but the performance of nginx as a reverse proxy is much stronger. Assuming that the online runs to 1w, it is 10 times higher than tomcat. This feature can be used for expansion.

 

  1. A reverse proxy layer is added between the site layer and the browser layer, using high-performance nginx as a reverse proxy
  2. nginx distributes http requests to multiple backend web-servers

 

    advantage

 

  • DNS-server does not need to be moved
  • Load balancing: guaranteed by nginx
  • Only one external network ip is exposed, and intranet access is used between nginx->tomcat
  • Real-time capacity expansion: nginx can be controlled internally, and web-server can be added at any time to expand capacity in real time at any time
  • Can ensure the availability of the site layer: any tomcat hangs, nginx can migrate traffic to other tomcats

 

    shortcoming

 

  • Increased latency + more complex architecture: an additional reverse proxy layer is added in the middle
  • The reverse proxy layer has become a single point and is not highly available: tomcat hangs without affecting services, what should I do if nginx hangs? 

 

 

 

 

【High Availability Solution > keepalived】

 

    In order to solve the problem of high availability, keepalived came out

 

  1. Make two nginx to form a cluster, deploy keepalived separately, and set it to the same virtual IP to ensure the high availability of nginx
  2. 当一台nginx挂了,keepalived能够探测到,并将流量自动迁移到另一台nginx上,整个过程对调用方透明


 

 

    优点

 

  • 解决了高可用的问题

 

    缺点

 

  • 资源利用率只有50%
  • nginx仍然是接入单点,如果接入吞吐量超过的nginx的性能上限怎么办,例如qps达到了50000咧?

 

 

 

 

【垂直扩容方案  >  lvs/f5】

 

       nginx毕竟是软件,性能比tomcat好,但总有个上限,超出了上限,还是扛不住。

       lvs就不一样了,它实施在操作系统层面;f5的性能又更好了,它实施在硬件层面;它们性能比nginx好很多,例如每秒可以抗10w,这样可以利用他们来扩容。

 

  1. 如果通过nginx可以扩展多个tomcat一样,可以通过lvs来扩展多个nginx
  2. 通过keepalived+VIP的方案可以保证可用性,99.9999%的公司到这一步基本就能解决接入层高可用、扩展性、负载均衡的问题。


 

    是否完美?

 

       好吧,不管是使用lvs还是f5,这些都是scale up的方案,根本上,lvs/f5还是会有性能上限,假设每秒能处理10w的请求,一天也只能处理80亿的请求(10w秒吞吐量*8w秒),那万一系统的日PV超过80亿怎么办呢?

 

 

 

 

【水平扩容方案  >  DNS轮询】

 

       如之前文章所述,水平扩展,才是解决性能问题的根本方案,能够通过加机器扩充性能的方案才具备最好的扩展性。

 

  1. 通过DNS轮询来线性扩展入口lvs层的性能
  2. 通过keepalived来保证高可用
  3. 通过lvs来扩展多个nginx
  4. 通过nginx来做负载均衡,业务七层路由


 

 

 

 

 

结论

 

    1. 接入层架构要考虑的问题域为:高可用、扩展性、反向代理+扩展均衡

 

    2. nginx、keepalived、lvs、f5可以很好的解决高可用、扩展性、反向代理+扩展均衡的问题

 

    3. 水平扩展scale out是解决扩展性问题的根本方案,DNS轮询是不能完全被nginx/lvs/f5所替代的

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326223026&siteId=291194637