Location>code7788 >text

Spring Cloud Alibaba: One-Stop Microservices Solution

Popularity:714 ℃/2024-12-10 05:45:14

I. Introduction

Spring Cloud Alibaba (SCA for short) Is an open source microservices framework built on Spring Cloud , designed to solve the distributed system of service governance , configuration management , service discovery , message bus and other issues . It integrates a variety of Alibaba open source distributed services technology , provides a series of efficient , flexible and easy to use solutions to help developers more easily build and manage microservice architecture .

c381050b-3d0c-4adf-b653-d55a1e98601a

Spring Cloud Alibaba is a one-stop solution for microservices development that combines Alibaba's own rich microservices practices, and is a major component of the second-generation implementation of Spring Cloud. It absorbs the core architectural ideas of the Spring Cloud Netflix microservices framework and makes high-performance improvements. Since Spring Cloud Netflix entered into maintenance, Spring Cloud Alibaba gradually replaced it as the mainstream microservice framework.

image

II. Development

2.1 Development history

Spring Cloud Alibaba is an extension based on the Spring Cloud ecosystem and is designed to provide developers with more support for cloud-native applications, especially features related to Alibaba. It combines the simplicity of Spring and the power of Alibaba to help developers easily build distributed systems.

1. Initial phase (2016)

Spring Cloud Alibaba's development dates back to 2016, when Aliyun's product team and the Spring team started working together to leverage Spring Cloud's framework to implement a microservices architecture and enhance Spring Cloud by integrating with Aliyun's services. This collaboration started with the need to integrate Spring Cloud with Dubbo, Aliyun's open source RPC framework.

  • contextsSpring Cloud Alibaba was developed to combine Alibaba's open source frameworks such as Dubbo and Nacos to provide high-performance microservices governance, and Spring Cloud is one of the most popular development frameworks for microservices architectures.Spring Cloud Alibaba was developed for this purpose, aiming to combine Alibaba's distributed services with the Spring Cloud system to enable developers to better build Spring Cloud Alibaba was developed to combine Alibaba's distributed services with the Spring Cloud system to enable developers to better build Spring-based microservice architectures.
  • 2016: Alibaba began to fully embrace Spring Boot, and began to integrate its own middleware with Spring Boot, such as developing thespring-boot-starter-sentinel​、spring-boot-starter-diamondetc. Starter.
2. Spring Cloud Alibaba Founded and Released (2018)
  • December 2017: Spring Cloud Alibaba has officially entered the Spring Cloud Incubator, marking the program's official public disclosure. Initially namedspring-cloud-alibabacloud, which was later simplified tospring-cloud-alibaba​。
  • July 2018: Spring Cloud Alibaba officially open source , provides support for Nacos Config, Nacos Discovery, Sentinel and OSS four core components .
  • October 2018: First release 0.1.0 & 0.2.0, adapted to Spring Cloud Edgware and Finchley versions, added support for RocketMQ Binder and Bus RocketMQ.

In 2018, Spring Cloud Alibaba's project was formally established and the first version was released. This version realizes the deep integration of Spring Cloud and Alibaba Cloud's core technologies, especially the seamless integration of components such as Nacos (a service discovery and configuration management platform), Sentinel (a flow control and fusion degradation framework), and RocketMQ (a messaging middleware) with Spring Cloud.

  • Key Features

    • Nacos: Service discovery and configuration management, providing dynamic configuration and service governance capabilities.
    • Sentinel: Service governance capabilities such as flow control, fusion, flow limiting and degradation.
    • Dubbo: Ali open source high-performance RPC framework that supports communication between microservices .
    • RocketMQ: AliCloud's distributed messaging middleware, supporting high concurrency and high availability messaging.
3. Functional expansion and stabilization (2019-2020)
  • April 2019: Preview Release versions 0.9.0, 0.1.2 & 0.2.2 have been released, first adapted to Spring Cloud Greenwich, added Dubbo Spring Cloud and Seata components, and realized the function of calling Dubbo services using Spring Cloud client.
  • July 24, 2019: Spring Cloud officially announced Spring Cloud Alibaba graduation, warehouse migration to Alibaba GitHub OSS, becoming the first domestic open source project into the Spring community.
  • August 2019: Release of the first post-graduation versions 1.5.0, 2.0.0 & 2.1.0 with further enhancements such as the Sentinel Gateway module.
  • October 3, 2019: Spring Cloud Alibaba is officially "listed" as one of the recommended Spring Cloud specification implementations.

