Building a Stable High‑Traffic Microservice System with Open‑Source Components and Consul‑Based Service Discovery
The talk explains how Tencent’s Liu Zhixin built a stable, high‑traffic microservice platform by layering a multi‑tenant, token‑authenticated access service in front of open‑source Consul, aggregating registrations and watches, scaling horizontally, and adding HA features such as circuit‑breakers, caching, graceful shutdown and rolling updates for reliable service discovery.
This article summarizes a talk by Tencent expert engineer Liu Zhixin on how to build a stable, high‑traffic microservice system using open‑source components. It introduces the architecture of a microservice platform, the challenges of data‑plane and control‑plane, and the need for reliable service registration and discovery.
The core of the solution is a Consul‑based service discovery system. The native Consul open‑source version lacks enterprise features such as multi‑tenant support. To address this, a Consul‑access layer is added in front of the Consul server, providing multi‑tenant capabilities, token‑based authentication, and request translation to KV operations.
Multi‑tenant is achieved by storing service instances under paths like /tenant/service/ServiceA/instance-id . The access layer intercepts registration, heartbeat, and discovery requests, aggregates them, and reduces the number of long‑living connections to the Consul server, greatly improving scalability.
Performance optimizations include aggregating watch requests, extending watch timeout from 2 s to 55 s, and reducing CPU usage on the Consul server. Horizontal scaling of the stateless access layer further alleviates pressure on the Consul leader.
High‑availability measures are discussed: handling registration failures, heartbeat loss, and empty instance lists; switching from periodic polling to watch mechanisms; adding local caches and zero‑instance protection; configuring timeouts and retries; and using circuit‑breaker (Hystrix/Resilience4j) and fallback strategies.
The article also covers graceful shutdown and rolling updates in Kubernetes using pre‑stop hooks, readiness probes, and coordination with Consul to avoid traffic spikes during instance deregistration.
Overall, the talk provides practical guidance on enhancing service discovery stability, performance, and availability in cloud‑native microservice environments.
Tencent Cloud Developer
Official Tencent Cloud community account that brings together developers, shares practical tech insights, and fosters an influential tech exchange community.
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.