The following six aspects are introduced:

  1. Definition of Spring Cloud Alibaba

  2. Development history of Spring Cloud Alibaba

  3. Features of Spring Cloud Alibaba

  4. Spring Cloud Alibaba tools

  5. Future planning of Spring Cloud Alibaba

1. Definition of Spring Cloud Alibaba (SCA)

Spring Cloud Alibaba aims to provide a one-stop solution for microservices development. The project includes components needed to develop distributed applications and services so that developers can easily develop distributed applications using the Spring Cloud programming model.

It is a very reliable microservices development framework for business, which has passed the test of multiple Singles’ Day.

2. Development history of SCA:

  • In 2008, Alibaba started using Dubbo internally.
  • In early 2009, version 1.0 was released.
  • In early 2010, version 2.0 was released.
  • In October 2011, Alibaba announced open source, version 2.0.7.
  • In March 2012, version 2.1.0 was released.
  • In March 2013, version 2.4.10 was released.
  • In October 2014, version 2.3.11 was released, and later version was suspended.
  • In October 2014, Dangdang forked a version of Dubbo named Dubbox-2.8.0 and supported the HTTP REST protocol.
  • The first version of Spring Cloud was released in January 2016.
  • In September 2017, Alibaba restarted maintenance, focused on upgrading JDK and component versions, and released version 2.5.4/5.
  • In October 2017, version 2.5.6 was released.
  • In November 2017, version 2.5.7 was released, and Spring Boot was integrated later.
  • On October 31, 2018, Spring Cloud Alibaba officially entered the official incubator of Spring Cloud and released the first preview version.
  • On December 12, 2018, Spring Cloud Netflix announced that most of its components are in maintenance mode, meaning that no new features are being developed for these components and the ecosystem is gradually disappearing.
  • On July 24, 2019, Spring Community announced that Spring Cloud Alibaba has officially graduated from Spring Cloud Incubator and become an official project of the Spring Community.

Ali Cloud is promoting Spring Cloud Alibaba internally, which is more combined with Cloud native.

2.1 Spring Cloud project activity ranking by vendors:

GCP: Google Cloud Platform

2.2 Release of SCA:

Star: collection

Watch: attention

-Chuck: I’ll fork out

3. SCA features:

First let’s take a look at the composition framework of SCA:

SCA Static framework

SCA dynamic framework

3.1 Composition of Spring Cloud Alibaba

  • Sentinel flow control and service degradation: Support for WebServlet, WebFlux, OpenFeign, RestTemplate, Dubbo access restriction and degradation stream capabilities. It can modify traffic limits and downgrade rules in real time through the console at run time, and also supports monitoring limits and downgrade metrics.
  • Nacos service registration and discovery: Services can be registered, and customers can use Spring-hosted beans to automatically integrate to discover instances.
  • Nacos Distributed Configuration: Supports external configuration in distributed systems and automatically refreshes when configuration changes.
  • RPC services: Extend Spring Cloud clients RestTemplate and OpenFeign to support calling Dubbo RPC services.
  • Event-driven: Support for building highly extensible event-driven microservices that connect to shared messaging systems.
  • Seata Distributed Transactions: Supports high performance and easy to use distributed transaction solutions.
  • OSS Ali Cloud Object Storage: large-scale, secure, low-cost, highly reliable cloud storage service. Supports storage and access of any type of data in any application anytime, anywhere.
  • Ali Cloud SchedulerX: Accurate, highly reliable, highly available scheduled job scheduling service with response time in seconds.
  • Ali Cloud SMS: Ali Cloud SMS service covers the world and can provide convenient, efficient and intelligent communication functions to help enterprises contact customers quickly.

3.2 Comparison of Spring Cloud series components among manufacturers:

3.3 SCA Components:

3.3.1 DUBBO

Dubbo CEO in 2017 (when Dubbo was restored after three years)

Ali uses HSF internally for business attributes and scale. I have to mention that some current articles always compare Spring Cloud to Dubbo when talking about microservices. It should be emphasized that Dubbo’s future positioning is not to be a comprehensive solution for microservices, but to focus on RPC. Become an important component in the microservice ecosystem. As for the service governance requirements derived from microservitization, we will actively adapt open source solutions in Dubbo and even launch independent open source projects to support them. The audience mainly comes from domestic friends and individual developers, hoping to expand the users to the world in the future, and compete with gRPC (based on HTTP 2.0) and Finagle in RPC field on behalf of Chinese people.

If there is a priority between SCA components, then the Dubbo RPC service invocation must be the soul component of SCA. We can see from the speech of Spring Cloud Alibaba when it restarted after 3 years of suspension that Dubbo, as a remote service invocation scheme in distributed micro-service framework, can be regarded as one of the core modules.

