Skip to content

Performance

Luca Cominardi edited this page May 12, 2022 · 9 revisions

⚠️WARNING⚠️

You are reading the old and no longer maintained zenoh wiki.

More recent information can be found on the zenoh website.


The Zenoh distribution includes simple tests to check the performance. We recommend you take a look at these examples, and appreciate that to ensure we deliver numbers that are close to what an user can experiment on similar hardware, we use the most user-friendly API to write these tests. In other terms, we do not play tricks trying to write convoluted or exotic code to gain performance. We write these tests as you should for usability and maintainability.

Checkout Zenoh

$ git clone git@github.com:eclipse-zenoh/zenoh.git
$ cd zenoh 
$ git checkout rust-master

Build targets

Zenoh can be built via cargo as shown below.

NOTE: in order to properly test the performance, Zenoh needs to be compiled in release mode. Remember to invoke cargo with the --release parameter when building.

$ cargo build --release
$ cargo build --release --examples

Run performance tests

NOTE: Remember to invoke cargo with the --release parameter when running the performance tests.

TCP as transport protocol

By default Zenoh operates over TCP to transmit data. Zenoh scouting will take care of autonomously establishing Zenoh sessions to discovered peers.

# run the subscriber
$ cargo run --release --example zn_sub_thr 

# run the publisher with <payload size> (1024 below)
$ cargo run --release --example zn_pub_thr 1024

UDP as transport protocol

Zenoh can also operate over UDP by explicitly providing the Zenoh locator to listen on. Zenoh scouting will take care of autonomously establishing Zenoh sessions to discovered peers.

# run the subscriber and listen (i.e., accept connections) on an OS-assigned UDP port
$ cargo run --release --example zn_sub_thr -- -l udp/0.0.0.0:0

# run the publisher with <payload size> (1024 below) and listen on an OS-assigned UDP port
$ cargo run --release --example zn_pub_thr 1024 -l udp/0.0.0.0:0

NOTE 1: Be aware that by using UDP as transport protocol some of the messages could go lost since no retransmission mechanism, nor congestion control, is implemented in Zenoh yet. Reliability in Zenoh is currently under development. The status of the Zenoh roadmap can be checked here.

NOTE 2: In case of using UDP in high-throughput scenarios, it is recommended to set the UDP buffer size on the host to a reasonable size. Usually, default values for UDP buffers are undersized. Setting UDP buffers on the host to a size of 4M can be considered as a safe choice. Usually, on Linux systems this could be achieved by executing the following commands:

$ sysctl -w net.core.rmem_max=4194304
$ sysctl -w net.core.rmem_default=4194304

Results

The results reported below refer to Zenoh operating over TCP on a System76 Linux Laptop with an Intel Core i7-8565U processor. Please do not hesitate to contact us on Gitter if you have any questions.

Note

During ours tests we discovered that our machines were equipped with Intel i219 Ethernet cards. Apparently, these cards suffer some performance issues under heavy TCP load and recent versions of the Linux kernel. If you happen to use the same cards when testing Zenoh, you might want to look at this workaround to mitigate the performance degradation.