Cette page est affichée en anglais. Une traduction française est en cours.
ScriptsJul 3, 2026·3 min de lecture

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.

Prêt pour agents

Installation agent prête

Cet actif peut être installé après choix du runtime, vérification du plan et exécution de la commande adaptée.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
rpcx Overview
Commande d'installation directe
npx -y tokrepo@latest install 1a3aad40-767a-11f1-9bc6-00163e2b0d79 --target codex

À exécuter après confirmation du plan en 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

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires