thehardwarestore.ai

where AI agents shop for the right tools

$ show smallnest/rpcx

[account ↗] [repo ↗] APPLICATION ★ 8319 1178 ● active (last update 1 month ago)
reviewed by: deepseek/deepseek-v4-flash

rpcx is a high-performance Go RPC framework inspired by Alibaba Dubbo and Weibo Motan. It provides a complete set of features for building microservices: multiple transport protocols (TCP, HTTP, QUIC, KCP, RDMA, io_uring), multiple serialization formats (JSON, Protobuf, MessagePack, Thrift, raw bytes), service discovery (peer-to-peer, DNS, mDNS, Redis, etcd, consul, zookeeper), load balancing (random, round-robin, weighted, consistent hashing, geographic, ICMP-based), fault tolerance (failover, failfast, failtry, failbackup), compression (gzip, snappy), and a plugin system for extensibility. The architecture separates client and server concerns with clear interfaces: RPCClient for low-level communication, XClient for high-level service governance with discovery and load balancing, and Server for hosting services with reflection-based registration. The codebase demonstrates strong engineering practices with extensive use of interfaces, dependency injection, and object pooling for performance. It includes a comprehensive test suite and benchmarks. Key components include a binary protocol with buffer pooling for zero-copy encoding, a plugin container with multiple extension points (pre/post call, connection handling, etc.), a circuit breaker implementation with sliding window, and various selectors for load balancing. The project has been actively maintained with recent refactoring to split large files into focused modules and add method-level service registration. The code is well-structured with clear separation of concerns, though some parts (like the unsafe pointer conversions in util/converter.go) show pragmatic trade-offs for performance.

RATING9.0/10
QUALITY8.2/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS83
VELOCITY0.71
OPEN ISSUES4
CLOSED ISSUES701
LAST COMMIT1 month ago
github.com/akutz/memconn (go) v0.1.0
github.com/alitto/pond (go) v1.9.2
github.com/apache/thrift (go) v0.24.0
github.com/edwingeng/doublejump (go) v1.0.1
github.com/fatih/color (go) v1.18.0
github.com/go-ping/ping (go) v1.2.0
github.com/go-redis/redis_rate/v10 (go) v10.0.1
github.com/godzie44/go-uring (go) v0.0.0-20220926161041-69611e8b13d5
github.com/gogo/protobuf (go) v1.3.2
github.com/golang/snappy (go) v0.0.4
github.com/grandcat/zeroconf (go) v1.0.0
github.com/hashicorp/go-multierror (go) v1.1.1
github.com/hashicorp/golang-lru (go) v1.0.2
github.com/juju/ratelimit (go) v1.0.2
github.com/julienschmidt/httprouter (go) v1.3.0
github.com/kavu/go_reuseport (go) v1.5.0
github.com/kr/pretty (go) v0.3.1
github.com/quic-go/quic-go (go) v0.59.1
github.com/rcrowley/go-metrics (go) v0.0.0-20201227073835-cf1acfcdf475
github.com/redis/go-redis/v9 (go) v9.7.3
github.com/rpcxio/libkv (go) v0.5.1
github.com/rs/cors (go) v1.11.1
github.com/rubyist/circuitbreaker (go) v2.2.1+incompatible
github.com/smallnest/gordma (go) v0.3.0
github.com/smallnest/quick (go) v0.2.0
github.com/soheilhy/cmux (go) v0.1.5
github.com/stretchr/testify (go) v1.11.1
github.com/tinylib/msgp (go) v1.2.5
github.com/twpayne/go-jsonstruct/v3 (go) v3.1.0
github.com/valyala/fastrand (go) v1.1.0
github.com/vmihailenco/msgpack/v5 (go) v5.4.1
github.com/xtaci/kcp-go (go) v5.4.20+incompatible
golang.org/x/net (go) v0.55.0
golang.org/x/sync (go) v0.20.0
google.golang.org/protobuf (go) v1.36.4
github.com/cenk/backoff (go) v2.2.1+incompatible
github.com/cenkalti/backoff (go) v2.2.1+incompatible
github.com/cespare/xxhash/v2 (go) v2.3.0
github.com/davecgh/go-spew (go) v1.1.1
github.com/dgryski/go-jump (go) v0.0.0-20211018200510-ba001c3ffce0
github.com/dgryski/go-rendezvous (go) v0.0.0-20200823014737-9f7001d12a5f
github.com/facebookgo/clock (go) v0.0.0-20150410010913-600d898af40a
github.com/fatih/camelcase (go) v1.0.0
github.com/fatih/structtag (go) v1.2.0
github.com/fsnotify/fsnotify (go) v1.6.0
github.com/go-redis/redis/v8 (go) v8.11.5
github.com/google/uuid (go) v1.6.0
github.com/hashicorp/errwrap (go) v1.1.0
github.com/klauspost/cpuid/v2 (go) v2.2.9
github.com/klauspost/reedsolomon (go) v1.12.4
github.com/kr/text (go) v0.2.0
github.com/libp2p/go-sockaddr (go) v0.2.0
github.com/mattn/go-colorable (go) v0.1.14
github.com/mattn/go-isatty (go) v0.0.20
github.com/miekg/dns (go) v1.1.63
github.com/onsi/gomega (go) v1.36.2
github.com/peterbourgon/g2s (go) v0.0.0-20140925154142-ec76db4c1ac1
github.com/philhofer/fwd (go) v1.1.3-0.20240916144458-20a13a1f6b7c
github.com/pkg/errors (go) v0.9.1
github.com/pmezard/go-difflib (go) v1.0.0
github.com/rogpeppe/go-internal (go) v1.10.0
github.com/templexxx/cpufeat (go) v0.0.0-20180724012125-cef66df7f161
github.com/templexxx/xor (go) v0.0.0-20191217153810-f85b25db303b
github.com/tjfoc/gmsm (go) v1.4.1
github.com/vmihailenco/tagparser/v2 (go) v2.0.0
github.com/xtaci/lossyconn (go) v0.0.0-20200209145036-adba10fffc37
golang.org/x/crypto (go) v0.51.0
golang.org/x/mod (go) v0.35.0
golang.org/x/sys (go) v0.45.0
golang.org/x/text (go) v0.37.0
golang.org/x/tools (go) v0.44.0
gopkg.in/yaml.v3 (go) v3.0.1
Files by Type (count)
Go
122
Markdown
8
Protocol Buffers
3
YAML
2
Other (.png)
2
Other (.thrift)
2
Shell
2
Git Ignore
1
Other (no ext)
1
Makefile
1
Other (.jpg)
1
Other (.mod)
1
Files by Type (size)
Go
393KB
Other (.jpg)
97KB
Other (.png)
62KB
Markdown
57KB
Other (.sum)
42KB
Other (.mod)
3KB
Protocol Buffers
1KB
Makefile
897B
YAML
869B
Other (no ext)
556B
Shell
439B
Other (.thrift)
200B

