Cloud Native 19 min read

Why Spring Cloud Tencent Is the Go-To Cloud‑Native Solution for Java Microservices

The article explains why Spring Cloud remains the dominant Java microservice framework, introduces Tencent’s open‑source Polaris‑based Spring Cloud Tencent as a one‑stop cloud‑native solution, and details its discovery, configuration, routing, rate‑limiting, and circuit‑breaker modules, while outlining future plans and how developers can contribute.

Java High-Performance Architecture
Java High-Performance Architecture
Java High-Performance Architecture
Why Spring Cloud Tencent Is the Go-To Cloud‑Native Solution for Java Microservices

Why do we build Spring Cloud Tencent

Spring Boot + Spring Cloud remains the mainstream Java framework

In April 2014 Spring Boot released version 1.0 and after eight years it has become the de‑facto standard for Java development. In the distributed microservice field, Spring Cloud released Angel.SR5 in January 2016, extending Spring Boot’s component‑based, low‑configuration philosophy and defining a standard microservice SPI. Solutions such as Spring Cloud Netflix built on this SPI, and HTTP‑based Feign and RestTemplate provide ease of use, observability, and cross‑language advantages, leading to rapid growth of Spring Cloud.

From an industry perspective, Spring Boot + Spring Cloud is one of the most widely used Java development frameworks.

Since 2018 ServiceMesh projects like Istio have emerged, but sidecar‑based solutions bring extra resource consumption, network latency, and operational complexity, limiting their adoption in China.

Therefore, we believe Spring Boot + Spring Cloud will remain the mainstream Java microservice solution for a long time, offering low‑cost, efficient, and stable architectures.

Tencent's 2021 open‑source Polaris provides an all‑in‑one microservice solution

Polaris integrates a service registry, configuration center, and governance into a single solution, covering 90% of Tencent's business and registering over five million instances. Since its open‑source release in 2021, external companies have also adopted it.

Architects often need to choose multiple components (Zookeeper, Consul, Nacos for registry; Apollo, Nacos for config; Sentinel for rate limiting), which increases resource usage and operational complexity.

An all‑in‑one solution greatly simplifies selection, operation, and resource cost; Polaris can also be used partially, e.g., only for service discovery while keeping Apollo for configuration.

Polaris has advantages such as a stateless registry that eases maintenance and powerful service routing capabilities for complex scenarios.

Summary

Given these core reasons, using Polaris as an out‑of‑the‑box implementation for Spring Cloud is a natural fit, satisfying both Spring Cloud users and Polaris Java users.

Spring Cloud Tencent module details

Spring Cloud Tencent currently provides common microservice capabilities: service registration & discovery, configuration center, service routing, rate limiting, and metadata transmission.

Service Registration and Discovery (Spring Cloud Tencent Polaris Discovery)

This core feature implements Spring Cloud's standard service registration and discovery interfaces, allowing applications to quickly integrate with Polaris. After integration, developers can also use Polaris's advanced governance features such as scenario‑based routing and circuit breaking.

Namespace

Provides logical isolation within the same registry; service names must be unique within a namespace but can be duplicated across namespaces, useful for separating environments or business domains.

Service

Logical concept representing a specific business capability, e.g., order service, user service.

Service Instance

Physical node of a service.

Spring Cloud Tencent also offers extensions such as dynamic instance isolation and weight adjustment via Polaris console, and multi‑registry capabilities for smooth migration between different registries.

Configuration Center (Spring Cloud Tencent Polaris Config)

Polaris Config follows a three‑tuple model: Namespace, FileGroup, and File.

Namespace

Logical isolation, often used to separate environments.

FileGroup

A collection of configuration files; best practice is one FileGroup per application (or per framework, e.g., dubbo).

File

The smallest management unit, representing a single properties or YAML file.

Polaris Config provides configuration management and real‑time push capabilities. The UI displays file names in a tree structure using '/' as a delimiter, allowing clear organization by module.

Spring Boot automatically loads configuration files from the resources directory; migration only requires uploading the original files to Polaris.

Service Routing (Spring Cloud Tencent Polaris Router)

Microservice architectures split services into fine‑grained components, and ServiceMesh moves basic call‑related capabilities to a sidecar. However, sidecar solutions have drawbacks, so a one‑stop routing solution is valuable.

Metadata Routing

Instances carry metadata (environment, data center, etc.) and routing can be based on this metadata. For example, a test environment can be isolated by routing requests to instances with matching metadata.

To enable metadata routing, set the following environment variables when deploying each service:

SCT_METADATA_CONTENT_ENV=dev1

SCT_METADATA_CONTENT_TRANSITIVE=ENV

The router reads these variables and prefers instances whose ENV matches the caller.

Rule Routing

Beyond metadata, complex business scenarios require rule‑based routing, such as directing internal staff to a gray environment while external users go to production.

A typical rule example:

When the HTTP query parameter uid equals 100, the request is routed to instances with ENV=gray. Spring Cloud Tencent provides expression tags to extract values from HTTP requests:

${http.query.xxx}

${http.header.xxx}

${http.cookie.xxx}

${http.method}

${http.uri}

Nearby Routing

To reduce latency, services can be routed based on physical proximity (Campus, Zone, Region). Instances carry location metadata, and routing prefers the closest match.

Enable nearby routing by setting these environment variables on each instance:

SCT_METADATA_CAMPUS

SCT_METADATA_ZONE

SCT_METADATA_REGION

Service Rate Limiting (Spring Cloud Tencent Polaris Ratelimit)

As traffic grows, protecting services from sudden spikes is essential. Spring Cloud Tencent offers rate limiting for both Spring Web and WebFlux.

Single‑instance rate limiting

Limits QPS per individual instance. It supports fast‑fail (immediate error response) and smooth‑queue (leaky‑bucket) modes.

Distributed rate limiting

Shares a global quota across all instances of a service, useful for protecting downstream services or databases.

Custom rate‑limit rules can be defined to match specific business needs.

Service Circuit Breaker (Spring Cloud Tencent Polaris Circuitbreaker)

Detects faulty instances by reporting call results, isolates them, and periodically probes for recovery, providing automatic fallback and half‑open recovery.

Summary

For a complete list of capabilities, visit the official GitHub repository.

https://github.com/Tencent/spring-cloud-tencent
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Microservicesservice discoveryConfiguration ManagementSpring Cloudcircuit breakerPolaris
Java High-Performance Architecture
Written by

Java High-Performance Architecture

Sharing Java development articles and resources, including SSM architecture and the Spring ecosystem (Spring Boot, Spring Cloud, MyBatis, Dubbo, Docker), Zookeeper, Redis, architecture design, microservices, message queues, Git, etc.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.