| Crates.io | rubbo |
| lib.rs | rubbo |
| version | 0.1.0 |
| created_at | 2026-01-24 13:26:37.416845+00 |
| updated_at | 2026-01-24 13:26:37.416845+00 |
| description | Rust implementation of Apache Dubbo 3. High-performance RPC framework with Triple protocol. |
| homepage | https://github.com/huiyang233/rubbo |
| repository | https://github.com/huiyang233/rubbo |
| max_upload_size | |
| id | 2066677 |
| size | 93,126 |
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.
tokio and hyper for asynchronous I/O.| 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 |
Define your service interface using the #[rubbo::service] macro:
#[rubbo::service]
trait HelloService {
async fn say_hello(&self, name: String) -> String;
}
Implement the service and start a provider:
use rubbo::{ProviderBuilder, Registry, Protocol, Serialize};
struct HelloServiceImpl;
#[rubbo::service_impl(group = "test_group", version = "1.0.0", name = "com.example.HelloService")]
impl HelloService for HelloServiceImpl {
async fn say_hello(&self, name: String) -> String {
format!("Hello, {}!", name)
}
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
tracing_subscriber::fmt::init();
rubbo::ProviderBuilder::new()
.service(HelloServiceImpl)
.application("rubbo-provider-example")
.registry(Registry::Nacos("nacos://127.0.0.1:8848".to_string()))
.protocol(Protocol::Triple)
.serialization(Serialize::Fastjson2)
.port(50051)
.start()
.await?;
Ok(())
}
Create a consumer to invoke the service:
use rubbo::{ConsumerBuilder, Registry};
#[rubbo::reference(interface_name = "com.example.HelloService", version = "1.0.0", group = "test_group")]
trait HelloService {
async fn say_hello(&self, name: String) -> String;
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
tracing_subscriber::fmt::init();
let consumer = ConsumerBuilder::new()
.application("rubbo-consumer-example")
.registry(Registry::Nacos("nacos://127.0.0.1:8848".to_string()))
.reference::<dyn HelloService>()
.build()
.await?;
let service = consumer.reference::<dyn HelloService>().await?;
let response = service.say_hello("World".to_string()).await?;
println!("Response: {}", response);
Ok(())
}
We provide a built-in benchmark tool to measure the performance of Rubbo.
cargo run --release --example benchmark_provider
BENCH_CONCURRENCY=50 BENCH_REQUESTS=20000 cargo run --release --example benchmark_consumer
| 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.
MIT