Rubbo π¦π
Rubbo is a high-performance, Rust-based RPC framework designed to be fully compatible with the Dubbo 3.0 ecosystem. It leverages the Triple protocol (based on gRPC/HTTP2) and supports seamless interoperability with Java Dubbo applications using Nacos for service discovery.
Features
- Triple Protocol: Fully compatible with Dubbo 3.0 Triple protocol.
- Service Discovery: Built-in support for Nacos registry.
- Macro Support: Easy-to-use attribute macros for defining services and references.
- High Performance: Built on top of
tokioandhyperfor asynchronous I/O. - Interoperability: Works out-of-the-box with Java Dubbo providers and consumers.
- Load Balancing: Pluggable load balancing strategies (default: RoundRobin).
Supported Protocols & Serialization
| Category | Type | Description | Feature Flag |
|---|---|---|---|
| Protocol | Triple | Based on HTTP/2 and gRPC, fully compatible with Dubbo 3.0. | - |
| Serialization | FastJSON | Default text-based JSON serialization. | fastjson (Default) |
| Serialization | FastJSON2 | High-performance binary JSONB format (Dubbo 3 default). | fastjson2 |
| Serialization | Hessian2 | Standard binary serialization. | hessian2 |
Getting Started
Prerequisites
- Rust (latest stable)
- Nacos Server (running on 127.0.0.1:8848 or configurable)
Defining a Service
Define your service interface using the #[rubbo::service] macro:
Implementing a Provider
Implement the service and start a provider:
use ;
;
async
Implementing a Consumer
Create a consumer to invoke the service:
use ;
async
Benchmark
We provide a built-in benchmark tool to measure the performance of Rubbo.
Environment
- OS: macOS
- Protocol: Triple (HTTP/2)
- Registry: Nacos (Local)
- Serialization: FastJSON
- Machine: Local Development Machine
Running the Benchmark
- Start Nacos Server (Ensure it's running on port 8848)
- Start the Benchmark Provider:
- Run the Benchmark Consumer:
BENCH_CONCURRENCY=50 BENCH_REQUESTS=20000
Results
| Metric | Value |
|---|---|
| Concurrency | 50 threads |
| Total Requests | 20,000 |
| QPS | ~26,384 |
| Avg Latency | 1.88 ms |
| Success Rate | 100% |
Note: Results may vary based on hardware and network conditions.
License
MIT