There are currently two main types of service invocation, one based on RPC and the other based on Restful APIS. Spring Cloud official, Spring Cloud Netflix service call is Feign and OpenFeign, based on Restful API; Dubbo RPC is rPC-based.

Comparison of RPC and Restful apis:

RPC is mainly used for service invocation within a company, with low performance consumption, high transmission efficiency and complex implementation.

HTTP is mainly used for external heterogeneous environments, such as browser interface invocation, App interface invocation, and third-party interface invocation.

RPC usage scenarios (large websites with a large number of internal subsystems and interfaces are suitable for RPC) :

  • Long links. It reduces network overhead by eliminating the need for three handshakes per communication, as HTTP does.
  • Register the publishing mechanism. RPC frameworks generally have registries, rich monitoring management, publishing, offline interfaces, dynamic extension, etc., which are unperceptive and unified operations for callers.
  • Security, no exposure to resource operations.
  • Microservices support. RPC framework is a powerful support for the recently popular servitization architecture and servitization governance.

Dubbo requires the interface and version between the service caller and provider to be exactly the same, and the update is joint, so the interface maintenance is more troublesome, which is not conducive to the upgrade and release. However, REST protocols are relatively lightweight, meaning that interface changes do not make a big difference, so they are more flexible. But flexibility comes at the cost of supporting REST service invocations, which can lead to service integration problems (which can be solved with uniform documentation and versioning, such as Swagger) because the interface definition is too light and the definition document is inconsistent with the actual implementation.

3.3.2 Nacos service registration and Discovery + distributed configuration

Nacos is a dynamic service discovery, configuration management, and service management platform that makes it easier to build cloud-native applications. Services are first class citizens of Nacos, which supports almost any type of service, such as Dubbo, gRPC, Spring Cloud Restful services, or Kubernetes services.

Nacos provides four main functions.

  • Service discovery and service health check

Nacos makes it easy for services to register themselves and discover other services through DNS or HTTP interfaces. Nacos also provides real-time health checks of services to prevent requests from being sent to malfunctioning hosts or service instances.

  • Dynamic configuration Management

Dynamically configuring services enables you to manage the configuration of all services in a centralized and dynamic manner in all environments. Nacos eliminates the need to redeploy applications and services when the configuration is updated, making configuration changes more efficient and agile.

  • Dynamic DNS Service

Nacos supports weighted routing, making it easier for you to implement mid-tier load balancing, flexible routing policies, flow control, and simple DNS resolution services in production environments within data centers. It helps you easily implement DNS-BASED service discovery and prevents applications from coupling to vendor-specific service discovery apis.

  • Service and metadata management

Nacos provides easy-to-use service dashboards that help you manage service metadata, configuration, Kubernetes DNS, service health and metrics statistics.

3.3.3 Flow Control and Service Degradation Sentinel

Sentinel uses QPS, response time, and system load to determine how to control flow, enforce break rules, and protect the system.

As distributed systems become more popular, reliability between services becomes more important than ever. Sentinel takes “flow” as the entry point and works in flow control, flow integration, link interruption, system adaptive protection and other areas to ensure the reliability and resilience of microservices.

Sentinel has been widely used in Alibaba, and in the past 10 years has covered almost all the core scenarios of the Singles’ Day shopping festival, such as the need to limit burst traffic to meet system capacity in “Second Kill” and the need to cut peak traffic to fill valley.

To use Sentinel, there are only 2 steps to complete:

(1) Define resources

@sentinelResource Resource definition tag

Sentinel integrates with Spring Cloud, Spring Boot, gRPC and other frameworks. The services, methods and code fragments provided by them are our resources.

(2) Configure rules

Flow control Flow control rules

field describe The default value
resource The name of the resource
count The threshold value
grade Flow control metric (QPS or number of concurrent threads) QPS
limitApp Refer to the specified caller The default
strategy By resource itself or other resource (refResource) or entry (refResource) Resource itself
controlBehavior Traffic shaping control behavior (outright rejection, queuing, slow start) Direct refused to

Degrade rule

field describe The default value
resource The name of the resource
count The threshold value
grade Disconnect strategy (slow request ratio/error ratio/error count) Slow request ratio
timeWindow Disconnect recovery timeout (in seconds)
minRequestAmount The breaker can calculate the minimum number of calls (per sliding window period) required prior to ratio or total (starting at 1.7.0) 5
statIntervalMs Sliding Window period (since 1.8.0) 1000
slowRatioThreshold Slow ratio threshold, applicable only to slow ratio policies (starting from 1.8.0)

System protection System protection rules

field describe The default value
highestSystemLoad Maximum system load, threshold of load 1 -1 (invalid)
avgRt Mean response time -1 (invalid)
maxThread Number of concurrent threads -1 (invalid)

