This is the fourth day of my participation in the August More Text Challenge. For details, see “August More Text Challenge”.
1. Introduction to the Microservice architecture
Microservice Architecture is an architectural concept designed to decouple solutions by decomporting functionality into discrete services. You can think of it as applying a lot of SOLID principles at the architectural level rather than the class that gets the service. Microservices architecture is an interesting concept. Its main purpose is to decompose functionality into discrete services, thereby reducing system coupling and providing more flexible service support.
** Concept: ** Break up a large single application and service into several or even dozens of supporting microservices that extend a single component rather than the entire application stack to satisfy a service level agreement.
** Definition: ** Create applications around business domain components that can be independently developed, managed, and iterated. Using cloud architecture and desktop to deploy, manage, and service capabilities in decentralized components makes product delivery easier.
** Essence: ** Solve bigger, more practical problems with services with more specific functions and more refined business.
2. Mode description
Regardless of the implementation style and topology you use, there are several common core concepts that apply to this architectural pattern. The first is separately releasing Units.
As shown in the figure, the components of each microkernel are separated into a separate unit.
Microservices contain service components. Instead of thinking about a single service of a microkernel, it is better to think about a service component, which can be a single module in granularity or a large application that represents a single function (providing weather forecasts or picture storage).
Properly designing the granularity of service components is a major challenge.
Another key concept is that microkernels are distributed. This means that service components may be remote methods (via JMS, AMQP, REST, SOAP, RMI…… Etc.). Distributed means that this model can be built on a large scale.
Another exciting feature is that it can evolve from other problematic architectural patterns, rather than being created and waiting for problems to occur. When you have problems that you can’t solve, especially as an Internet business gets bigger, it’s a good time to introduce a microservice architecture.
They typically evolve from two patterns:
-
One is the whole application from the start, with all the modules tightly coupled;
-
The other is service-oriented Architecture pattern (SOA). SOA is not bad, but it is expensive and difficult to understand and implement.
3. Pattern topology
There are many ways to implement microservices. The three most common and popular methods are API Rest-based, Applicaiton Rest-based, and centralized messaging. The API rest-based is suitable for websites providing small-scale, self-contained services. Many Internet sites offer such services, such as OAuth2.
Application Rest-based differs from the above architecture in that the client sees the Web interface or rich client program instead of calling the API. The UI layer is published independently and can access the service components.
The central message pattern, which is similar to the previous pattern but uses a lightweight message broker instead of RESTful service invocation. Unlike SOA, this lightweight broker does not perform choreography, transport, and routing of services. Don’t think of it as SOA lite.
4. Architecture considerations
Microservices architecture addresses the problem of unstructured overall coding applications as well as SOA. It can also provide real-time product releases. It’s a distributed architecture, and there will be distributed issues.
Advantages and disadvantages analysis of micro-service mode:
-
Overall flexibility: high
-
Release ease of use: High
-
Testability: high
-
Performance: low
-
Scale expansion: high
-
Ease of development: high
5, summary
Microservices the microservices architecture pattern is quickly gaining ground in the industry as an alternative to monolithic applications and service-oriented architecture. This pattern is still evolving, and there is some confusion in the industry about its features and implementation. For our thinking, it’s more of a shift in thinking. For microservices architecture: Technology is not the issue, awareness is more important than tools.
Author: Architecture improvement road, ten years of research and development wind and rain road, dacang architect, CSDN blog expert, focus on architecture technology precipitation learning and sharing, career and cognitive upgrading, adhere to the sharing of grounding gas dry articles, look forward to growing with you.
Pay attention to the “structure of the road to progress” public number with the same name and reply “01”, send you a programmer growth advanced gift package, in addition to the interview book, a large number of technical e-books for free.
Thanks for reading!