Cloud Native 20 min read

Mastering Service Routing in Tencent TSF: Governance, Gray Release, Unitization, and Near Routing

This article explains how Tencent Cloud's TSF implements service routing—including governance routing, fault‑tolerant protection, multi‑branch testing, full‑link gray release, message traffic coloring, unit‑level routing, and near‑routing—detailing configuration parameters, practical scenarios, and step‑by‑step setup guidance for large‑scale microservice deployments.

Tencent Cloud Middleware
Tencent Cloud Middleware
Tencent Cloud Middleware
Mastering Service Routing in Tencent TSF: Governance, Gray Release, Unitization, and Near Routing

Governance Routing Overview

In large‑scale microservice environments, service routing is essential for scenarios such as full‑link gray release, multi‑branch testing, and region‑aware routing. TSF’s tag‑based traffic labeling and automatic tag propagation enable routing rules to be configured via the console, allowing traffic to be colored and split based on label values.

Configuration Parameters

Traffic source configuration: tag type, tag name, logical relation, value

Traffic destination: target application, destination type, deployment group/version, weight

Requests are routed according to whether the tag key/value matches the governance rule, then forwarded to the specified deployment unit according to the configured weight.

Governance routing diagram
Governance routing diagram

Fault‑Tolerant Protection

If a version (e.g., V1) becomes completely unavailable, TSF‑SDK automatically routes all traffic to the remaining healthy instances (e.g., V2) without manual intervention. Once the failed instances recover, traffic distribution returns to the original weight ratios.

Test Environment Multi‑Branch Scenario

When a single test environment must host both a feature branch and a hot‑fix branch, TSF can create separate deployment groups for the hot‑fix version and use governance routing rules combined with tag parameters (e.g., tag=feature or tag=hotfix) to direct traffic accordingly, eliminating the need for version replacement.

Configuration Steps

Include a tag parameter (in Path, Query, Header, or Cookie) to indicate the desired branch.

Create a Tag plugin in the microservice gateway, configure the tag conversion rule, and bind the plugin to a gateway group.

Create hot‑fix deployment groups for the relevant services and publish them.

Add routing rules for the hot‑fix services in TSF’s Service Governance → Service Routing section and enable them.

Multi‑branch routing configuration
Multi‑branch routing configuration

Full‑Link Gray Release

Gray release gradually shifts a portion of production traffic to a new version, allowing real‑world validation while limiting impact. A "lane" groups related deployment units; a gray rule evaluates request attributes and routes matching traffic to the appropriate lane.

Key concepts:

Lane : a set of deployment groups representing a gray environment.

Gray rule : defines conditions for traffic to enter a lane.

Lane entry : can be a microservice gateway or a service that performs rule evaluation.

Full‑link gray release flow
Full‑link gray release flow

Message Traffic Coloring

When using Kafka for asynchronous communication, TSF propagates lane identifiers (LaneId) through thread‑local storage so that messages are consumed only by services belonging to the same lane. Undecorated messages are processed by services outside any lane.

Unitization (Set‑Level Routing)

Unitization isolates traffic at the business unit (Set) level, supporting multi‑region disaster recovery, elastic scaling, and fault isolation. It builds on TSF’s microservice gateway and namespace capabilities, with global namespaces hosting gateways and ordinary namespaces providing logical isolation.

Typical steps:

Configure unitization via the TSF console (see official docs).

Deploy services into unit‑specific namespaces.

Define routing rules that match unit keys (e.g., user‑ID suffix) to direct traffic to the correct Set.

Unitization architecture
Unitization architecture

Near Routing

Near routing selects the closest available instance (same AZ, then same Region) for a request, improving latency and availability in multi‑AZ deployments. TSF‑SDK reads registration information (AZ, Region, deployment group) and prefers instances in the same AZ; if none are healthy, it falls back to Region‑level or global instances.

Near routing diagram
Near routing diagram

Applicable Scenarios

Ideal for cross‑AZ disaster‑recovery and same‑city active‑active architectures, where consumer services automatically switch to a healthy provider in another AZ when the local one fails.

Conclusion

TSF provides a comprehensive suite of routing capabilities—governance routing, fault‑tolerant protection, multi‑branch testing, full‑link gray release, message traffic coloring, unit‑level routing, and near routing—covering most traffic‑management scenarios in large‑scale microservice systems.

gray-releaseservice routingtraffic management
Tencent Cloud Middleware
Written by

Tencent Cloud Middleware

Official account of Tencent Cloud Middleware. Focuses on microservices, messaging middleware and other cloud‑native technology trends, publishing product updates, case studies, and technical insights. Regularly hosts tech salons to share effective solutions.

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.