I realized I didn’t post this week.

I was on the subway, and I realized.

Brazenly, he pulled out his computer and made an HTTPS request to the Nuggets.

Ah! Go to the end, distance from the weekend, only 1 day left!

This article provides the complete code sample, see github.com/YunaiV/Spri…

Original is not easy, to point a Star hey, together blunt duck!

1. Spring Cloud system

I believe many fat friends have seen the following picture:

  • Spring is Bean (object) centric, providing IOC, AOP, and so on.
  • Spring Boot provides automatic configuration and monitoring functions based on Application.
  • Centering on Service, Spring Cloud provides functions such as Service registration and discovery, Service invocation and load balancing.

Let’s take a look at Spring Cloud’s brief introduction to itself:

The FROM github.com/spring-clou…

Tools for building common patterns in distributed systems with Spring

  • Based on Spring to build a distributed system tool set, referred to as “Spring family bucket”.

Let’s take a look at Spring Cloud’s official description of feature points:

FROM the spring. IO/projects/sp…

Features List:

  • 【 Configuration Center 】Distributed/versioned Configuration
  • Service Registration and Discovery
  • [API Gateway] Routing
  • 【 Service call 】Service-to-service calls
  • 【 Load balancing
  • 【 Service tolerance 】Circuit Breakers
  • Distributed messaging

———— Separation line ————-

The following functions are migrated from Spring Cloud to Spring Integration:

  • 【 Global locks 】Global locks
  • 【 Leadership election and Cluster State

Although Spring Cloud provides very powerful functionality, it does notNot all implementations are providedBut throughSpring Cloud CommonSubproject, definedUnified abstract API. As shown below:

Later, different vendors provide their own Spring Cloud suites in combination with their own middleware, for example:

  • Netflix realizes Spring-cloud-Netflix by combining its own open source middleware such as Eureka, Ribbon and Hystrix

    Netflix is the most popular Spring Cloud suite in China. However, with the adjustment of Netflix open source, it will gradually decline.

  • Kubernetes implements Spring-Cloud-Kubernetes with its apiserver, ConfigMap and other functions

  • Alibaba combines its own open source middleware such as Nacos, Dubbo and Sentinel to realize Spring-Cloud-Alibaba

    Spring Cloud Alibaba will be popular in China? !

Of course, Spring Cloud officially provides some concrete implementation of features, heh heh. For example:

  • API Gateway: Spring Cloud Gateway
  • Configuration center: Spring Cloud Config, Spring Cloud Vault
  • Link tracing: Spring Cloud Sleuth
  • Message driven: Spring Cloud Stream
  • Event Bus: Spring Cloud Bus
  • Service invocation: Spring Cloud OpenFeign
  • Load balancing: Spring Cloud Load Balancer

Below, we organize the official Spring Cloud, Netflix and Alibaba into the following table:

2. Spring Cloud Alibaba suite

Spring Cloud Alibaba suite, Ali open source components, Ali Cloud business components are integrated into Spring Cloud system, and Spring Cloud Gateway, OpenFeign, Ribbon and so on are integrated. The overall picture is as follows:

We can organize ali open source components and Ali Cloud commercial components in Spring Cloud Alibaba suite into the following comparison table:

The main functions are as follows:

  • Service Registration and Discovery: It ADAPTS to the Spring Cloud Service Registration and Discovery standard and integrates Ribbon support by default.
  • Distributed configuration management: Supports external configuration in distributed systems, and automatically refreshes configuration changes.
  • Service traffic limiting degradation: Default support for WebServlet, WebFlux, OpenFeign, RestTemplate, Spring Cloud Gateway, Zuul, Dubbo and RocketMQ traffic limiting degrade function access, You can modify traffic limiting degradation rules in real time through the console at runtime and view the Metrics of traffic limiting degradation.
  • Message driven capabilities: Build message driven capabilities for microservice applications based on Spring Cloud Stream.
  • Distributed transactionUse:@GlobalTransactionalAnnotated, efficient and business-free solution to distributed transaction problems.

