The evolution of distributed architecture

First, the problem domain

nginx, lvs, keepalived, f5, DNS polling, often referred to these techniques, several problems are often discussed in the access layer:

1) Availability : any machine hung up, the service will not be affected by the

2) Scalability : Can machine by increasing the performance of system expansion

3) Reverse proxy and load balancing : the request is uniformly allocated to the rear end of the operation unit performed

 

Second, why are above those of nouns

Since each person's background and technical knowledge domain, those above shorthand term (O & M students familiar with it), or take 1 minute to briefly explain (in detail your own "Baidu"):

. 1) Nginx : a high-performance web-server and reverse proxy software embodiment

2) LVS : Linux Virtual Server, the use of clustering technology to achieve a high performance level in linux operating system, high availability, load balancing server

3) keepalived : a service used to detect the state of viability of software, often used for high availability

4) F5 : a high-performance, high-availability, load balancing hardware devices similar (and sounds lvs function)?

. 5) the DNS Polling : by providing a plurality of domain name parsing ip on DNS-server, load balancing technique to expand the web-server implementation and performance

 

Third, the access layer technology evolution

[Streaking era (0) single architecture]


Chart streaking era above:

1) the browser resolves to ip by DNS-server, domain name

2) browser to access the web-server through ip

Disadvantages :

1) the non-availability, web-server linked to the system hung up

2) poor scalability, when the web-server throughput limit, not expansion

Note: Stand-alone does not involve load balancing

 

[Simple expansion scheme (1) DNS polling]

Assume tomcat throughput is 1000 times per second, when the total system throughput of 3000, how the expansion is the first problem to be solved, DNS polling is a very easy to think of the program:


At this time, the above architecture diagram:

1) Multi-deploy several web-server, 1 tomcat anti th 1000, will be able to deploy an anti-tomcat 3 3000

2) in the DNS-server level, domain name resolves to a different ip each time

Advantages :

1) zero cost: On the DNS-server ip and more with a few can function without charge

2) Easy to deploy: deploy more than a few web-server to the original system architecture does not require any alteration

3) Load balancing: to become a multi-machine, but the basic load is balanced

Disadvantages :

1) Non-availability: the DNS-Server is responsible only for DNS ip, ip corresponding to this service is available, DNS-server is not guaranteed , assuming there is a web-server hung up, some services will be affected

2) the expansion of non-real-time: DNS to resolve a validated period

3) exposure to too much external network ip

 

[Simple expansion scheme (2) nginx]

Tomcat poor performance, but as a reverse proxy nginx performance is much stronger, it is assumed to go online 1w, it is 10 times higher than tomcat, you can use this feature to do expansion:


At this time, the above architecture diagram:

1) adding a reverse proxy layer between the browser and the site level layer, using a high-performance reverse proxy do nginx

2) nginx http request to the backend plurality of distributed web-server

Advantages :

1) DNS-server need not move

2) Load balancing: guaranteed by nginx

3) exposing only an external network ip, nginx-> using the access network between tomcat

4) expansion of real-time: nginx internal control, at any time increase web-server at any time real-time expansion

5) to ensure the availability of the site layers: Any one tomcat hung up, nginx can migrate to other traffic tomcat

Disadvantages :

1) + delay increases more complex architecture: a reverse proxy pay more intermediate layers

2) reverse proxy layer becomes a single point, non-availability: tomcat hung up without affecting service, nginx hung up how to do?

 

[High Availability Program (3) keepalived]

To solve the problem of high availability, keepalived played (previous article, " Use shadow-master to ensure system availability " details too):


at this time:

1) a composition made of two nginx cluster deployment keepalived respectively, set to the same virtual IP, ensuring that the availability nginx

2) When a nginx hung, keepalived able to detect, and the automatic flow nginx migrate to another, the whole process of the caller transparent


Advantages :

1) to solve the problem of high availability

Disadvantages :

1) resource utilization rate of only 50%

2) nginx is still a single point of access, the performance limit of nginx if the access throughput of more than how to do, for example, reached 50,000 qps blanket?

 

[Scale up expansion program (4) lvs / f5]

nginx, after all, software, performance is better than tomcat, but there is always a limit, beyond the upper limit, or could not carry.

lvs is not the case, it is implemented at the operating system level; f5 and better performance, it is implemented at the hardware level; their performance is much better than nginx, for example, anti-10w per second, so you can use them for expansion, common chart as follows:


at this time:

1) If a plurality of the same can be extended by nginx tomcat, you can be extended by a plurality of nginx lvs

2) by keepalived + VIP scheme may ensure the availability

99.9999% of the company to be able to solve this basic step storey access available, scalability, load balancing problem.

 

This is the perfect thing? There are potential problems with it?

Well, whether or using lvs f5, these are the scale up of programs, fundamentally, lvs / f5 still have a performance limit, assuming that 10w per second can handle the request, one day we can only handle 8.0 billion request (10w sec throughput * 8w seconds), in case that day PV systems over 8 billion how to do it? (Well, not many companies have to consider this issue)

 

[Scale out expansion program (5) DNS polling]

As the previous article, horizontal expansion, is the root of the problem solving performance program, it can only have the best scalability by adding machines to expand the performance of the program.

facebook, google, baidu of PV is not more than 8 billion of it, their name corresponds to only a ip Mody, the end is the starting point, still have to be carried out by the expansion DNS poll :


at this time:

1) by a DNS entry polling linear scalability layer lvs

2) to ensure high availability through keepalived

3) to extend through the plurality nginx lvs

4) by nginx to do load balancing, routing seven business

 

Conclusions

Talk so much, a little to do a brief summary:

1) Problem Domain access architecture layer is to be considered : high availability, scalability, expansion equalization reverse proxy +

2) nginx, keepalived, lvs, f5 can solve high availability, scalability, reverse proxy and balanced expansion problem

3) extend horizontally scale out is a fundamental solution to the problem of scalability, the DNS polling can not be completely replaced by nginx / lvs / f5 of

Published 136 original articles · won praise 6 · views 1509

Guess you like

Origin blog.csdn.net/weixin_42073629/article/details/104603712