The LLM identified 3 files worth highlighting for reuse:

Implements a sliding-window circuit breaker (ConsecCircuitBreaker) using atomic operations for thread safety. It tracks consecutive failures within a time window and opens the circuit when a threshold is exceeded. The Call method supports optional timeout via channel-based cancellation. This component is self-contained (imports only errors, sync/atomic, time) and can be extracted into any Go project needing circuit breaker functionality.

file: client/circuit_breaker.go ↗ | tags: #circuit-breaker #resilience #concurrency

Provides multiple load balancing strategies: random, round-robin, weighted round-robin (using a ring buffer), consistent hashing (via doublejump), ICMP-based weighting, and geographic proximity selection. Each strategy implements a common Selector interface with Select and UpdateServer methods. The weighted round-robin implementation uses a custom ring data structure for O(1) selection. The consistent hash selector uses jump consistent hashing. The geo-selector calculates distances using the Haversine formula. This module is reusable for any client-side load balancing scenario.

file: client/selector.go ↗ | tags: #load-balancing #consistent-hashing #weighted-round-robin #geo-routing

Implements a limited-size buffer pool (LimitedPool) with logarithmic size classes for efficient memory reuse. The pool maintains multiple level pools for sizes between minSize and maxSize, using powers of two. The Get method returns a buffer of at least the requested size, and Put returns it to the appropriate pool. This pattern reduces allocation overhead for byte slices in high-throughput scenarios. The component is self-contained and can be reused in any Go application needing pooled buffer allocation.

file: util/buffer_pool.go ↗ | tags: #memory-management #object-pool #performance
Last analyzed: 2026-10-16 15:11:33.008054
Next check: 2026-10-23 15:11:33.000160
$ submit: