What is distributed architecture

A distributed system is a software system built on a network.

  • Cohesion: it means that each database distribution node is highly autonomous and has a local database management system.
  • Transparency: Each database distribution node is transparent to the user’s application and cannot be seen locally or remotely.


Distributed system as a whole to provide services to users, and the internal collaboration of the whole system is transparent to users, users refer to the same as using a mysql.


Evolution of distributed architecture

(1) Initial architecture

Features: Applications, databases, files, and all resources are on one server.

(2) Separation of application service, data service and file service

Note: good times do not last long, found that with the increase of system visits again, the pressure of the Webserver machine will rise to a relatively high peak, this time began to consider adding a Webserver.


Features: Applications, databases, and files are deployed on separate resources.

(3) Use caching to improve performance

Note: System access follows the 80/20 rule, that is, 80% of business access is concentrated on 20% of data.

Caches are divided into local caches and remote distributed caches. Local caches have higher access speed but limited cached data and compete with applications for memory.

Feature: A small part of data in a database is stored in the cache server, reducing the number of database accesses and reducing the database access pressure.


(4) Use the Application Server cluster

Explanation: After finishing the work of sub-database sub-table, the pressure on the database has been reduced to a relatively low level, and began to live a happy life of watching the daily traffic explosion.


Suddenly one day, I found that the access of the system began to slow down. At this time, I first checked the database, and the pressure was normal. Then I checked the Webserver, and I found that Apache blocked a lot of requests.

However, the application server is also relatively fast for each request. It seems that the high number of requests leads to queuing and slow response.

Feature: Multiple servers provide external services through load balancing, limiting the processing capability and storage space of a single server.


Cluster is a common method to solve the problem of high concurrency and mass data. By adding resources to the cluster, the concurrent processing capability of the system is improved so that the server load does not become the bottleneck of the entire system.

(5) Database read and write separation

After enjoying the happiness of high speed growth of system access for a period of time, I found that the system began to slow down again, what is the situation this time, after searching, I found that the database write, update these operations of part of the database connection resource competition is very fierce, resulting in the system slow down.


Feature: Multiple servers provide external services through load balancing, limiting the processing capability and storage space of a single server.


Cluster is a common method to solve the problem of high concurrency and mass data. By adding resources to the cluster, the load on the server does not become the bottleneck of the whole system.


(6) Reverse proxy and CDN acceleration

Features: CDN and reverse proxy are used to speed up system access.

In order to cope with the complex network environment and access of users in different regions, CDN and reverse proxy are used to speed up user access and reduce the load of back-end servers. CDN and reverse proxy are based on caching.


(7) distributed File System and Distributed Database

Note: With the continuous operation of the system, the amount of data began to grow substantially, this time found that the query will still be a little slow after the sub-database, so according to the idea of sub-database began to do sub-table work

Features: The database uses a distributed database and the file system uses a distributed file system.

Description: Any powerful single server can not meet the continuous growth of large system business requirements, database read and write separation with the development of business will eventually not meet the requirements, need to use distributed database and distributed file system to support.

Distributed database is the last method of system database splitting. It is used only when the data size of a single table is very large. The more commonly used method of database splitting is service splitting, deploying different service databases on different physical servers.


(8) Use NoSQL and search engines



Features: The system introduces NoSQL database and search engine.

Description: With more and more complex business, the demand for data storage and retrieval is also more and more complex, the system needs to use some non-relational database such as NoSQL and sub-database query technology such as search engine.

The application server accesses all kinds of data through the unified data access module, which relieves the trouble of managing many data sources.


(9) Business separation

Feature: The system is separated and modified based on services, and application servers are deployed based on services.

Description: In order to cope with increasingly complex business scenarios, the whole system business is usually divided into different product lines by means of divide-and-conquer. The relationship between applications is established through hyperlinks, and data can also be distributed through message queues.

Of course, more or through access to the same data storage system to form an associated complete system.

Vertical split: Split a large application into multiple small applications. If new services are independent, deploy them as an independent Web application system. Vertical split is relatively easy.

Horizontal split: To split reusable services and deploy them independently as distributed services. New services only need to invoke these distributed services. Horizontal split requires identifying reusable services, designing service interfaces, and standardizing service dependencies.


(10) Distributed services

Features: Common application modules are extracted and deployed on distributed servers for application server invocation.

Description: As services become smaller and smaller, the overall complexity of application systems increases exponentially. As all applications need to connect to all database systems, database connection resources are insufficient and services are denied.