Esta página se muestra en inglés. Una traducción al español está en curso.
ScriptsJul 3, 2026·3 min de lectura

rpcx — High-Performance Go RPC Framework for Microservices

rpcx is a Go RPC framework that supports multiple codecs, service discovery, and fault tolerance for building distributed microservice systems.

Listo para agents

Instalación lista para agent

Este activo puede instalarse después de elegir el runtime, revisar el plan y ejecutar el comando correspondiente.

Native · 98/100Política: permitir
Superficie agent
Cualquier agent MCP/CLI
Tipo
Skill
Instalación
Single
Confianza
Confianza: Established
Entrada
rpcx Overview
Comando de instalación directa
npx -y tokrepo@latest install 1a3aad40-767a-11f1-9bc6-00163e2b0d79 --target codex

Ejecutar después de confirmar el plan con dry-run.

Introduction

rpcx is a Go RPC framework inspired by Dubbo and Motan, designed for building distributed microservices. It provides service discovery, load balancing, fault tolerance, and multiple codec support while maintaining a simple API similar to the standard net/rpc package.

What rpcx Does

  • Provides high-performance RPC communication over TCP, HTTP, QUIC, and KCP
  • Supports multiple serialization codecs including JSON, Protobuf, MsgPack, and Thrift
  • Integrates with service registries like etcd, Consul, ZooKeeper, and mDNS
  • Offers client-side load balancing with round-robin, weighted, hash, and geographic strategies
  • Includes circuit breaker, rate limiting, and retry mechanisms for fault tolerance

Architecture Overview

rpcx follows a provider-consumer model. Servers register services with a discovery backend and listen for connections. Clients look up service addresses from the registry and send requests using a pluggable transport and codec. Middleware plugins intercept calls for logging, tracing, authentication, and metrics. The protocol uses a compact binary header for minimal overhead.

Self-Hosting & Configuration

  • Add to your Go module: go get github.com/smallnest/rpcx
  • Register services on the server with server.RegisterName
  • Configure service discovery by passing a registry plugin (etcd, Consul, etc.)
  • Set client-side options for timeout, retry count, and load balancing strategy
  • Enable TLS by providing certificate files in the server and client configuration

Key Features

  • Sub-millisecond latency in benchmarks with connection pooling and multiplexing
  • Bidirectional communication allowing servers to push notifications to clients
  • Group and version-based service routing for canary deployments
  • OpenTelemetry integration for distributed tracing and metrics
  • Gateway mode that exposes RPC services as HTTP/JSON endpoints

Comparison with Similar Tools

  • gRPC-Go — HTTP/2 and Protobuf only, broader language support, no built-in discovery
  • Go kit — toolkit approach requiring more boilerplate, more flexibility in transport
  • Kratos — Bilibili's framework, more opinionated, tighter integration with Kubernetes
  • Kitex — ByteDance's RPC framework, optimized for Thrift, strong internal ecosystem

FAQ

Q: How does rpcx compare to gRPC in performance? A: In benchmarks, rpcx matches or exceeds gRPC throughput for Go-to-Go communication due to its lighter protocol and connection multiplexing.

Q: Can I use Protobuf with rpcx? A: Yes. Set the codec to Protobuf on both client and server. rpcx supports multiple codecs simultaneously.

Q: Does rpcx support streaming? A: rpcx supports bidirectional communication. For full streaming semantics similar to gRPC streams, use the XClient broadcast or fork patterns.

Q: What service registries are supported? A: Built-in plugins for etcd, Consul, ZooKeeper, Nacos, and mDNS. Custom registries can be added by implementing the registry interface.

Sources

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados