Talk about microservices (1)

​Recently, I saw some small partners talking about microservice-related topics. Everyone has their own understanding of microservices. Even many small partners think that microservices are the "white and rich beauty" in the architecture world. Everyone yearns to have it, but it is not always the case. The expression of anything out of the scene is pale. So what exactly are microservices? When do we need it? Here I would like to take out a sharing I made within the team two years ago, and talk to you about microservices.

Speaking of microservices, we have to start with how it was born. When we understand the reasons for its birth, we will naturally know why microservices were born and why. Without further ado, let's get started!

1. Architecture Evolution


Taking Internet applications as an example, most applications start from a single application architecture , and gradually develop to a distributed application architecture with the expansion of business and the increase in business volume . In the early distributed application architecture, the SOA architecture was the main one. With the development and update of technology and concepts, the microservice architecture was gradually derived .

The development of application architecture is changing with each passing day, and it has never stopped its pace. Like the SOA architecture, the microservice architecture is a phased product ( in recent years, the Serverless architecture has gradually entered everyone's field of vision, opening up the transformation of the application architecture to the "serverless architecture" model, enabling developers to focus more on business its own development. ). The only constant in the world is change itself.

2. Monolithic application architecture 


Most monolithic application architectures are built on a layered-base basis. The so-called monolithic application architecture is to package all the functions of the application into an independent unit to provide services to the outside world. The monolithic application architecture has its own advantages and is very suitable for start-up teams to conduct rapid business trial and error.

Its advantages:

  • Single technology stack

  • Developers are small

  • Simple system architecture

  • Operation and maintenance management, deployment, personnel recruitment and personnel management are relatively easy to implement.

With the continuous expansion of business and the increase of business volume , the problem of monolithic application architecture has gradually emerged.

Its disadvantages:

  • Severe program coupling, poor code scalability, and complex business logic slow demand response.

  • There is a bottleneck in business capacity. The coupling of various business codes and data layers complicates service expansion.

  • System availability is poor. Due to the bloated code and complex logic, the difficulty of testing is increased, and program bugs will bring disastrous consequences to the entire platform.

In order to solve the above problems, the distributed architecture came into being.

3. Distributed application architecture 


Distributed application architecture provides solutions for improving application scalability, capacity, and availability. The so-called distributed application architecture is to split the application system into multiple independent subsystems, and each subsystem coordinates the processing to jointly provide external services. For the distributed application architecture, we divided it into two phases according to time, before 2010 and after 2010. 

 SOA before 2010

SOA (Service-Oriented Architecture) is also called service-oriented architecture. It is a component model that splits applications into functional units (called services) and connects services through well-defined interfaces and protocols. The interface is defined in a neutral way, it should be independent of the hardware platform, operating system and programming language that implements the service. This enables services built in various systems to interact in a unified and common way .

Regarding the SOA architecture, we can trace it back to around 2000. At that time, Internet companies were expanding at a high speed, and many large companies were facing the challenges of application complexity and insufficient capacity brought about by continuous business expansion. It was in this environment that the SOA architecture emerged.

SOA divides the business of the platform into several sub-services by vertically splitting the business. Through such a split, the problems faced by the monolithic application architecture can be effectively solved.

Advantages of SOA:

  • Reduce the complexity of business and code logic, and improve demand response capabilities

  • Improved usability. The independent development and deployment of each subsystem reduces the complexity of testing, and the impact of bugs will not spread to the entire application platform.

  • Large business capacity. Carry out targeted optimization and expansion according to the business characteristics of each subsystem, making optimization and expansion easier and lighter.

As time goes by, more and more services are split , and the complexity of the problem increases exponentially. The shortcomings of SOA architecture are gradually exposed.

Disadvantages of SOA

  • The system architecture is complex. The problem involves many links, how to effectively locate and discover the problem.

  • The probability of system error increases. The increase in services also means that the probability of errors will be greater.

  • The complexity of deployment operation and maintenance has increased sharply.

  • The scale and quality of R&D personnel have increased

  • Big learning curve

  • The difficulty of teamwork and management increases, and the development of repetitive functions will also cause a lot of waste within the team

From quantitative change to qualitative change, these problems of SOA have brought new challenges to the team. With the development of technology and concept, microservice architecture has gradually been born.

 Microservices 2010 later

Microservices (Microservices) is a software architecture style, which is based on focusing on single responsibility and small functional blocks (Small Building Blocks), and uses modularization to combine complex large-scale applications. Each functional block Use language-independent (Language-Independent/Language agnostic) API set to communicate with each other.

Does everyone here look a little familiar? Yes, microservices are essentially an upgraded version of the SOA architecture , using some new concepts and technologies to solve the problems exposed by the SOA architecture.

Microservices vs SOA: What's the Difference?[4]
Microservices vs SOA: What's the Difference?[4]

After 2010, with domain-driven design , continuous integration and continuous deployment (CI/CD) , virtualization technology , cloud computing , infrastructure automation , and some solutions ( service registration discovery , Distributed configuration , service monitoring , service tracking... ), the distributed architecture has been greatly developed. Problems and difficulties were overcome one by one, and the microservice architecture was formally born on this basis.

Advantages of microservices:

  • Further reduce the complexity of the system. Due to the improvement of automation technology and the popularization of domain-driven design concepts, the system has been further split and finer granularity.

  • Componentization. The finer system granularity makes the service more reusable, so that the service is gradually componentized.

  • Automated and highly available. Highly automated testing, integration, deployment, and monitoring have gradually transformed the system operation and maintenance from manual operation to AI intelligence, and the degree of human participation has gradually decreased. Make the system more flexible, higher availability, and lower failure rate.

  • Hybrid technology stack. A variety of technical development languages ​​can be used, and a more targeted development language can be used for development and deployment according to the characteristics of different businesses.

  • The system is elastically scalable. Due to the adoption of virtualization, especially the deployment of containerization, and the addition of automation technology, the system has a high degree of scalability, which makes the utilization of platform resources higher.

Disadvantages of microservices:

  • The complexity of service splitting is high. Errors in the service bounded context [5] will result in frequent changes to the collaboration between services.

  • Decision making is difficult. Finer-grained services mean higher flexibility and more combinations, so more decisions will be encountered in design and development, and mistakes in decision-making will cause unnecessary cost waste.

  • The cost of learning is further increased.

4. Summary 


By sorting out the development of application architecture, I think you should have an understanding of what microservices are. Microservices are actually a large-scale application platform solution that is gradually developed on the basis of SOA, combined with the latest concepts and mature solutions.

  • The monolithic application architecture solves the problem from 0 to 1.

  • SOA focuses on improving platform capacity, usability, and maintainability.

  • Microservices focus on solving the problems of service orchestration and governance.

  • What the serverless architecture needs to solve is to allow the work of R&D personnel to focus on business development.

Look at the essence through the problem and understand the core problems they solve. I think you should also know how to choose and choose! The core of all technical architectures is to ensure that an application platform can operate more stably and efficiently, so as to achieve the goal of maximizing the value of the application platform. In order to achieve the goal, the application architecture is only one of the dimensions. Business goals, market positioning, operation strategies, organizational structure... All these issues and links need to be coordinated and developed to achieve the ultimate goal.

The topic of microservices is difficult to finish with only one article. In order to facilitate everyone’s understanding, we try our best to explain to you in the dimension of architecture development trend. More details have not been expanded in depth. I will follow up based on your feedback. , giving an in-depth explanation of some details. Finally, thank you for your patience in reading, thank you!

endnote


[1]. https://martinfowler.com/articles/serverless.html

[2]. "Who Moved My Cheese?" is the American writer Spencer Johnson

[3]. "Principles and Paradigms of Distributed Systems"

[4]. https://dzone.com/articles/microservices-vs-soa-whats-the-difference

[5]. "Domain Driven Design"

Guess you like

Origin blog.csdn.net/zhw_yihui/article/details/108203304