Backend Development 7 min read

tRPC: A Plugin‑Based Backend RPC Framework for Cloud‑Native Environments

tRPC is a highly extensible, plugin‑driven backend RPC framework designed to unify disparate service stacks, support cloud‑native components, and provide cross‑language, multi‑protocol, and streaming capabilities while delivering strong performance and easy integration for large‑scale enterprises.

High Availability Architecture
High Availability Architecture
High Availability Architecture
tRPC: A Plugin‑Based Backend RPC Framework for Cloud‑Native Environments

In the early days of the Internet, rapid iteration and diverse business scenarios led to fragmented backend stacks with varying languages, frameworks, protocols, and governance systems, creating high integration costs as businesses grew and cross‑service collaboration increased.

To address these challenges, especially within Tencent’s massive and varied ecosystem, the tRPC framework was created, adopting a plugin‑based architecture that emphasizes openness and extensibility.

The overall architecture consists of a core framework and a set of plugins; the core is divided into three layers: the Communication layer (supporting TCP, UDP, and a Protocol Buffers‑based tRPC protocol with extensible codecs), the Service Governance layer (abstracting discovery, load balancing, monitoring, tracing, etc., via plugins), and the Invocation layer (providing synchronous, asynchronous, one‑way, and streaming RPC calls).

Plugins act as bridges between the core and external components, using an interface‑based plugin factory and AOP‑style interceptor filters to inject custom logic such as validation, request replay, fault injection, monitoring, tracing, logging, and authentication.

Key plugin categories include Codec (protocol encoding/decoding), Naming (service registration, discovery, load balancing, circuit breaking), Config (configuration loading and hot‑reloading), Metrics (monitoring reporting), Logging (log collection), Tracing (distributed tracing), and Telemetry (combined tracing, metrics, and logging).

Additional features comprise an Admin management interface, cross‑language support via Protocol Buffers, multiple communication protocols (e.g., gRPC), streaming RPC for large files and AI use‑cases, a rich ecosystem of plugins for service mesh components (Consul, Prometheus, OpenTelemetry, etc.), extensibility for custom business needs, and flow‑control and overload protection mechanisms.

Performance tests on a Tencent Cloud SA2 VM (AMD EPYC Rome, 8 cores, 2.60 GHz, 16 GB RAM) show high throughput with P99 latency around 10 ms and robust handling of tail‑latency scenarios, demonstrating suitability for diverse workloads such as gateways, recommendation, gaming, streaming, AI, and storage.

After four years of development, tRPC is widely used across Tencent’s internal services and adopted by external partners (e.g., reading platforms, music services, cloud collaborators). The project is open‑source with repositories at https://trpc.group/, https://github.com/trpc-group, and https://github.com/trpc-ecosystem.

backendPerformanceCloud NativemicroservicesRPCPlugin Architecture
High Availability Architecture
Written by

High Availability Architecture

Official account for High Availability Architecture.

0 followers
Reader feedback

How this landed with the community

login 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.