The unique features of commercialization are as follows:

  • Distributed task scheduling: provides second-level, precise, highly reliable, and highly available scheduled (Cron expression based) task scheduling services. It also provides a distributed task execution model, such as grid tasks. Grid tasks allow quantum tasks to be evenly distributed to all workers (schedulerx-client) for execution.

    At one time, Ali SchedulerX was also an open source project, now there is no message… Hey hey, hope to restart in the future.

  • Ali Cloud object storage: Ali Cloud provides massive, secure, low-cost and highly reliable cloud storage services. Supports storage and access of any type of data in any application, anytime, anywhere.

  • Ali Cloud SMS service: global SMS service, friendly, efficient and intelligent interconnection communication capabilities, help enterprises quickly build customer access channels.

    Friendship tip: Nai is still more recommended to use cloud pieces to send SMS, customer service sister is basically seconds back, especially when the audit SMS template.

2.1 Ali open Source components

2.1.1 Nacos

Nacos: A dynamic service discovery, configuration management, and service management platform that makes it easier to build cloud-native applications.

  • Introduction to Spring Cloud Alibaba Registry
  • Introduction to Spring Cloud Alibaba Configuration Center Nacos

2.1.2 Dubbo

Dubbo: Apache Dubbo™ is a high-performance Java RPC framework.

  • Introduction to Spring Cloud Alibaba Service Call Dubbo

2.1.3 Sentinel

Sentinel: Take traffic as the entry point to protect the stability of services from multiple dimensions, such as flow control, fuse downgrading and system load protection.

  • Introduction to Spring Cloud Alibaba Service Fault-tolerant Sentinel

2.1.4 RocketMQ

RocketMQ: An open source distributed messaging system that provides low-latency, highly reliable message publishing and subscription services based on highly available distributed clustering technology.

  • RocketMQ Introduction to Spring Cloud Alibaba Message Queue
  • “Introduction to Spring Cloud Alibaba Event Bus RocketMQ” corresponds to LABX-20

2.1.5 Seata

Seata: Alibaba open source product, an easy-to-use high-performance microservices distributed transaction solution.

  • Introduction to Distributed Transaction Seata in Spring Cloud Alibaba

2.2 Aliyun Commercial components

2.2.1 Alibaba Cloud ACM

Alibaba Cloud ACM: an application configuration center that centrally manages and pushes application configurations in a distributed architecture environment.

2.2.2 Alibaba Cloud OSS

Alibaba Cloud OSS: Alibaba Cloud Object Storage Service (OSS) is a massive, secure, low-cost and highly reliable Cloud Storage Service provided by Alibaba Cloud. You can store and access any type of data in any application, anytime, anywhere.

2.2.3 Alibaba Cloud SchedulerX

Alibaba Cloud SchedulerX: a distributed task scheduling product developed by Alibaba Middleware team, which provides second-level, accurate, highly reliable and highly available timed (Cron expression based) task scheduling service.

2.2.4 Alibaba Cloud SMS

Alibaba Cloud SMS: global SMS service, friendly, efficient and intelligent interconnected communication capabilities, to help enterprises quickly build customer access channels.

2.3 Integration with other Spring Cloud components

After Spring Cloud Alibaba is integrated into the Spring Cloud system, it can be easily mixed and used with other Spring Cloud components for strong combination. It could also make up for Alibaba’s temporary lack of open source components.

Friendship note: The following patches only supplement the missing components of Spring Cloud Alibaba.

2.3.1 API gateway

  • Introduction to Spring Cloud Gateway
  • Spring Cloud Service Gateway Zuul

2.3.2 Link Tracing

  • Introduction to Spring Cloud Link Tracking SkyWalking
  • Spring Cloud Link Tracing Spring Cloud Sleuth

2.3.3 Service Invocation + Load Balancing

  • Introduction to Spring Cloud Netflix Load Balancing Ribbon
  • Introduction to Spring Cloud Declarative Calling with Feign

3. Spring Cloud or Dubbo?

I believe that a lot of fans when doing the technology selection of micro service architecture, basic encounter a problem, especially this problem occurred in the period when Dubbo stopped maintenance? Another popular discussion post on Zhihu is “What are the pros and cons of Spring Cloud and Dubbo?” .

