explaingit

smallnest/rpcx

8,284GoAudience · developerComplexity · 4/5LicenseSetup · moderate

TLDR

A fast Go framework for building microservices using remote procedure calls, with built-in service discovery, load balancing, and support for multiple transports and message formats.

Mindmap

mindmap
  root((rpcx))
    What it does
      Go microservice RPC
      Service discovery
      Load balancing
    Transports
      TCP
      HTTP gateway
      QUIC and KCP
    Message Formats
      JSON
      Protobuf
      MessagePack
    Service Discovery
      etcd
      Zookeeper
      Consul
      Peer-to-peer
    Reliability
      Circuit breakers
      Heartbeat monitoring
      Authorization
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Build a set of Go microservices that can call each other's functions over the network as if they were local.

USE CASE 2

Connect services written in different languages (Java, Python, Node.js) to a Go backend using the HTTP gateway.

USE CASE 3

Set up automatic load balancing across multiple instances of a service using round-robin or consistent hashing.

USE CASE 4

Add circuit breakers so your app degrades gracefully when one microservice starts failing.

Tech stack

GoTCPQUICProtobufMessagePacketcdZookeeperConsul

Getting it running

Difficulty · moderate Time to first run · 30min

Requires Go and at least one service-discovery backend (etcd, Zookeeper, or Consul) for production use.

Apache 2.0, use freely in personal and commercial projects, keep the copyright and license notice.

In plain English

rpcx is a framework for building microservices in Go. Microservices are an approach to software architecture where a large application is split into many small, independent programs that communicate with each other over a network. rpcx provides the plumbing to make that communication fast and reliable, handling how services find each other, how they send and receive data, and what happens when something goes wrong. The framework is built around the concept of remote procedure calls, which let code in one service call a function in another service almost as if it were a local call. With rpcx, you write ordinary Go functions and the framework takes care of the network layer. You do not need to define special interface description files as some other RPC systems require. On the transport side, rpcx supports TCP, HTTP, QUIC, and KCP connections, and can encode messages in JSON, Protobuf, MessagePack, or raw bytes. This flexibility means clients in other languages, such as Java, Python, or Node.js, can call services written in Go. A gateway component lets any language that can make HTTP requests reach rpcx services as well. For service discovery, which is the problem of how services find the addresses of other services at runtime, rpcx supports several well-known coordination systems including etcd, Zookeeper, and Consul, as well as simpler peer-to-peer and local multicast approaches. Load balancing across multiple instances of a service can be configured with strategies like round-robin, random, consistent hashing, weighted distribution, or proximity. Additional features include circuit breakers for handling failing services, authorization, heartbeat monitoring, bidirectional communication, metrics, and an optional web-based management UI. The project is released under the Apache 2.0 license.

Copy-paste prompts

Prompt 1
Using rpcx in Go, write a minimal example of a math service that exposes an Add function, and a client that calls it over TCP.
Prompt 2
I'm using rpcx with etcd for service discovery. Write the Go code to register a service on startup and deregister it cleanly on shutdown.
Prompt 3
Show me how to configure rpcx to use Protobuf encoding instead of JSON for messages, and explain when that's the right trade-off.
Prompt 4
I have a rpcx service getting overloaded. Write the Go code to add a weighted load balancer so 70% of traffic goes to the faster server.
Open on GitHub → Explain another repo

← smallnest on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.