Cloud Native 15 min read

How Tencent Polaris Revolutionizes Service Discovery and Governance for 90% of Its Services

This article introduces Tencent's open‑source Polaris platform, explains its core concepts and features such as service discovery, load balancing, circuit breaking, and dynamic routing, and shares practical experiences of deploying Polaris in Qidian's microservice environment.

Tencent Qidian Tech Team
Tencent Qidian Tech Team
Tencent Qidian Tech Team
How Tencent Polaris Revolutionizes Service Discovery and Governance for 90% of Its Services

Background

Service discovery enables consumers to automatically locate service address lists without knowing deployment locations or IPs. Common solutions include Consul, Nacos, Istio, and Tencent’s open‑source Polaris, which handles registration, discovery, traffic control, circuit breaking, and observability, serving over 90% of Tencent’s services.

Basic Concepts of Polaris

In Polaris each service has a unique name. An RPC call consists of a consumer (upstream) sending a request to a provider (downstream). Service instances (registered nodes, also called RS) represent concrete business nodes under a service.

Service registration refers to adding a node to a service, i.e., instance registration.

Core Features

Service Discovery

Three typical cache scenarios determine the discovery flow: (1) no in‑memory cache on first access – order 1‑2‑3‑4‑5; (2) no in‑memory cache but disk cache after restart – order 1‑2‑7‑5; (3) in‑memory cache present – order 1‑5. The server returns a revision with each sync; unchanged data yields code 200001.

Load Balancing

Polaris supports stateless (e.g., weighted random, weighted round‑robin) and stateful strategies that keep a client’s requests bound to the same instance.

Circuit Breaking

Polaris implements fault instance circuit breaking with configurable thresholds (failure ratio, consecutive failures) and a default isolation time of 30 seconds. It follows the Martin Fowler circuit‑breaker model with Closed, Open, and Half‑Open states, and includes a “full‑kill‑full‑alive” fallback when all instances of a target are isolated.

Dynamic Routing

Instances can be labeled with logical (version, protocol, business set) and physical (region, city, campus) attributes. Polaris provides plug‑in routing: pre‑routing (filter zero‑weight), rule‑based routing, proximity routing (region‑city‑campus), and post‑routing (filter unhealthy or circuit‑broken instances). Metadata routing allows directing traffic based on custom tags such as env:test.

Polaris in Qidian

Component Selection

Qidian previously used the legacy L5 discovery component, which suffered complex architecture, limited language support, high latency at low QPS, limited features, and poor observability. Polaris was chosen for its rich feature set, extensive language support, high scalability, high availability, and seamless migration from L5.

Multi‑Set Environment Routing

Qidian leverages Polaris metadata routing to isolate traffic among test, gray, and production sets without code changes, using environment variables as metadata tags. The flow includes injecting environment info, registering container IP and tags via the Polaris controller, and routing requests based on those tags.

Polaris Nginx Module

The Polaris Nginx module replaces hard‑coded upstream IPs with Polaris service names, providing service discovery, load balancing, circuit breaking, and session sticky directly in Nginx. It matches request headers, cookies, and query parameters against metadata to route traffic to the correct set.

Conclusion

Polaris offers a unified, open‑source service discovery and governance platform for Tencent, covering registration, health checks, DNS, traffic scheduling, circuit breaking, and access control. It is widely adopted internally and invites external contributions.

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.

Cloud NativeMicroservicesservice discoverytraffic managementdynamic routingcircuit breaker
Tencent Qidian Tech Team
Written by

Tencent Qidian Tech Team

Official account of Tencent Qidian R&D team, dedicated to sharing and discussing technology for enterprise SaaS scenarios.

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.