Many Internet companies now have their own a set of service system, the logic of each company and hierarchical system are divided into each are not identical, even some companies also does not have the concept of layered, referred to as service, some companies are more meticulous, divided into could reach 3 4 layers, which have no clear specification in the industry, Therefore, communication in various companies or fields is also easy to cause errors in understanding.

The layering method proposed by Teacher Yang Bo in Micro-service is almost the same as the layering method of my previous company, which basically divides the whole micro-service system into two layers, as shown in the following figure:

There are PC, H5, APP and so on in the upper layer, which are not microservices, and there are two layers in the lower layer, which together constitute our microservices or SOA. The microservices are divided into two layers, and the basic service layer is at the bottom

Microservices base service layer

Basic services generally belongs to the Internet platform basic support services, for example, the foundation of e-commerce sites have order service, goods and services, customer service, etc., these all belong to compare base and atomicity, sinking the infrastructure of a company is lower, down to undertake storage, up to provide business capabilities, some companies call (basic services, intermediary services, public services). Netflix becomes a mid-tier service. Let’s call it basic services.

Microservices aggregation service layer

There are already basic services that can provide business capabilities, so why do we need aggregation services? Because we have different access ends, such as APP, H5, PC, etc. They seem to call roughly the same data, but in fact there are many differences, for example, PC needs to display more information, APP needs to do information tailoring, etc. Generally, low-level services are more general, while basic services should output relatively uniform services, which are better abstracted. However, for different external APP and PC access, we need to make different adaptations. At this time, we need to have a layer to do the work of aggregation tailoring. For example, when the details of a commodity are displayed on PC and APP, THE PC may display more information, while the APP needs to make some information cuts. If the basic service directly opens the interface to PC and APP, the basic service also needs to make various equipment, which is not conducive to the abstraction of the basic service. Therefore, we add the aggregation service layer on top of the basic layer, which can be tailored for PC and APP to make appropriate Settings.

In addition to cutting, there is a more important reason, assuming that PC for a list of “my order”, then the PC must know based service and invoke several modules (customer service, order services, goods and services), PC has launched several times request, in this a few request data to carry on the summary, this not only poor performance network overhead is big also, There is also a PC side to undertake such a job of data aggregation, which will make the PC side more complicated. If an additional layer is added in the middle as the aggregation service layer, the network overhead can be reduced, because the data is transmitted through the internal network of the micro-service, and the business on the PC side becomes relatively simple.

This layer is called by different names in different companies, aggregating services, frontier services, provisioning services and Netflix is called frontier services because it sits on the boundary between the company’s microservices and external services.

This division is just a logical division, there is no difference in deployment and invocation between the two levels, physically or in microservices.

Blog Address: “Microservices Series 04” How to determine the layering of microservices