Spring Cloud Alibaba continues to improve and optimize after its initial release, gradually adding support for more Alibaba products, such as:

  • Alibaba Cloud OSS (Object Storage Service) : Integration with OSS for file storage management.
  • Spring Cloud Alibaba Support Spring Boot: With the introduction of Spring Boot, Spring Cloud Alibaba also started supporting this version in 2019, improving the compatibility and performance of the framework.
  • 增强的 Dubbo 支持: Supports seamless integration of Dubbo and Spring Cloud, further enhancing the ability to make RPC calls.

During this period, the Spring Cloud Alibaba team also optimized the high availability, dynamic scalability, and high concurrency of microservices, and improved the relevant capabilities of service governance.

4. Stable release and ecological refinement (2021-2022)

In 2021, Spring Cloud Alibaba released several new versions to support more Alibaba Cloud services and further enhance integration with the Spring Cloud ecosystem.

  • Nacos and Spring Cloud Compatibility Enhancements: Nacos not only enhances service discovery capabilities, but also provides more comprehensive configuration management capabilities for microservices.
  • Further refinements to Sentinel: Sentinel's integration in Spring Cloud Alibaba is more stable and supports features such as flow control, fusion, and flow limiting to help the microservice architecture cope with high concurrency pressure.
  • Unified Configuration Center: The configuration center of AliCloud is deeply integrated with the configuration functions of Spring Cloud to realize the unified configuration management of microservice systems.
  • AliCloud Service Support Enhancement: Integration of more services from AliCloud, including cloud databases, cloud storage, container services, etc. simplifies the complexity of using AliCloud services in a Spring Cloud environment.
5. Latest developments (2023 and beyond)

In 2023 and beyond, Spring Cloud Alibaba will continue to drive the development of cloud-native microservices architectures and further deepen its support for Alibaba cloud-native technologies. Key trends include:

  • Spring Cloud Kubernetes Integration: With the widespread use of Kubernetes in containerization and microservice management, Spring Cloud Alibaba is starting to focus more on integrating with Kubernetes to provide automated container management, service discovery, and other features.
  • Enhanced Container Support and CI/CD Process Optimization: Support for containers and CI/CD processes further helps organizations build efficient microservice applications in cloud-native environments.
  • Serverless architecture support: Spring Cloud Alibaba may better support Serverless architectures, helping organizations quickly build event-driven, auto-scaling microservices systems.

2.2 Versions

The Spring Cloud Alibaba release history reflects the framework's increasing integration with the Spring Cloud ecosystem, as well as the addition of support for more Aliyun-native technologies. The following is a summary of the Spring Cloud Alibaba release history:

1. Spring Cloud Alibaba (2018 release)

Release time: Early 2018

  • contexts: Spring Cloud Alibaba is starting to roll out as part of the Spring Cloud ecosystem. This release marks the initial integration of Spring Cloud with Alibaba's native technologies, with the main goal of enabling developers to use some of Alibaba's open source components in Spring Cloud, such asNacos(Service Discovery and Configuration Management),Sentinel(Flow control and fusion mechanism),Dubbo(high-performance RPC framework), etc.

  • Main characteristics

    • Nacos Integration: Provides service discovery, configuration management, and dynamic provisioning capabilities for Spring Cloud.
    • Sentinel Integration: Flow control, fusing, current limiting, and degradation functions are integrated.
    • Dubbo Integration: RPC calling framework to support high performance communication between microservices.
    • RocketMQ Integration: Message middleware support.
    • Spring Boot Support: Support for Spring Boot version for enhanced compatibility and stability.

2. Spring Cloud Alibaba (2019 release)