Authority rules Permission rules

Sentinel does not have the impact of thread pooling, is semaphore isolation and is much lighter than traditional Hystrix.

Sentinel’s Ecological landmark

Ali Cloud application high availability service architecture diagram

AHAS traffic protection is a commercial product of Sentinel, an open source framework, and a core component of Alibaba’s Singles Day technology system. Based on Sentinel, AHAS supports more business functions.

Core competence

Functional description AHAS traffic protection Open source Sentinel
Basic flow control degradation, system protection functions support support
Slow SQL identification with fuses support Does not support
Cache Protection (Redis, Memcached) support Does not support
Fully automated hosted, highly available cluster flow control service support Does not support
Managed Service Mesh cluster flow control support Does not support
Progressive circuit breaker downgrading strategy support Does not support
K8s automatic elasticity support Does not support
PHP applies high availability protection support Does not support

3.3.4 Seata distributed transactions

Support high performance and easy to use distributed transaction solution, simple extensible autonomous transaction architecture.

It is divided into three parts:

Transaction Coordinator (TC): Maintains the state of global and branch transactions and drives global commit or rollback.

Transaction manager (TM): Defines the scope of a global transaction: starts a global transaction, commits or rolls back a global transaction.

Resource Manager (RM): Manages resources for branch transaction processing, communicates with TCS to register branch transactions and report status of branch transactions, and drives commit or rollback of branch transactions.

A typical lifecycle for distributed transactions managed by Seata:

  1. TM asks TC to start a new global transaction. TC generates xids that represent global transactions.
  2. Xids propagate through the invocation chain of microservices.
  3. RM registers the local transaction as a branch of the corresponding global transaction from XID to TC.
  4. TM requires the TC to commit or roll back the corresponding global transaction for the XID.
  5. TC drives all branch transactions under the corresponding global transaction of the XID to complete the branch commit or rollback.

3.3.5 Event-driven RocketMQ

Support for building highly extensible event-driven microservices that connect to shared messaging systems.

Distributed message queue based on publish/subscribe mode, with asynchronous, decoupled, peak cutting features. At present, Alibaba Cloud ONS service is based on RocketMQ, which is widely used.

3.3.6 OSS Ali Cloud Object Storage

Large-scale, secure, low-cost, highly reliable cloud storage services. Supports storage and access of any type of data in any application anytime, anywhere. Alibaba’s commercial object storage middleware is widely used.

3.3.7 AliYun SchedulerX

Accurate, highly reliable, highly available scheduled job scheduling services with response times in seconds. A distributed task scheduling product developed by Ali middleware team provides second-level, accurate, highly reliable and highly available timing (based on Cron expression) task scheduling service.

3.3.8 Aliyun SMS

Ali Cloud SMS service covers the world, can provide convenient, efficient, intelligent communication functions, to help enterprises quickly contact customers.

It is the preferred communication capability for the majority of enterprise customers to reach the mobile phone users quickly.

You can send captchas, notification classes, and marketing messages by calling an API or using a group messaging assistant.

Domestic verification SMS second level contact, arrival rate of 99%;

International/Hong Kong, Macao and Taiwan SMS coverage of more than 200 countries and regions, safe and stable, widely used by overseas enterprises.

Currently used merchants:

4. SCA tools

Bootstrap site of Spring Cloud Alibaba: start.aliyun.com, which mainly has 2 tools: ** Java engineering scaffolding **, ** sandbox hands-on lab **.

Internal slogan:

Install the Alibaba Cloud Toolkit immediately to reduce repetitive work and free up developer creativity.

4.1 Java Engineering Scaffolding

4.2 Sandbox hands-on laboratory

4.2.1 Several demo scenarios of Sandbox Lab, free resources can be directly created in Aliyun and automatically deployed:

4.2.2 You can also create your own Demo project through Java engineering scaffolding and deploy it automatically through sandbox LABS:

Environment introduction

The environment is a separate set of running containers. You only need to interact with the container through a browser. This environment provides two interactive modes: command line and file browser. You can choose the user mode. These tools allow you to view, modify, compile, and run custom Java code.

Some limitations:

  • This environment is only 1 hour of use time, the expiration of the environment automatically released;
  • Because some ports are required by the environment’s own services, be careful to avoid port conflicts, especially: 80, 8080, 8090
  • You can modify port configurations in the application.properties file. You can modify port configurations based on your selected components
  • The environment has been built into many major languages including Java, Go, Python, Nodejs, PHP, Ruby; And a number of major tool environments, including git and Maven.

Screenshot of sandbox usage interface:

Server application deployment process Screenshot:

