"SpringCloud Alibaba Microservice Architecture" Special Topic (1)-Introduction to Microservices

1. Overview of microservices

1.1. What is a microservice

Microservice architecture ( MicroServicesArchitecture) is a high-frequency vocabulary that has appeared in the field of software architecture in recent years. It is an architecture model based on the evolution of traditional SOA architecture. It advocates dividing the traditional monolithic architecture or the monolithic applications and services in the distributed architecture into smaller-grained services, which we call Microservices. This kind of service runs independently in an independent process and is isolated from other processes. The services are usually communicated with RestFulAPI based on the Http communication protocol. Each microservice is built around a specific business. It can be independently developed, built, released and deployed to the production environment and production environment without affecting other dependent businesses.

MicroserviceThe concept of microservices ( ) emerged in 2012. As a way to speed up the development of Web and mobile applications, it has attracted attention from all parties in 2014, and 2015 can be said to be the first year of
microservices ; more and more The more forums, communities, blogs, and Internet industry giants begin to discuss and practice microservices, it can be said that this has further promoted the development and innovation of microservices. Martin Fowler has contributed to the popularity of microservices. This old man is a strange man, especially good at abstract induction and making concepts. In particular, the new term microservices has one characteristic: you understand as soon as you explain, you don't know as soon as you ask, and you fight as soon as you discuss it.

Martin Fowler is an internationally renowned OO expert, one of the founders of agile development methods, and is currently the chief scientist of ThoughtWorks. He is the world's top expert in object-oriented analysis and design, UML, patterns, software development methodology, XP, refactoring, etc., and is currently the chief scientist of ThoughtWorks. ThoughtWorks is a company engaged in enterprise application development and integration. As early as the 1980s, Fowler was an advocate of using object technology to build multi-tier enterprise applications. He has authored several classic books: "Enterprise Application Architecture Patterns", "UML Essence" and "Refactoring".
Insert picture description here

Paper URL: https://martinfowler.com/articles/microservices.html#MicroservicesAndSoa
Chinese translation URL: http://blog.cuicc.com/blog/2015/07/22/microservices/

  • Martin Fowler's general overview of microservices is as follows :
    At present, there is no uniform and standard definition for the microservice industry (While there is no precise definition of this architectural style). But generally speaking, the microservice architecture is an architectural pattern or an architectural style. It advocates dividing a single application into a set of small services. Each service runs in its own independent process. They coordinate and cooperate with each other to provide users with ultimate value. Services use a lightweight communication mechanism to communicate with each other (usually HTTP-based RESTful API). Each service is built around a specific business and can be independently deployed in production environments, production-like environments, etc. In addition, a unified and centralized service management mechanism should be avoided as much as possible. For a specific service, the appropriate language and tools should be selected according to the business context to build it, which can have a very lightweight centralized management To coordinate these services. You can use different languages ​​to write services, or you can use different data stores.
    Insert picture description here

  • Understanding from a technical perspective :
    The core of microservices is to split the traditional one-stop application into one service according to the business, and completely decouple it. Each microservice provides a service of a single business function, and one service does one service. From a technical point of view, it is a small and independent process, similar to the concept of a process, which can be started or destroyed by itself, and has its own independent database.

1.2. Advantages of microservices

  • Reducing the complexity of a single service The
    previously coupled complex business is split into a single service, avoiding the endless accumulation of original complexity. Each microservice focuses on a single function and clearly expresses the service boundary through a well-defined interface.

  • Independent deployment
    Because microservices have independent running processes, each microservice can be deployed independently. When the business is iterative, only the iteration of related services needs to be released, which reduces the workload of testing and also reduces the risk of service release.

  • High fault tolerance
    In the microservice architecture, when a component fails, the fault will be isolated in a single service. Reduce the harm caused by errors through current limiting, fusing, etc., and ensure the normal operation of core business.

  • Scalability
    Monolithic architecture applications can also achieve horizontal expansion, which is to copy the entire application to different nodes. When the different components of the application have differences in expansion requirements, the microservice architecture reflects its flexibility, because each service can be expanded independently according to actual needs.

2. Common microservice framework

2.1. Alibaba dubbo

Ali's open-source microservice framework is a high-performance, lightweight open-source Java RPC framework that provides three core capabilities: interface-oriented remote method invocation, intelligent fault tolerance and load balancing, and automatic service registration and discovery. Has officially entered the Apache incubator.
Insert picture description here

Official website: http://dubbo.apache.org/zh/

core concept
Insert picture description here

Provider 暴露服务的服务提供方
Consumer 调用远程服务的服务消费方
Registry 服务注册与发现的注册中心
Monitor 统计服务的调用次数和调用时间的监控中心

2.3.SpringCloud

SpringCloud is a set of frameworks for implementing microservices based on SpringBoot. He provides the configuration management, service discovery, circuit breaker, intelligent routing, micro agent, control bus, global lock, decision campaign, distributed session and cluster state management required for microservice development. The most important thing is that, if used with the spring boot framework, it will make you develop a cloud service with a microservice architecture very convenient. SpringBoot aims to simplify the creation of product-level Spring applications and services, simplify configuration files, use an embedded web server, and contain many out-of-the-box microservice functions.
Insert picture description here
Official website: https://spring.io/projects/spring-cloud

Core components
Insert picture description here

Netflix Eureka 服务注册与发现
Netflix Ribbon 客户端负载均衡
Netflix Hystrix 服务熔断
Netflix Zuul 服务网关
Spring Cloud Config 分布式配置
……

2.4.SpringCloud Alibaba

SpringCloud Alibaba is an open source microservice architecture solution of Alibaba Group.
The microservice architecture is to split an application into multiple sub-applications for better distributed system development, and each service is a sub-project that can run independently. It covers a lot of content, including: service governance, configuration management, current limiting and downgrading, and N multi-components that support the Ali open source ecosystem (Dubbo, RocketMQ, etc.).

Insert picture description here
Official website: https://spring.io/projects/spring-cloud-alibaba/

Core components

Sentinel:阿里巴巴开源产品,把流量作为切入点,从流量控制、熔断降级、系统负载保护等多个维度保护服务的稳定性。
Nacos:阿里巴巴开源产品,一个更易于构建云原生应用的动态服务发现、配置管理和服务管理平台。
RocketMQ:Apache RocketMQ™ 基于 Java 的高性能、高吞吐量的分布式消息和流计算平台。
Dubbo:Apache Dubbo™ 是一款高性能 Java RPC 框架。
Seata:阿里巴巴开源产品,一个易于使用的高性能微服务分布式事务解决方案。
Alibaba Cloud ACM:一款在分布式架构环境中对应用配置进行集中管理和推送的应用配置中心产品。
……

3. Microservice architecture ecosystem

Insert picture description here

Guess you like

Origin blog.csdn.net/BruceLiu_code/article/details/114391286