Remember to be killed! Micro-service architecture commonly used design patterns!

Author: duanxz
Source: cnblogs.com/duanxz/p/3514895.html

Hello everyone, I'll be here to share with you some dry content every day (of course, the weekend should allow me a break ha). Today, knowledge sharing micro-services architecture design patterns common with you.

A design pattern aggregator microService

This is the most common and simplest design patterns, as shown below:

Aggregator call multiple services to achieve the desired application functionality. It can be a simple Web page, the retrieved data is processed to show. It can also be a combination of a higher level of micro-services, data retrieved after a further increase in business logic into a new micro-publishing services, in line with the DRY principle. In addition, each service has its own cache and database. If the aggregator is a combination of service, it also has its own cache and database. The polymerization may be independently extended in the X and Z axes.

2 type of micro-services design patterns

This mode after receiving the request will generate a combined response through, as shown below:

In this case, after receiving a request for service A and service B will communicate, similarly, the service B communications service in conjunction C. All services use synchronous messaging. Before the entire chain call is completed, the client will always be blocked. Therefore, the service call chain should not be too long, so the client for a long time to wait.

3 The branch of service design patterns

This mode is an extension mode of polymerization, two micro-services calls while allowing chains, as shown below:

4 micro-agency services design patterns

This is a variation of the aggregation pattern, as shown below:

In this case, the client does not aggregate data, but will call different micro services based on different business needs. Agent may simply assignment request, data conversion may be performed work.

5 micro Asynchronous messaging services design patterns

Although the REST design pattern is very popular, but it is synchronous, it can cause obstruction. Thus the service portion of the micro architecture may choose to use instead of the message queue-based REST request / response, as shown below:

6 micro data sharing services design patterns

Autonomy is one of the design principles of micro service, that service is a micro full stack service. But in the reconstruction of existing "single application (monolithic application)", SQL database denormalization could lead to data duplication and inconsistencies. Thus, the monomer phase transition applied to the micro-architecture of the service, can use this design pattern, as shown below:

In this case, part of the micro-services may be shared cache and database storage. However, this is only when the strong coupling relationship can exist between two services. For new applications based on micro-services, which is an anti-pattern.

Published 50 original articles · won praise 1711 · Views 2.24 million +

Guess you like

Origin blog.csdn.net/zl1zl2zl3/article/details/105397507