The demo will not run in ROS due to a problem with the resource orchestration stack.

4.2.3 SCA Scaffolding — Cloud Toolkit

In addition, the plug-in Cloud Toolkit provides a number of tools for improving the Cloud native development process, as well as some common functions such as:

  • Local IDE projects are one-click deployed to any remote server
  • Local IDE projects are one-click deployed to any Kubernetes
  • Local IDE project one-click package and push Docker image to the Ali Cloud image repository
  • One-click deployment of local IDE projects to Aliyun ECS, EDAS (enterprise-level distributed Application Service), SAE (Serverless Application Engine), Web+, Small program cloud and ACK (container service Kubernetes)
  • Built-in Terminal
  • File uploader
  • View the remote server runtime logs
  • Ali Cloud small program development tools
  • Ali cloud computing development tools
  • Built-in SQL executor
  • Apache Dubbo and Spring Cloud Framework project templates & code generation
  • Remote Java program runtime diagnostic tool
  • Remote debugging of microservices

Click to understand the details of the product: cn.aliyun.com/product/clo…

Currently, Cloud Toolkit supports the following ides:

IntelliJ, Visual Studio Code, Eclipse, PyCharm

One-click deployment improves performance

5. Future planning of SCA

This picture isSCA 2020 MeetUpTechnical experts of Spring Cloud Alibaba in Hangzhou station for its future planning.

5.1 It is divided into three stages:

(1) Stability improvement: Ensuring stability is the top priority; Deal with the stock issue as soon as possible.

(2) Follow up the official Spring Cloud & Spring Boot new version; Solve new version compatibility problems;

(3) New features: Dubbo Gateway; Distributed tracking; Function Compute programming ecology;

Let’s talk about SCA’s new feature planning, which is divided into three areas: Dubbo gateway, distributed tracing, and Function Compute programming ecology.

5.2 Why does SCA make efforts in these three aspects?

Dubbo gateway

First, the gateway is a component that SCA does not currently have, but is very important for microservice development. The rival products are Gateway for Spring Cloud’s official website, Zuul Gateway for Spring Cloud’s Netflix, and the open source Kong Gateway.

So what is a gateway?

Gateway is also called the internetwork connector or protocol converter. The gateway is the most complex network interconnection device at the transport layer. It is only used for the interconnection of two networks with different high-level protocols. The gateway repackages the received information to suit the needs of the destination system. The gateway can also provide filtering and security functions. Most gateways run at the application layer, the top layer of the OSI layer 7 protocol.

For example:

You want to talk to Xiao Ming, but you don’t know Xiao Ming’s contact information. So you ask the teacher, the teacher is DNS. Simply speaking, the gatekeeper of your community is your gateway.

Xiao One-spot: Grandpa Li, may I ask the head teacher for Xiao Ming’s phone number?

Grandpa Li: Ok, you wait. (Then Uncle Li called your head teacher and got xiao Ming’s phone number.) Yes, his home number is 211.99.99.99

Tiny Spot: That’s great! Uncle Li, I want to find Xiao Ming, please help me contact Xiao Ming.

Uncle Li: No problem. (Then Uncle Li sent a request to the telephone office to connect xiaoming’s phone number. The last step, of course, was transferred to Uncle Wang in the courtyard of Xiaoming’s home, and then Uncle Wang transferred the call to Xiaoming’s home.)

So you got in touch with Xiao Ming.

The gateway also supports traffic limiting, API forwarding, and UNIFIED API management.

SCA lacks this gateway functionality, and they need a Dubbo gateway to fill the gap.

Distributed tracking

Distributed tracing is often referred to as link tracing.

Nowadays, more and more applications are migrating to the cloud native architecture based on microservices. Microservices architecture is very powerful, but it also brings many challenges, especially how to debug the application and how to monitor the call relationship and state between multiple services. How to effectively monitor the microservice architecture becomes the key to the successful operation and maintenance of the microservice architecture. In the language of software architecture, this is to enhance the Observability of microservices architecture.

The order in which the services of the order system are called

The monitoring of microservices mainly includes the following three aspects:

  • You can collect logs to monitor the running status of the system and services
  • Metrics are collected to monitor the performance of systems and services
  • With distributed tracing, trace the details of how service requests are processed across distributed components

Functional calculation

Functional computing is an event-driven, fully managed computing service. With functional computing, you don’t need to purchase and manage infrastructure such as servers; you just write and upload code. Functional computing prepares you for computing resources, runs tasks flexibly and reliably, and provides log query, performance monitoring, and alarm capabilities.

With functional computing, you can quickly build any type of application or service and only pay for the resources that the task actually consumes.

Functional computing is an implementation of the Serverless architecture. So what is serverless?

Architecture evolution diagram for Serverless