I first introduced the layering concept in the background architecture, here's my initial understanding of layering in the project
Benefits of Tiering:
1, to reduce the coupling between the various modules in the system, to maintain the independence between the layers (each layer can independently evolve according to the specific circumstances, without the need to adjust the other layers)
2, easy to develop and maintain
3, for the support of high concurrency, the development of the distributed direction is critical (partitioned business modules can take a distributed deployment, each module can be deployed on a separate server cluster)
The system with hierarchical structure can be divided into: Application layer, service layer, data layer. (The application layer is the top layer, the service layer is the middle layer, the data layer is the lowest level)
Constraints on hierarchies:
1, prohibit cross-level calls (such as: Prohibit the application layer directly call the data layer)
2, prohibit the reverse call (such as: Prohibit the data layer call service layer)
A brief description of each layer:
Application layer: For Web sites, this layer can be used for the presentation of individual pages (e.g., converting HTML pages through the Smarty engine to PHP pages and showing them). This layer can also be used to provide API services (i.e., to organize third-party apps into APIs for invocation)
Service layer: My understanding of this layer is "individual service modules" (see below for a specific introduction).
Data layer: This layer, as the lowest level, is primarily responsible for providing basic services to the service layer, such as the search and access of basic data, and the corresponding cache processing.
Service Layer Detailed:
The content of the service layer is important to achieve "mutual independence",
The service layer should exist in the various functions of the process module, (should be guaranteed that each function modules can be deployed to different server clusters separately)
Service layer should be the whole system "functional process core", such as a forum system, it is actually composed of various small service modules, user registration services, user login services, user management services, private messages between users, and so on.
Relationship between the service layer and the data tier:
Assuming that the service tier has service A and service B,a services that are messaging conversations between users, B service is a ranking feature for all users in the system.
There is almost no coupling between A and B, which keeps each other independent.
Suppose there is a service C,c service in the data tier for "Querying user information in a database".
One of the functions of the data layer is to provide basic data support to the service layer. A service and B services because all involved in the user, then undoubtedly have to query the database from the user some necessary information, then the service layer of A and B will need to call to the data layer of the C service.
At this point, we can also cache the C service to improve overall performance.
Overall process:
The overall process presents the characteristics of "total score".
After accessing a page in the application layer, the user's next choice determines which module in the service layer to start, and then the module in the service layer runs and then invokes the underlying service in the data tier.
Schema mode-tiering