Release time: mid-2019

  • contexts: Building on the previous version, Spring Cloud Alibaba enhances compatibility with the Spring Cloud ecosystem, introducing several new features, and in particular further optimizing the integration of Spring Cloud and Spring Boot.

  • Main characteristics

    • Support for Spring Cloud Hoxton Edition: Spring Cloud Alibaba supports the Spring Cloud Hoxton version, which further enhances the adaptation to the Spring Cloud ecosystem.
    • Nacos enhancements: Nacos becomes the core service discovery and configuration management framework and supports richer dynamic configuration capabilities.
    • Sentinel enhancements: More powerful flow control and fusion features have been added to improve the stability of microservices.
    • Support for Dubbo: Further optimized support for Dubbo, enhancing the performance and stability of the RPC framework.
    • Spring Cloud Stream Support: Further enhancements to the integration of Spring Cloud Stream and message queues, in particular deep integration with RocketMQ.
    • CloudNative Features: With the popularity of containerization and Kubernetes, Spring Cloud Alibaba is starting to support more cloud-native features, providing native support for microservice architectures.

3. Spring Cloud Alibaba 2. (2020 release)

Release time: 2020

  • contexts: Spring Cloud Alibaba 2. is an ongoing optimization and enhancement of the previous version. As the microservices architecture evolves, Spring Cloud Alibaba also adds more cloud-native support features.

  • Main characteristics

    • Nacos Service Discovery and Configuration Management Enhancements: Further enhance Nacos' stability and performance for large-scale service discovery and dynamic configuration management.
    • Sentinel Console Enhancements: Sentinel Console enhancements provide more intuitive traffic monitoring and control.
    • Better Spring Boot 2. support: Enhanced support for Spring Boot 2. versions and resolved some compatibility issues.
    • RocketMQ Integration: Enhanced integration with RocketMQ to support more message queuing scenarios.

4. Spring Cloud Alibaba 2. (2021 release)

Release time:: 2021

  • contexts: Spring Cloud Alibaba 2. is a major upgrade to the Spring Cloud Alibaba series, adding more support for Spring Cloud versions and more integration with the Aliyun technology stack.

  • Main characteristics

    • Support for Spring Cloud Versions: Enhanced compatibility with Spring Cloud versions.
    • Nacos Version Support: Supports the Nacos release, adding more configuration management and service governance capabilities that enhance the usability and flexibility of distributed system management.
    • Sentinel Traffic Control Enhancements: Further enhancements to mechanisms such as flow control, fusion, and flow limiting, adding more support for complex microservice scenarios.
    • Spring Cloud Kubernetes Integration: Supports integration with Kubernetes to better support containerized and cloud-native applications.

5. Spring Cloud Alibaba (2022 release)

Release time: 2022 and beyond

  • contexts: Spring Cloud Alibaba is a major release of the framework, adding support for higher versions of Spring Cloud and enhancing support for cloud-native technologies such as containerization and Kubernetes.

  • Main characteristics

    • Spring Cloud Version Support: Support for the Spring Cloud version has begun, further improving compatibility with the Spring Cloud ecosystem.
    • Nacos 3.0: Nacos version 3.0 was released, further enhancing service discovery, configuration management and dynamic provisioning capabilities.
    • Micro-services governance capacity enhancement: Continue to optimize Sentinel's performance in microservices governance, improving the effectiveness of mechanisms such as flow control and fusion.
    • Kubernetes and container support enhancements: Further optimize integration with Kubernetes to support more efficient containerized deployment and O&M.

6. Spring Cloud Alibaba (expected future release)

Future releases are expected to continue to enhance integration with Spring Cloud and Alibaba services, especially as cloud-native technologies further evolve, Spring Cloud Alibaba may include support for additional cloud services, serverless architectures, and with other cloud platforms. Specific release dates and features will be confirmed in subsequent releases.

version matching

Spring Boot corresponds to Spring Cloud Alibaba and Spring Cloud version:

  • Spring Boot 3.2.4: Recommended useSpring Cloud Alibaba 2023.0.1correspondingSpring Cloud version 2023.0.1.0
  • Spring Boot 3.2.0: Recommended useSpring Cloud Alibaba 2023.0.0correspondingSpring Cloud version 2023.0.0.0-RC1
  • Spring Boot 3.0.2: OptionalSpring Cloud Alibaba 2022.0.0.0maybe2022.0.0.0-RC2correspondingSpring Cloud versions are all 2022.0.0

