Crates.io | vertx-rust |
lib.rs | vertx-rust |
version | 0.8.6 |
source | src |
created_at | 2020-12-25 08:12:45.541392 |
updated_at | 2024-05-24 04:40:40.617318 |
description | Simple Rust version of vertx tcp eventbus, tcp server and http server |
homepage | https://github.com/kathog/vertx-rust |
repository | https://github.com/kathog/vertx-rust |
max_upload_size | |
id | 327115 |
size | 177,689 |
vertx-rust its a simple implementation of vert.x in Rust. The vertx-rust engine is based on crossbeam-channel and tokio as a multi-threaded nonblocking event-driven engine. Currently, the only implementation is the cluster version based on zookeeper as a cluster manager and standalone instance. In the future there will also be other implementations of the cluster manager
Benchmarks on AMD Ryzen 7 3800X
Http server from no_cluster example:
wrk -d 90s -t 5 -c 500 http://127.0.0.1:9092/
Running 2m test @ http://127.0.0.1:9092/
5 threads and 500 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 1.36ms 715.49us 26.70ms 70.35%
Req/Sec 74.64k 8.17k 92.34k 59.76%
33426081 requests in 1.50m, 3.89GB read
Requests/sec: 371207.38
Transfer/sec: 44.25MB
Tcp server from no_cluster example:
wrk -d 90s -t 5 -c 500 http://127.0.0.1:9091/
Running 2m test @ http://127.0.0.1:9091/
5 threads and 500 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 1.45ms 768.63us 11.52ms 70.22%
Req/Sec 70.55k 8.68k 103.19k 75.66%
31591444 requests in 1.50m, 3.56GB read
Requests/sec: 350878.94
Transfer/sec: 40.49MB
serialize_cycles time: [260.7716 cycles 261.2144 cycles 261.6987 cycles]
Found 7 outliers among 100 measurements (7.00%)
1 (1.00%) low mild
3 (3.00%) high mild
3 (3.00%) high severe
deserialize_cycles time: [325.4613 cycles 325.8329 cycles 326.2337 cycles]
Found 6 outliers among 100 measurements (6.00%)
4 (4.00%) high mild
2 (2.00%) high severe
serialize_message time: [66.672 ns 67.425 ns 68.939 ns]
Found 3 outliers among 100 measurements (3.00%)
2 (2.00%) high mild
1 (1.00%) high severe
deserialize_message time: [70.224 ns 70.403 ns 70.592 ns]
Found 6 outliers among 100 measurements (6.00%)
4 (4.00%) high mild
2 (2.00%) high severe
vertx_request time: [4.5056 us 4.5872 us 4.6704 us]
Found 6 outliers among 100 measurements (6.00%)
6 (6.00%) high mild
vertx_send time: [274.87 ns 281.62 ns 289.84 ns]
Found 8 outliers among 100 measurements (8.00%)
6 (6.00%) high mild
2 (2.00%) high severe
vertx_publish time: [274.64 ns 279.26 ns 284.22 ns]
Found 5 outliers among 100 measurements (5.00%)
5 (5.00%) high mild
use vertx_rust::vertx::{VertxOptions, Vertx, NoClusterManager};
let vertx_options = VertxOptions::default();
let vertx : Vertx<NoClusterManager> = Vertx::new(vertx_options);
let event_bus = vertx.event_bus().await;
event_bus.consumer("test.01", move |m, _| {
Box::pin( async {
m.reply(..);
})
});
vertx.start().await;
use vertx_rust::vertx::{VertxOptions, Vertx, NoClusterManager};
let vertx_options = VertxOptions::default();
let vertx : Vertx<NoClusterManager> = Vertx::new(vertx_options);
let event_bus = vertx.event_bus().await;
event_bus.send("test.01", Body::String("Hello World".to_string()));
use vertx_rust::vertx::{VertxOptions, Vertx, NoClusterManager};
let vertx_options = VertxOptions::default();
let vertx : Vertx<NoClusterManager> = Vertx::new(vertx_options);
let event_bus = vertx.event_bus().await;
event_bus.request("test.01", Body::String("Hello World".to_string()), move |m, _| {
Box::pin(async move {
...
})
});
use vertx_rust::vertx::{VertxOptions, Vertx, NoClusterManager};
use vertx_rust::net::NetServer;
let vertx_options = VertxOptions::default();
let vertx : Vertx<NoClusterManager> = Vertx::new(vertx_options);
let event_bus = vertx.event_bus().await;
let net_server = NetServer::new(Some(event_bus.clone()));
net_server.listen(9091, move |_req, ev| {
let mut resp = vec![];
...
resp
});
vertx.start().await;
More examples on: examples