Comparison of Spring Cloud Config and Ctrip Apollo Configuration Centers and Their Architecture
This article examines the architecture and features of Spring Cloud Config and Ctrip Apollo configuration centers, compares their strengths and weaknesses, and provides practical guidance for migrating from Spring Cloud Config to Apollo in microservice environments.
In the company's internal micro‑service infrastructure, Spring Cloud is the primary technology stack, often referred to as the "full‑stack" or "family bucket" solution.
It provides essential components such as service discovery (Eureka, Zookeeper, Consul), API gateway (Zuul), client‑side load balancing (Ribbon), circuit breaker (Hystrix), message bus (Bus), distributed configuration (Config), stream processing (Stream), and tracing (Sleuth).
The article focuses on the distributed configuration component, Spring Cloud Config, which consists of a server (the configuration center) and clients that fetch configuration from a remote Git or SVN repository.
Spring Cloud Config Overview & Architecture
Spring Cloud Config stores configuration in Git, leveraging version control for management. The architecture relies on a message bus (RabbitMQ or Kafka) for remote change notifications, and a self‑scheduling refresher is added to handle cases where the message bus fails but Git changes still occur.
Self‑scheduling refresher runs every five minutes, compares local and remote Git versions, and reloads the latest configuration to ensure eventual consistency.
While Spring Cloud Config works for small projects, it shows limitations in larger, enterprise‑level scenarios, prompting a comparison with other open‑source configuration centers.
Comparison: Apollo vs. Spring Cloud Config
The article presents a side‑by‑side comparison, highlighting Apollo's advantages such as high availability, local caching, support for multiple configuration formats (XML, JSON, YML), multi‑language clients, and proven stability in Ctrip's production environment (over 100,000 instances).
Open‑Source Configuration Center Comparison
A chart shows activity metrics of several open‑source centers; Apollo has a vibrant community with 8K+ stars and 2.8K+ forks, surpassing alternatives like Baidu's Disconf.
Apollo Overview & Architecture
Apollo is a distributed configuration center developed by Ctrip, offering centralized management of environment‑specific configurations, real‑time push, permission control, and support for Java, .NET, Go, PHP, Python, NodeJS, and C++ clients.
Main Features
Unified management of environments and clusters, hot‑release, version control, gray release, permission and audit, client monitoring, native Java/.NET clients, open API, lightweight deployment.
Apollo Architecture
Several diagrams illustrate the overall system design, high‑availability setup, and client architecture, which combines push (long‑connection) and pull (periodic) mechanisms, local caching, and subscription‑based updates.
Core Concepts
Key concepts include application (appId) , environment , cluster , namespace (private, public, inherited), and configuration items supporting various file formats.
Permission management defines roles such as system administrator, project creator, project manager, editor, publisher, and read‑only user.
Using Apollo & Migration from Spring Cloud Config
After adopting Apollo, the team added SSO and email notifications, and provided a migration path for existing Spring Cloud Config projects.
To integrate Apollo in a Spring Cloud project, add the following Maven dependency:
<dependency>
<groupId>com.letv.micro.apollo</groupId>
<artifactId>micro-apollo-spring-boot-starter</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>The custom starter wraps Apollo client functionality, enabling dynamic configuration refresh, log level changes, and removal of the original spring-cloud-starter-config dependency.
Configuration naming conventions recommend placing shared settings in a dedicated project with namespaces like dpms.application-eureka or dpms.application-zipkin , ensuring Apollo can monitor and propagate changes.
In conclusion, Apollo addresses many pain points of Spring Cloud Config, offering better high‑availability, format support, and operational stability, making it a recommended choice for enterprise microservice configuration management.
Top Architect
Top Architect focuses on sharing practical architecture knowledge, covering enterprise, system, website, large‑scale distributed, and high‑availability architectures, plus architecture adjustments using internet technologies. We welcome idea‑driven, sharing‑oriented architects to exchange and learn together.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.