3.1 Choose Spring Cloud system?

Assuming that we choose the Spring Cloud architecture, then we need to think about which Spring Cloud suite to choose. Perhaps the most popular is the Spring Cloud Netflix suite offered by Netflix.

But as interesting as the world is, Netflix is scaling back on open source and gradually stopping maintaining its components:

  • Netflix discontinues Development of Hystrix
  • Eureka 2.0 Open Source work stops, Use it at your own risk
  • Netflix is donating Feign to the OpenFeign community
  • The Official Spring Cloud team is not considering providing Zuul 2 support, see Zuul#ISSUE483
  • The Ribbon is in maintenance state. The Ribbon home page is displayed

Therefore, Spring Cloud Netflix enters maintenance mode, which can be seen in the news “Spring Cloud Greenwich.RC1 Available Now”. As shown below:

Spring Cloud Netflix may not be such a good choice, then. However, there is no other popular Spring Cloud kit for the time being. The only reliable one seems to be the Spring Cloud Alibaba kit provided by Alibaba. In Wanted: Who’s Using Spring Cloud Alibaba, you can see the companies and teams that are currently using Spring Cloud Alibaba.

In addition, I heard that Spring Cloud Alibaba will become the second-generation standard of Spring Cloud, but Nai Nai has not found any information or news about this.

3.2 Spring Cloud Alibaba or Dubbo?

In fact, Dubbo has evolved from an RPC framework into a Dubbo ecosystem, as shown below:

The FROM dubbo.apache.org/zh-cn/ecolo…

Very rich, the components we see in Spring Cloud Alibaba provide corresponding integrations in the Dubbo ecosystem. So, from this point of view, Spring Cloud Alibaba or Dubbo system is a very good choice.

If you choose the Dubbo system, read the following articles:

  • Introduction to Spring Boot Dubbo
  • Introduction to Spring Boot Registry
  • Introduction to Spring Boot Configuration Center Nacos
  • A Primer on Spring Boot Service Fault-tolerant Sentinel
  • Introduction to RocketMQ Impression Spring Boot Message Queue
  • Introduction to Dubbo Distributed Transaction Seata
  • Intro to Spring Boot Link Tracking SkyWalking

At present, Nai’s own team chooses Spring Boot + Dubbo as the overall architecture, and is considering slowly migrating to Spring Cloud Alibaba. The main reason is that we are targeting b-side business and need to consider private deployment, while Spring Cloud is easier to transparently migrate middleware than Dubbo.

For example, migrating Spring Cloud Stream RocketMQ to Spring Cloud Stream Kafka or Spring Cloud Stream RabbitMQ requires only modification of the configuration file. Interested fat friends, can learn the following three articles:

Narrator: After all, in a private deployment, the other party may have requirements on what basic components to use, and he doesn’t like RocketMQ and wants RabbitMQ message queues.

In many cases, this is JPA’s advantage over MyBatis.

  • RocketMQ Introduction to Spring Cloud Alibaba Message Queue
  • Introduction to Spring Cloud Message Queue RabbitMQ
  • Introduction to Spring Cloud Message Queue Kafka

666. The eggs

In the future, Nai Nai will open source its own e-commerce project github.com/YunaiV/onem… , migrate to Spring Cloud Alibaba architecture, you can Star a wave.

Also, at github.com/YunaiV/Spri… In the project, Nai will continue to update more Spring Cloud and Spring Cloud Alibaba introduction and actual combat articles, so that you continue to bald!

Considering that some fat friends do not have an overall understanding of micro-services, it is recommended to read the following articles:

  • Microservices 2.0 Technology Stack Selection Manual
  • Spring Cloud Microservices Architecture in one Map
  • 12 Sketches, I Understand Microservices Architecture
  • Java Microservices Framework Selection (Dubbo and Spring Cloud?)
  • What is Microservices?
  • This is the right posture for microservice segmentation, and it’s worth learning!

References are as follows:

  • Spring Cloud Alibaba new Generation micro-service Solution
  • Spring Cloud Alibaba Official Document