vertx-rust
Introduction
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
Features
- Nonblocking eventbus consumer | local_consumer
- Nonblocking eventbus request
- Nonblocking eventbus send
- Nonblocking eventbus publish
- Nonblocking multi-threaded tcp server - based on tokio
- Nonblocking multi-threaded http server - based on hyper
- Blocking and nonblocking simple hyper http client wrapper
- Zookeeper cluster manager
Benchmarks
Benchmarks on Dell G3 with Intel Core i7-8750H
Wrk benchmarks
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 2.56ms 1.87ms 39.83ms 82.74%
Req/Sec 40.29k 4.66k 63.80k 70.89%
18022166 requests in 1.50m, 2.08GB read
Requests/sec: 200034.56
Transfer/sec: 23.66MB
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 2.47ms 3.20ms 99.24ms 91.42%
Req/Sec 50.67k 9.84k 105.72k 75.66%
22653909 requests in 1.50m, 2.53GB read
Requests/sec: 251512.38
Transfer/sec: 28.78MB
Microbenchmarks
vertx_request time: [8.1251 us 8.1982 us 8.2809 us]
Found 7 outliers among 100 measurements (7.00%)
5 (5.00%) high mild
2 (2.00%) high severe
vertx_send time: [1.4308 us 1.4435 us 1.4594 us]
Found 8 outliers among 100 measurements (8.00%)
3 (3.00%) low severe
2 (2.00%) low mild
3 (3.00%) high severe
vertx_publish time: [1.8024 us 1.8305 us 1.8527 us]
serialize_message time: [203.27 ns 203.72 ns 204.20 ns]
Found 6 outliers among 100 measurements (6.00%)
6 (6.00%) high mild
deserialize_message time: [145.16 ns 145.46 ns 145.79 ns]
Found 3 outliers among 100 measurements (3.00%)
3 (3.00%) high severe
Work with vertx-rust
Code examples
Eventbus consumer
use ;
let vertx_options = default;
let vertx : = new;
let event_bus = vertx.event_bus;
event_bus.consumer;
vertx.start;
Eventbus send
use ;
let vertx_options = default;
let vertx : = new;
let event_bus = vertx.event_bus;
event_bus.send;
Eventbus request
use ;
let vertx_options = default;
let vertx : = new;
let event_bus = vertx.event_bus;
event_bus.request;
Tcp server
use ;
use NetServer;
let vertx_options = default;
let vertx : = new;
let event_bus = vertx.event_bus;
let net_server = new;
net_server.listen;
vertx.start;
More examples on: examples