Technical changes to the architecture evolution

Some app how Kangzhu 1 minute 1 billion request

Evolution path architecture of
one million concurrent: 1 sec 1 million requests
ten million concurrent: one minute 600 million request, the demand is almost the limit

Design and architecture optimized architecture to meet the needs of itself, can not be unlimited optimization

The basic concept of
(1) distributed (system, a plurality of modules deployed on different servers)
(2) a cluster (a software deployment on multiple servers, and as a whole, there is provided a class of service)
(3) high availability (System in some nodes fails, the other node can continue to work or take over a corresponding treatment plan)
(4) load balancing (the request is sent to a plurality of uniform nodes)

Architecture Evolution:

1. Stand-alone architecture
Here Insert Picture Description
DNS server, the DNS server to do, is to, through the DNS IP address is converted to actual www.taobao.com such domain name, browser instead visit the corresponding IP tomcat
bottleneck: subscriber growth, tomcat and competition for resources, not enough to support a stand-alone business performance between databases

2. The first: Tomcat and database deployed separately (the most common architecture)
Here Insert Picture Description
Tomcat and database server resources are exclusive significantly improve both their performance (tomcat server memory to find a large, DB server hard to find a large, wider bandwidth a)
bottleneck: subscriber growth, database concurrent read and write, especially in reading, become a bottleneck
note will not be resolved through a database cluster

3. Second evolution: the introduction of local cache even distributed cache
Here Insert Picture Description
(where Java programs are located) added cached on the Tomcat server, you can put the vast majority of requests (especially queries) intercepted off before accessing the database
Here Insert Picture Description
Redis on Tomcat server on, if not enough
then you can put yourself a Redis server, you can also get more than a few Redis server configured master-slave synchronization (can be added to enhance the availability of Sentinel)
bottleneck: the number of users increase, mainly concurrent pressure on the stand-alone tomcat , gradually slow response

4. Third Evolution: introducing a reverse proxy and load balancing
Here Insert Picture Description
using a reverse proxy, a user requests a large number of uniformly distributed to each of the tomcat (generally, corresponding to 100 concurrent tomcat, corresponding to 50,000 concurrent Nginx, specific depends on server performance)
bottleneck: the application server can support concurrent greatly increased cache capacity can be easily extended, complicated by the amount of growth means more requests penetrate to the database, the database will eventually become a single bottleneck

5. Fourth Evolution: a database separate read and write
Here Insert Picture Description
to the database and the database is divided into read-write library, the library can have multiple read, write library by the synchronization mechanism to synchronize the read data library database middleware (myCat), by it is organized separate read and write the database
bottleneck: business gradually increased, the gap between the views of different businesses large database of different services in direct competition with each other affect performance.

6. Fifth evolution: the database by business sub-library
Here Insert Picture Description
to save a different business data to a different database, reducing competition for resources between business, Sheremetyevo business can deploy more servers
bottleneck: the number of users grow, stand-alone write library will gradually achieve the performance bottleneck

7. Sixth evolution: the big table in the database is split into small table
other links above
Here Insert Picture Description
such as for order generation, it can be by month, or even hour to create the table
this practice can be called a distributed database, but logically is still a complete database as a whole, there is now a framework called MPP (massively parallel processing), for use in a variety of scenarios such problems of
bottlenecks: database and tomcat can expand large-scale level, stand-alone nginx will eventually become a bottleneck

8. Seventh Evolution: LVS make more use Nginx load balancing
LVS is software that runs the operating system kernel mode, can be forwarded to TCP or request high-level network protocols, distributed performance is much higher than Nginx, probably hundreds of thousands of
F5 hardware, LVS do with similar, but higher performance, and expensive
Here Insert Picture Description
this way, the user can reach in 50 million or billions levels
bottleneck: LVS reached a bottleneck, or users located in different areas, from the server room different, resulting in different access latency

9. Eighth Evolution: DNS polling machine room to achieve load balancing
Here Insert Picture Description
configuration of a domain name corresponding to multiple IP in DNS
for each IP address corresponds to a different room where the virtual IP
to achieve room-level horizontal expansion, already from request in terms of the amount of concurrent processing program billions of dollars, or billions of billions of concurrency, nobody considered temporary
bottlenecks: retrieve, analyze more and more demand, the database alone can not solve a variety of needs

10. Ninth evolution: the introduction of NoSQL databases and search engines
Here Insert Picture Description
large amount of data to a certain size, relational databases are no longer applicable, and the large amount of data query, MySQL may not be able to run out the results for massive data processing by HDFS distributed file system to store, for key-value type of data, through HBase, redis and other treatment for the crawl query can be solved by ES, etc., for multi-dimensional analysis, by kylin, Druid, etc. to solve the
introduction of more At the same time greatly improve inevitable component system complexity, the different components of the data also need to be synchronized, need to consider consistency

11. Tenth Evolution: large application for the demolition of a small application
structure diagram constant up and down
Here Insert Picture Description
according to business segment to divide the application, a single application of the duties more clearly, can be done independently of each other iterative upgrade, you can even do some of the features shut down.
Bottleneck: between different applications, there is a common module, resulting in some public functions included in the upgrade, all of the relevant code should be followed by upgrades

Eleventh evolution, pulled into a micro-services
similar to what we now write springcloud project structure, especially when the user, payment and other functions in multiple applications are present, pulled out a higher efficiency
would now like to achieve this effect , you can use ready-made frame. . .

Then evolution down, ESB service bus as interface management, container technology to achieve operating environment isolation, cloud platform carrying a large system

Cloud platform several concepts:

IaaS : Infrastructure as a Service, can apply for the hardware resource level
PaaS : Platform as a Service, providing development common technology components of cloud platforms and maintenance of
SaaS : Software as a Service to develop a good application, after deployment, paid in accordance with the functions or requirements.

to sum up:

If (1) the evolution of architecture must be adjusted in accordance with the above route
is not necessarily! ! ! Mentioned above is the electricity supplier direction, the evolution of the existing line
(2) For the system to be implemented, to what extent architecture to design
enough on the line, ask what is enough, designed to meet the next stage of users and performance indicators requirements
(3) micro-services and big data architecture
and maybe architecture, the solution is the same system, different aspects of the problem
not specific good or bad, it does not have to be treated separately

Published 74 original articles · won praise 231 · views 20000 +

Guess you like

Origin blog.csdn.net/qq_43107323/article/details/104919132