Spring Cloud Alibaba subcomponent version correspondence:

  • Sentinel: Versions from 1.6.3 to 1.8.6, depending on the Spring Cloud Alibaba version.
  • Nacos: The version range covers 1.1.1 to 2.3.2, again based on the SCA version selection.
  • RocketMQ: Versions from 4.4.0 to 5.1.4, updated with SCA version updates.
  • Dubbo: Although some of the entries in the table show "~", specific versions are recorded in some of them, e.g., 2.7.13, 2.7.8, etc.
  • Seata: Versions from 0.7.1 to 1.7.0, depending on the SCA version.

To ensure the stability and compatibility of your application, please select the appropriate version of Spring Cloud Alibaba and its subcomponents according to the Spring Boot version of your project by referring to the correspondence above.

III. Characteristics

  1. Seamless integration with Spring Cloud
    Spring Cloud Alibaba is based on the Spring Cloud ecosystem, inheriting the advantages of Spring Cloud and adding Alibaba's excellent solutions in the field of distributed systems.
  2. high scalability
    Provides rich microservice components and flexible extension mechanism , adapt to the needs of large-scale distributed systems .
  3. High Performance and High Availability
    Integration of several components of Alibaba open source to ensure that the microservice system has high performance and high availability, especially with high concurrency and high traffic scenarios of application compatibility.
  4. Simplify Development and O&M
    Provide one-stop solution to reduce the complexity of development and operation and maintenance, improve development efficiency and reduce system maintenance costs.

IV. Main components

2c4768ba-5c04-4991-9f29-b031e8f845a7

  1. Nacos (Dynamic Configuration Management and Service Discovery)

    • functionality: Nacos provides service discovery, service health checking, configuration management, and other functions that are common in distributed systems.
    • Usage Scenarios: It supports microservice registration and discovery, can dynamically load and refresh configurations, and is suitable for cloud-native applications.
    • vantage: Support for multiple language clients, support for DNS, HTTP protocol service discovery, easy to expand.
  2. Sentinel (flow control and fuse de-escalation)

    • functionality: Sentinel is a lightweight flow control component that supports flow limiting, fusion, degradation, and other features that can guarantee service stability.
    • Usage Scenarios: Commonly used for flow control, meltdown and degradation to ensure that critical services continue to run smoothly in the event of system overstress.
    • vantage: Supports fine-grained configuration of flow control, flexible customization of rules, and provides rich monitoring and dashboards.
  3. RocketMQ (Message Queue)

    • functionality: RocketMQ is a distributed, high-performance message queue that supports transactional messaging and large-scale message processing capabilities.
    • Usage Scenarios: Used to handle high-concurrency, high-traffic asynchronous messaging, commonly used in decoupled services, the implementation of event-driven architecture and so on.
    • vantage: high throughput , low latency , support for sequential messages , transactional messages and other advanced features , easy to use with Spring Boot .
  4. Dubbo (high-performance RPC framework)

    • functionality: Dubbo is Alibaba open source a high-performance , lightweight RPC framework , mainly used for remote communication between microservices .
    • Usage Scenarios: For high concurrency , high availability of distributed systems in the inter-service call , support for multiple protocols and registries .
    • vantage: High-performance Remote Procedure Call (RPC) capabilities, support for interface load balancing, fault tolerance, automatic service discovery and other features.
  5. Spring Cloud Alibaba Config (Centralized Configuration Management)

    • functionality: Provides centralized configuration management for Spring Cloud, with support for dynamic refreshes and hot updates.
    • Usage Scenarios: For scenarios where multiple microservices share configurations, you can centralize the management and distribution of configurations and support dynamic refresh and version control of configurations.
  6. Spring Cloud Alibaba Seata (Distributed Transactions)

    • functionality: Seata is a distributed transaction solution that solves transaction consistency problems across multiple microservices.
    • Usage Scenarios: It is suitable for scenarios in distributed systems where data consistency needs to be ensured, such as financial payments, order processing, etc.
    • vantage: Provides AT, TCC, SAGA and other transaction modes to support transaction management in microservices.
  7. Spring Cloud Alibaba TCC (Distributed Transaction Control)

    • functionality: The TCC schema is a distributed transaction solution provided by Seata that offers more flexible transaction models.
    • Usage Scenarios: For distributed transaction scenarios that require strong consistency guarantees, especially in finance, e-commerce and other fields.

