In order to solve a series of problems such as high concurrent access, massive data processing and high reliability operation, the architecture of large websites will have some similar routines, which can be called the architecture mode of large websites:

\

1, layering,

Logical concepts. The system is divided into several parts in the horizontal dimension, each part is responsible for a relatively single responsibility, and then through the dependence and invocation of the upper layer to the lower layer, together constitute a complete system.

Usually can be divided into

Application layer: responsible for business and view warrior, such as website homepage, search input and results, etc. It can be further subdivided into view layer + business logic layer

Service layer: Provides service support for the application layer, such as user management, shopping cart service, etc. It can be subdivided into data interface layer + logical processing layer.

Data layer: Provides data storage and access, such as databases, caches, files, search engines, etc

The hierarchical architecture must properly plan the boundary and interface of the layers, and forbid cross-layer calls. For example, the application layer directly calls the data layer, or if you want to call, the data layer calls the service layer, and the service layer calls the application layer.

Layering is critical for future expansion, etc., and should be done at an early age.

\

Supplement:

The MVC pattern is a framework pattern. How does it fit into the architecture of the website? Find some pictures, write them down, and practice them later:

\

\

\

2, division

Divide the function vertically. For example, in the application layer, different services are divided into different teams and deployed on different servers.

\

3. Distributed

One of the main purposes of layering and partitioning is to facilitate distributed deployment.

Distributed means there are more machines working together to perform the same function, more resources, and more data and access that can be processed. But development management is complex, so do what you can.

Commonly used distributed schemes:

1) Distributed applications and services

2) Distributed static resources. For example, JS, CSS, LOGO pictures are distributed and stored independently, and independent domain names are used, so called static and static separation. Independent domain name is to increase browser concurrent loading speed.

3) Distributed data and storage.

4) Distributed computing

\

4, the cluster

Because there are more servers providing the same service, clustering can provide better concurrency. More importantly, it protects your business from server failures. Therefore, in the website application, even if it is a small number of functions, at least two servers are deployed to form a small cluster.

\

5, caching,

1) the CDN

2) Reverse proxy

3) Local cache

4) Distributed cache

\

6, asynchronous

Introduce queuing mechanism to improve the experience.

\

7, redundancy

Cluster, backup.

\

8. Automation

Unattended, automatic release, monitoring, alarm, failure transfer, etc.

\

9, safety

\