V. Application Scenarios

Spring Cloud Alibaba provides a series of powerful components and services for a variety of microservice application scenarios. It not only inherits the excellent features of Spring Cloud, but also combines Alibaba's practices and technical advantages in large-scale distributed systems. The following are some typical application scenarios of Spring Cloud Alibaba:

1. e-commerce industry

  • sales promotion (for a product or service)Spring Cloud Alibaba can guarantee the stable operation of the transaction system by limiting the flow of degradation (Sentinel), distributed transactions (Seata) and other functions.
  • Inventory management and order processingNacos' configuration management and service discovery capabilities enable you to dynamically adjust inventory policies and order allocation logic to ensure data consistency and accuracy in highly concurrent situations.

2. Financial sector

  • clear paymentsSeata's distributed transaction support helps achieve consistency across multiple services for payment services that require strong consistency, ensuring secure and reliable fund flows.
  • Risk Control and ComplianceSentinel's meltdown and degradation mechanism allows for a quick response when certain modules fail, protecting the core business from disruption, while Nacos' configuration management facilitates the flexible adjustment of risk-control rules.

3. internet service

  • Content Delivery Network (CDN) The RocketMQ messaging capability allows you to build a real-time content update push system that accelerates information dissemination.
  • social networking platformNacos is used for service registration and discovery, simplifying the deployment and maintenance of back-end services, while Sentinel protects against transient traffic impacts from hot topics.

4. logistics distribution

  • Route Planning and Scheduling OptimizationManage the transfer of goods between multiple warehouses with Seata to ensure consistency and coordination, and utilize Sentinel to automate recovery in the event of an exception.
  • Real-time tracking and feedback: RocketMQ supports the collection of massive log and location information to provide users with accurate parcel status query services.

5. Internet of Things (IoT)

  • Device Connectivity and Data Acquisition: RocketMQ's high throughput characteristics are ideal for handling data streams from a large number of sensors or smart terminals.
  • Remote monitoring and control: Nacos-based service discovery mechanism allows easy integration of third-party hardware devices and management and control through a unified interface.

6. Enterprise Resource Planning (ERP) systems

  • Modular Development and IntegrationSpring Cloud Alibaba provides a complete tool chain to help ERP developers more easily realize the loosely-coupled design of various subsystems for subsequent expansion and upgrading.
  • Cross-sectoral collaboration: Utilizing Nacos and Sentinel to work in tandem facilitates information sharing and process automation across different departments, improving overall operational efficiency.

7. Cloud Computing Platform

  • Cloud Native Application DeploymentSpring Cloud Alibaba is a perfect fit for container orchestration platforms such as Kubernetes, providing a one-stop solution from infrastructure to business logic.
  • Microservices Governance: Whether it's an API gateway or a service grid, Spring Cloud Alibaba provides a rich set of plug-ins and middleware to enhance service governance for applications on the cloud.

8. education technology

  • Online Learning PlatformThe platform is designed to provide a fast synchronization of course materials and assignment submissions via RocketMQ to enhance the teacher-student interaction experience, while Nacos and Sentinel ensure stable operation during peak periods.
  • Examination and Assessment SystemDistributed Transactions: Seata's distributed transactions can be used to ensure the accuracy of critical operations such as test score entry, while Sentinel can be used to take timely action in unforeseen circumstances without disrupting the normal order of the test.

Spring Cloud Alibaba is not only suitable for the industry-specific application scenarios mentioned above, but also its flexibility and scalability make it an ideal choice for any enterprise or organization wishing to adopt a microservices architecture. Whether you are building a new project or revamping an existing system, Spring Cloud Alibaba provides solid technical support to help your organization reach its digital transformation goals faster and better.