Slide 1

Slide 1 text

CEO/CTO ZettaScale Angelo Corsaro, PhD Zenoh Tutorial Part I

Slide 2

Slide 2 text

The Problem

Slide 3

Slide 3 text

Cloud to Microcontroller An increasing number of systems today span from the cloud down to the micro-controller This poses new challenges as existing technologies were not designed to work in this scenario And the result is… Cloud Edge Device

Slide 4

Slide 4 text

Simplicity does not precede complexity, but follows it — A. Perils The Digital Frankenstein Today, building systems that span from the micro-controller to the data-centre feels like assembling a digital Frankenstein Multiple technologies have to be stitched together only to make data fl ow end-to- end Few more have to be packed-up to deal with data storage… Not to talk about computations

Slide 5

Slide 5 text

A Cross Industry Problem Robotics Automotive IoT / Edge

Slide 6

Slide 6 text

The Solution

Slide 7

Slide 7 text

Dragons teach us that if we want to climb high we have to do it against the wind. Pub/Sub/Query protocol that Uni fi es data in motion, data at rest and computations from embedded microcontrollers up the data centre Provides location-transparent abstractions for high performance pub/sub and distributed queries across heterogeneous systems Built-in support for zero-copy and shared memory

Slide 8

Slide 8 text

Runs Everywhere Written in Rust for security, safety and performance Native libraries and API bindings for many programming languages, e.g., Rust, C/C++, Python, JS, REST, C# and Kotlin Built-in support Shared Memory and Zero Copy Supports network technologies from transport layer down- to the data link. Currently runs on, TCP/IP, UDP/IP, QUIC, Serial, Bluetooth, OpenThreadX, Unix Sockets, Shared Memory Available on embedded and extremely constrained devices and networks — 5 bytes minimal overhead Data Link Network Transport Physical …

Slide 9

Slide 9 text

Runs Everywhere OS Linux, MacOS, Windows, QNX (alpha) Embedded Targets Arduino, ESP32, mbed, Zephyr Automotive Targets AUTOSAR Classic (microSAR)

Slide 10

Slide 10 text

Router Router Any Topology Peer-to-peer Clique and mesh topologies Brokered Routed Router Router Router Client Client Routed Routers forward data to and from peers and clients Brokered Clients communicate through a router or a peer Mesh Peer Peer Peer Peer Peer Router Client Client Client Client Router Router Client Clique Peer Peer Peer Peer Client

Slide 11

Slide 11 text

Topology in Perspective

Slide 12

Slide 12 text

Router Storage Plugins Protocol Plugins MAIN MEMORY FILE SYSTEM Runtime Plugins Zenoh Flow RocksDB Router Plug-Ins

Slide 13

Slide 13 text

Adoption

Slide 14

Slide 14 text

Robotics

Slide 15

Slide 15 text

Robotics Zenoh has witnessed a strong adoption in Robotics, especially in supporting R2X over wireless networks Along with adoption has grown the number of commercially deployed solutions that build Zenoh

Slide 16

Slide 16 text

Zenoh: The RMW Alternate Intrinsic is already implementing Zenoh RMW as the major contribution for next ROS2 release The full report is available here Zenoh has been selected as the fi rst non-DDS protocol to be natively supported in ROS2

Slide 17

Slide 17 text

ROS User’s Preferred Choice A poll on the ROS2 community revealed that Zenoh was the user’s favourite choice as next generation ROS2 protocol

Slide 18

Slide 18 text

Automotive

Slide 19

Slide 19 text

Zenoh identi fi ed as the most appropriate protocol for V2X applications for autonomous and assisted driving (Final report attached to the email) ITU

Slide 20

Slide 20 text

At the Forefront of Innovation ZettaScale has been identi fi ed as one of the 10 startups in vehicle communication to be watched in 2023

Slide 21

Slide 21 text

At the Forefront of Innovation ZettaScale has been identi fi ed as one of the 20 startups in vehicle communication to be watched in 2024

Slide 22

Slide 22 text

Eclipse SDV Zenoh selected as one of the communication middleware in addition to MQTT

Slide 23

Slide 23 text

uProtocol Eclipse uProtocol selected Zenoh as the fi rst protocol to be integrated

Slide 24

Slide 24 text

GM GM selected Zenoh as the protocol for uProtocol

Slide 25

Slide 25 text

Other Verticals

Slide 26

Slide 26 text

Running on Zenoh Internet scale Analytics platforms Blockchain Industrial Automation Platforms …

Slide 27

Slide 27 text

In a recent article that evaluates mainstream protocols, including MQTT, DDS, AMQP an CoAP Amazon describes Zenoh as: “Perhaps the most viable protocol that will help us mature to this ideal model is Zenoh which is an Eclipse Incubation project” Amazon IoT

Slide 28

Slide 28 text

Programming Model

Slide 29

Slide 29 text

Abstractions Resource. A named data, in other terms a (key, value) (e.g. home/kitchen/sensor/temp, 21.5 home/kitchen/sensor/hum, 0.67) (e.g. home/*/sensor/air?_where=co2>12&_project=humidity) Selector. An expression identifying a set of resources (e.g. home/kitchen/sensor/* home/**/temp Key expression. An expression identifying a set of keys

Slide 30

Slide 30 text

Abstractions Publisher. A spring of values for a key expression Subscriber. A sink of values for a key expression Queryable. A well of values for a key expression (e.g. home/kitchen/sensor/temp home/kitchen/sensor/* ) (e.g. home/kitchen/sensor/temp home/kitchen/sensor/*) (e.g. home/**)

Slide 31

Slide 31 text

Primitives open/close — Open/Close a zenoh session. declare_keyexpr — Declares a key-expressions and optimises its representation on the wire declare_subscriber — Declares a subscriber with a user provided call-back that will be triggered when data is available. declare_publisher — Declares a publisher and optimise the communication stack for repetitive publications. Notice that Zenoh does not require a publisher in order to perform publications, this is just an optimisation. declare_queryable — Declares a queryable with a user provided call-back that will be triggered whenever a query needs to be answered.

Slide 32

Slide 32 text

Primitives put — puts a value for a key expression. delete — deletes a resource pull — Pulls data for a pull subscriber. get — Issues a distributed query and returns a stream of results. The query target, coverage and consolidation depends on policies.

Slide 33

Slide 33 text

Zenoh’s Abstractions Universality Zenoh’s abstraction are universal since they allow to express the key patterns in distributed computing, namely: Publish/Subscribe. Trivially supported by Zenoh’s Publisher and Subscriber Remote Computation. A Queryable represents a generalised computation, since it can transparently deal with replication and partitioning Storage. Represented by the combination of a Queryable and a Subscriber Additionally all these primitives enjoy location transparency by the virtue of being data-centric.

Slide 34

Slide 34 text

Storage fleet/1/** Subscriber fleet/*/car/*/position Storage fleet/2/** Publisher fleet/2/car/1/position Publisher fleet/1/car/1/position ZZ AWS Azure Private Cloud Edge Server 5G MEC 5G MEC Pull Subscriber fleet/2/car/*/position Storage fleet/1/car/1/** Storage fleet/1/car/2/** Storage fleet/1/car/3/** Subscriber fleet/2/car/*/position Subscriber fleet/2/car/1/position Subscriber fleet/2/car/*/position Pub/Sub Queryable fleet/*/adas/navigation/** Queryable fleet/2/adas/navigation/** Queryable fleet/1/adas/navigation/**

Slide 35

Slide 35 text

Storage fleet/1/** Subscriber fleet/*/car/*/position Storage fleet/2/** Publisher fleet/2/car/1/position Publisher fleet/1/car/1/position ZZ AWS Azure Private Cloud Edge Server 5G MEC 5G MEC Pull Subscriber fleet/2/car/*/position Storage fleet/1/car/1/** Storage fleet/1/car/2/** Storage fleet/1/car/3/** Get fleet/1/car/*/something Distributed Query Queryable fleet/*/adas/navigation/** Queryable fleet/2/adas/navigation/** Queryable fleet/1/adas/navigation/** Subscriber fleet/2/car/*/position Subscriber fleet/2/car/1/position Subscriber fleet/2/car/*/position

Slide 36

Slide 36 text

Storage fleet/1/** Distributed Query Subscriber fleet/*/car/*/position Storage fleet/2/** Publisher fleet/2/car/1/position Publisher fleet/1/car/1/position ZZ AWS Azure Private Cloud Edge Server 5G MEC 5G MEC Pull Subscriber fleet/2/car/*/position Storage fleet/1/car/1/** Storage fleet/1/car/2/** Storage fleet/1/car/3/** Queryable fleet/*/adas/navigation/** Queryable fleet/2/adas/navigation/** Get fleet/car/*/something Queryable fleet/1/adas/navigation/** Subscriber fleet/2/car/*/position Subscriber fleet/2/car/1/position Subscriber fleet/2/car/*/position

Slide 37

Slide 37 text

Storage fleet/1/** Subscriber fleet/*/car/*/position Storage fleet/2/** Publisher fleet/2/car/1/position Publisher fleet/1/car/1/position ZZ AWS Azure Private Cloud Edge Server 5G MEC 5G MEC Pull Subscriber fleet/2/car/*/position Storage fleet/1/car/1/** Storage fleet/1/car/2/** Storage fleet/1/car/3/** Queryable fleet/*/adas/navigation/** Queryable fleet/1/adas/navigation/** Queryable fleet/2/adas/navigation/** Computation get fleet/1/adas/navigation/car/1 Subscriber fleet/2/car/*/position Subscriber fleet/2/car/1/position Subscriber fleet/2/car/*/position

Slide 38

Slide 38 text

get fleet/1/adas/navigation/car/1 Storage fleet/1/** Subscriber fleet/*/car/*/position Storage fleet/2/** Publisher fleet/2/car/1/position Publisher fleet/1/car/1/position ZZ AWS Azure Private Cloud Edge Server 5G MEC 5G MEC Pull Subscriber fleet/2/car/*/position Storage fleet/1/car/1/** Storage fleet/1/car/2/** Storage fleet/1/car/3/** Queryable fleet/*/adas/navigation/** Queryable fleet/1/adas/navigation/** Queryable fleet/2/adas/navigation/** Computation Subscriber fleet/2/car/*/position Subscriber fleet/2/car/1/position Subscriber fleet/2/car/*/position

Slide 39

Slide 39 text

Programming API

Slide 40

Slide 40 text

Zenoh Ecosystem There are two implementations of the Zenoh protocol Eclipse Zenoh written in Rust and Eclipse Zenoh Pico written in C and targeting micro-controllers When using C/C++ APIs, applications can target either of these versions — it is a compile- time decision C C CPP Zenoh Pico Zenoh Rust C CPP Python Kotlin Java … Rust

Slide 41

Slide 41 text

Rust API

Slide 42

Slide 42 text

API Design Support for both async and sync programming model Builders everywhere to ensure evolvability Needs to “resolve” by calling res() in order to craft the request

Slide 43

Slide 43 text

Synch or Async: Pick Your Choice Zenoh supports both sync and async APIs Depending on your application and the integration requirement with other libraries and native code it may be preferable to use one or the other To decide which API to use you need to import the right “prelude”

Slide 44

Slide 44 text

Opening a Session use zenoh::prelude::sync::*; fn main() { let z = zenoh::open(config::default()).res().unwrap(); // use the session… } use zenoh::prelude::r#async::*; fn main() { let z = zenoh::open(config::default()).res().await.unwrap(); // use the session… } Sync API Async API

Slide 45

Slide 45 text

API Design Leverage modern C++ as much as possible Make API ergonomic for a C++ Programmer Avoid the use of exceptions and use variants to propagate errors

Slide 46

Slide 46 text

Opening a Session #include int main() { zenoh::Config c; auto z = std::get(zenoh::open(std::move(c))); // use the session return 0; } std::get will fail if the variant is returning an error… But what you’d want is to propagate the error explaining why the session failed. A more idiomatic way of opening a session is the following: #include int main() { zenoh::Config c; auto z = zenoh::expect(zenoh::open(std::move(c))); // use the session return 0; }

Slide 47

Slide 47 text

Publishing Data

Slide 48

Slide 48 text

Producing Data w/o a Publisher Zenoh makes it possible to “put” data without needing to declare a publisher The declaration of a publisher is just an optimisation that should be done for resources that are written regularly let _ = z .put(“zetta/webinar/zenoh/tutorial/time", "15:00") .res() .await;

Slide 49

Slide 49 text

Producing Data w/o a Publisher Zenoh makes it possible to “put” data without needing to declare a publisher The declaration of a publisher is just an optimisation that should be done for resources that are written regularly z.put(“zetta/webinar/zenoh/tutorial/time", "15:00");

Slide 50

Slide 50 text

Producing Data with a Publisher The declaration of a publisher is just an optimisation It is a way to indicating to Zenoh that a given resource is going to be written often and thus implement a series of runtime and wire optimisations — in other terms make the common case fast! let z_pub = z.declare_publisher("zetta/webinar/zenoh/unleashed/video") .res() .await .unwrap(); // grab frame z_pub.put(frame.to_vec()).res().await.unwrap(); Publications can be made for any valid key expression, such as, zetta/webinar/zenoh/unleashed/* and zetta/webinar/zenoh/**

Slide 51

Slide 51 text

Producing Data with a Publisher The declaration of a publisher is just an optimisation It is a way to indicating to Zenoh that a given resource is going to be written often and thus implement a series of runtime and wire optimisations — in other terms make the common case fast! auto p = zenoh::expect(z.declare_publisher("demo/bulletin/ascii-image")); // generate ascii-image p.put(s_img); Publications can be made for any valid key expression, such as, zetta/demo/bulletin/* and demo/**, etc.

Slide 52

Slide 52 text

What Kind of Data can Zenoh Grok? Zenoh provides support for a series of encoding an makes it simpler to deal with data these types For instance, you can natively writes, Strings, Integers, Floats, JSON, etc. Applications are able to provide their own encoding impl Encoding { pub const EMPTY: Encoding = ...; pub const APP_OCTET_STREAM: Encoding = ...; pub const APP_CUSTOM: Encoding = ...; pub const TEXT_PLAIN: Encoding = ...; pub const APP_PROPERTIES: Encoding = ...; pub const APP_JSON: Encoding = ...; pub const APP_SQL: Encoding = ...; pub const APP_INTEGER: Encoding = ...; pub const APP_FLOAT: Encoding = ...; pub const APP_XML: Encoding = ...; pub const APP_XHTML_XML: Encoding = ...; pub const APP_XWWW_FORM_URLENCODED: Encoding = ...; pub const TEXT_JSON: Encoding = ...; pub const TEXT_HTML: Encoding = ...; pub const TEXT_XML: Encoding = ...; pub const TEXT_CSS: Encoding = ...; pub const TEXT_CSV: Encoding = ...; pub const TEXT_JAVASCRIPT: Encoding = ...; pub const IMAGE_JPEG: Encoding = ...; pub const IMAGE_PNG: Encoding = ...; pub const IMAGE_GIF: Encoding = ...; }

Slide 53

Slide 53 text

Few Examples let _ = z .put(“zetta/webinar/zenoh/tutorial/time", "15:00") .res().await; let _ = z .put(“zetta/webinar/zenoh/tutorial/stars”, 5.0) .res().await; let _ = z .put(“zetta/webinar/zenoh/tutorial/episodes", 1) .res().await; let mut vec = Vec::::new(); vec.push(1); vec.push(2); vec.push(3); let _ = z .put(“zetta/webinar/zenoh/tutorial/attachment", vec) .res() .await; text/plain application/ fl oat application/integer application/octet-stream

Slide 54

Slide 54 text

What Kind of Data can Zenoh Grok? let webinar = r#" { "title": "Understanding Zenoh", "speaker": "Angelo Corsaro" "date": "26/11/2023", "time": "15.00", "timezone": "CET" "abstract": "some cute abstract here" "stars": 5.0, "episodes": 1 "live-audio": "zetta/webinar/zenoh/unleashed/audio" "live-video": “zetta/webinar/zenoh/unleashed/video" }"#; let _ = z .put("zetta/webinar/zenoh/unleashed", webinar) .encoding(KnownEncoding::AppJson) .res() .await; application/json JSON is also natively supported This makes it easy to produce and consume JSON

Slide 55

Slide 55 text

Setting Encoding in C++ auto p_opts = zenoh::PutOptions(); p_opts.set_encoding(zenoh::EncodingPrefix::Z_ENCODING_PREFIX_APP_CUSTOM); z.put("demo/bulletin/ascii-image", slbd, p_opts); In C++ options are provided by means of a dedicated type associated to each operation. In the case of put, this is called PutOptions

Slide 56

Slide 56 text

Subscribing

Slide 57

Slide 57 text

Subscriber Declaration A subscriber is declared by providing a key expression, such as, zetta/webinar/zenoh/ unleashed/* and zetta/webinar/** Zenoh guarantees that a subscriber will receive the put operation performed for keys- expressions that match with that of the subscriber Example: A Subscriber for zetta/webinar/zenoh/** matches zetta/webinar/zenoh/unleashed, zetta/webinar/zenoh/unleashed/title, zetta/webinar/zenoh/ROS2Connector etc. let sub = z .declare_subscriber("zetta/webinar/**") .res() .await .unwrap();

Slide 58

Slide 58 text

Subscriber Declaration A subscriber is declared by providing a key expression, such as, zetta/webinar/zenoh/ unleashed/* and zetta/webinar/** Zenoh guarantees that a subscriber will receive the put operation performed for keys- expressions that match with that of the subscriber Example: A Subscriber for zetta/webinar/zenoh/** matches zetta/webinar/zenoh/ unleashed, zetta/webinar/zenoh/unleashed/title, zetta/webinar/zenoh/ ROS2Connector etc. auto s = zenoh::expect( z.declare_subscriber(“zetta/webinar/**”, callback)); The subscription will be closed once the subscriber goes out of scope.

Slide 59

Slide 59 text

Samples received by a subscriber can be consumed asynchronously using a stream and as such avoiding any inversion of control This keeps the code highly readable and can leverage all the stream combinators Subscribers as Streams while let Ok(s) = sub.recv_async().await { println!(" ({}, {}) -- Encoding: {}", s.key_expr.as_str(), s.value, s.encoding); } let rstream = sub.recv_async().fuse() .map(|rs| { if let Ok(s) = rs { Some((s.key_expr, s.value)) } else { None }});

Slide 60

Slide 60 text

QoS

Slide 61

Slide 61 text

Reliability Reliability in Zenoh is controlled by the Subscriber let sub = z .declare_subscriber("zetta/webinar/**") .reliability(reliability) .res() .await .unwrap(); pub enum Reliability { #[default] BestEffort, Reliable, }

Slide 62

Slide 62 text

Congestion Control The producer has control over the congestion control policy pub enum CongestionControl { #[default] Drop = 0, Block = 1, } let _ = z .put("zetta/webinar/zenoh/unleashed/attachment", vec) .congestion_control(CongestionControl::Block) .res() .await; let z_pub = z.declare_publisher("zetta/webinar/zenoh/unleashed/video") .priority(Priority::RealTime) .congestion_control(CongestionControl::Drop) .res().unwrap(); The default congestion control can be provided when creating a publisher

Slide 63

Slide 63 text

Controlling Priority pub enum Priority { RealTime = 1, InteractiveHigh = 2, InteractiveLow = 3, DataHigh = 4, #[default] Data = 5, DataLow = 6, Background = 7, } let _ = z .put("zetta/webinar/zenoh/unleashed/time", “15:00") .priority(Priority::DataHigh) .res() .await; Zenoh supports tra ff i c scheduling based on 7 priority levels The priority can be individually controlled for each put operation Higher priority samples over-takes lower priority ones

Slide 64

Slide 64 text

Setting QoS in C++ auto p_opts = zenoh::PutOptions(); p_opts .set_encoding(zenoh::EncodingPrefix::Z_ENCODING_PREFIX_APP_CUSTOM) .set_congestion_control(zenoh::CongestionControl ::Z_CONGESTION_CONTROL_DROP) .set_priority(zenoh::Priority::Z_PRIORITY_INTERACTIVE_HIGH); z.put("demo/bulletin/ascii-image", slbd, p_opts);

Slide 65

Slide 65 text

Building

Slide 66

Slide 66 text

Cargo [package] name = “your-app" version = "0.1.0" edition = "2021" [[bin]] name = "pub" path = "src/pub.rs" [[bin]] name = "sub" path = "src/sub.rs" [dependencies] zenoh = "0.10.1-rc" async-std = { version = "=1.12.0", features = ["attributes", "unstable"] }

Slide 67

Slide 67 text

CMake cmake_minimum_required(VERSION 3.27) project(Your_Project) set(CMAKE_CXX_STANDARD 17) include(FetchContent) FetchContent_declare(c_backend GIT_REPOSITORY "https://github.com/eclipse-zenoh/zenoh-c" GIT_TAG release-0.10.1-rc) FetchContent_MakeAvailable(c_backend) FetchContent_declare(cpp_wrapper GIT_REPOSITORY "https://github.com/eclipse-zenoh/zenoh-cpp" GIT_TAG release-0.10.1-rc) FetchContent_MakeAvailable(cpp_wrapper) add_executable(your_app your_src-1.cpp your_src-2.cpp your_src-n.cpp) target_link_libraries(your_app PRIVATE zenohcxx::zenohc::lib)

Slide 68

Slide 68 text

CMake — Using Zenoh-Pico cmake_minimum_required(VERSION 3.27) project(Your_Project) set(CMAKE_CXX_STANDARD 17) include(FetchContent) FetchContent_declare(zenohpico_backend GIT_REPOSITORY “https://github.com/eclipse-zenoh/zenoh-pico" GIT_TAG release-0.10.1-rc) FetchContent_MakeAvailable(zenohpico_backend) FetchContent_declare(cpp_wrapper GIT_REPOSITORY "https://github.com/eclipse-zenoh/zenoh-cpp" GIT_TAG release-0.10.1-rc) FetchContent_MakeAvailable(cpp_wrapper) add_executable(your_app your_src-1.cpp your_src-2.cpp your_src-n.cpp) target_link_libraries(your_app PRIVATE zenohcxx::zenohpico)

Slide 69

Slide 69 text

User Types Serialisation

Slide 70

Slide 70 text

Serialisation We are often asked how you can use Protobuf or other similar technologies with Zenoh It is actually quite straightforward — Let’s take a look!

Slide 71

Slide 71 text

Concluding Remarks

Slide 72

Slide 72 text

Final Remarks The Zenoh team is innovating at fast pace The community is growing swiftly and expanding across Robotics, Automotive, IoT & More Growing awareness around the advantages provided by Zenoh Help us spreading the word!

Slide 73

Slide 73 text

Patience, persistence and perspiration make an unbeatable combination for success. Thank You

Slide 74

Slide 74 text

CEO/CTO ZettaScale Angelo Corsaro, PhD Zenoh Tutorial Part II

Slide 75

Slide 75 text

Building Zenoh To build all stable Zenoh features, you should do: $ cargo build --release --all-targets Let’s see what comes out of the box with this..

Slide 76

Slide 76 text

Features List [features] auth_pubkey = ["zenoh-transport/auth_pubkey"] auth_usrpwd = ["zenoh-transport/auth_usrpwd"] complete_n = ["zenoh-codec/complete_n"] shared-memory = [ "zenoh-shm", "zenoh-protocol/shared-memory", "zenoh-transport/shared-memory", ] stats = ["zenoh-transport/stats", "zenoh-protocol/stats"] transport_multilink = ["zenoh-transport/transport_multilink"] transport_compression = ["zenoh-transport/transport_compression"] transport_quic = ["zenoh-transport/transport_quic"] transport_serial = ["zenoh-transport/transport_serial"] transport_unixpipe = ["zenoh-transport/transport_unixpipe"] transport_tcp = ["zenoh-transport/transport_tcp"] transport_tls = ["zenoh-transport/transport_tls"] transport_udp = ["zenoh-transport/transport_udp"] transport_unixsock-stream = ["zenoh-transport/transport_unixsock-stream"] transport_ws = ["zenoh-transport/transport_ws"]

Slide 77

Slide 77 text

Default Features These are the features that are built by default For anything else you need to expliticely opt-in default = [ "auth_pubkey", "auth_usrpwd", "transport_multilink", "transport_compression", "transport_quic", "transport_tcp", "transport_tls", "transport_udp", "transport_unixsock-stream", "transport_ws", ]

Slide 78

Slide 78 text

Minimal Build Suppose you wanted to build only one transport, say TCP/IP. This is how you can achieve it: cargo build --release --no-default-features;--features=zenoh-transport/transport_tcp Notice that in this case you will still have scouting support via multicast, but you won’t be able to open a session over UDP/IP

Slide 79

Slide 79 text

Minimal Build Cargo Dependency In Cargo.toml you can use the following dependency to control the features you want to opt-in for zenoh = { version = "0.10.1-rc", default-features = false, features = ["transport_tcp"] }

Slide 80

Slide 80 text

Minimising Runtime Threads To minimise the number of runtime threads you should fi rst reduce the number of features to the bare minimum You should reduce the number of threads used for the transport (see con fi g) Finally you should control the number of threads used by the Async-Std runtime using the ASYNC_STD_THREAD_COUNT environment variable { transport: { link: { tx: { threads: 1 } } } } con fi g.json5 minimal git:(main) ✗ ASYNC_STD_THREAD_COUNT=1 ./target/debug/m_sub con fi g.json5 Example

Slide 81

Slide 81 text

Unstable Features Liveliness. Introduces the concept of liveliness token to very scalable “presence” and group management Attachment. Allows for custom “attachments” to be added to put operations. Source Info. Provide additional information on the source into the Sample Matching Listeners. Allows to register listeners to detect matching events, such as a subscriber matching a publication. Publication Locality. Controls the distribution scope of a publication.

Slide 82

Slide 82 text

Enabling Unstable Features Notice that unstable features need to be enabled either when building or when using Zenoh as a crate Building unstable features: $ cargo build --release --all-targets -F=unstable

Slide 83

Slide 83 text

Liveliness

Slide 84

Slide 84 text

Liveliness Zenoh liveliness provides a scalable way to assert and monitor liveliness at a granularity controlled by the application The basic mechanism is based on liveliness tokens: More info at: https://github.com/eclipse-zenoh/roadmap/discussions/72 let mut token = z.liveliness() .declare_token(“x-men/wolverine”) .res() .await .unwrap(); $ cargo build --examples -F=unstable

Slide 85

Slide 85 text

Liveliness Subscriptions Liveliness changes can be observed by subscribing to the proper key expression let subscriber = z .liveliness() .declare_subscriber(“x-men/*”) .res() .await .unwrap(); Sample::Put will indicate new tokens (join) while Sample::Delete will indicate disposed tokens (leave)

Slide 86

Slide 86 text

Liveliness Query A snapshot of the current liveliness situation for a given key expression can be retrieved with a query: let subscriber = z .get(“@/liveliness/x-men/*”) .res() .await .unwrap(); Sample::Put will indicate new tokens (join) while Sample::Delete will indicate disposed tokens (leave)

Slide 87

Slide 87 text

Attachment

Slide 88

Slide 88 text

Attachment Zenoh provides now a mechanism to associate an attachment with a publication — think of it as an “email attachment” An attachment is represented as a list of key/values This feature was always part of the zenoh protocol, but only recently we have provided APIs to exploit it

Slide 89

Slide 89 text

Use Cases End-to-End Protection. Attachments can be used to piggy-back checksums to verify the integrity of data on the other side Meta-Information. Attachments can be used to associate meta- information with user-data w/o having to pollute the user type with this information Security. Attachments can be used to carry identities, and other information useful in security.

Slide 90

Slide 90 text

Code Example pub const AUTOSAR: Crc = Crc::::new(&CRC_8_AUTOSAR); let mut checksum = vec!(0u8, 1); checksum[0] = AUTOSAR.checksum(value.as_bytes()); let mut atch = Attachment::new(); atch.insert("crc", checksum.as_slice()); let _ = z .put("demo/attachment", value) .with_attachment(atch.clone()) .res().await; }

Slide 91

Slide 91 text

Code Example let sub = z.declare_subscriber("demo/attachment").res().await.unwrap(); pub const AUTOSAR: Crc = Crc::::new(&CRC_8_AUTOSAR); while let Ok(s) = sub.recv_async().await { let payload = s.payload.contiguous(); let cs = AUTOSAR.checksum(payload.as_ref()); let checks = match &s.attachment { Some(a) => { let r = "crc".as_bytes(); if let Some(checksum) = a.get(&r) { if checksum.contiguous()[0] == cs { true } else { false } } else { false } }, None => { false } }; if checks { println!("Received valid data: {:?} -- {}", String::from_utf8_lossy(&payload), cs); } else { println!("Received corrupted data"); } } }

Slide 92

Slide 92 text

Discovery

Slide 93

Slide 93 text

Scouting Technically, Scouting is not part of the Zenoh protocol Scouting is one way of bootstrapping the Zenoh protocol, by discovering other Zenoh runtimes and their locators Scouting has to be considered as a plug-in, with the default implementation working on multicast

Slide 94

Slide 94 text

Scouting An API is available to “scout around”… let receiver = zenoh::scout(WhatAmI::Peer | WhatAmI::Router, Config::default()) .res() .await .unwrap();

Slide 95

Slide 95 text

Discovery Zenoh discovery works by default by closure In other terms, Zenoh runtimes exchange neighbours views in order to discover neighbour’s neighbours This feature can be disabled by con fi guration

Slide 96

Slide 96 text

Routing Zenoh supports two routing algorithms, one that assumes you have a clique, the other that supports arbitrary connected graphs By default peers are con fi gured to use clique routing, while routers use link-state that supports arbitrary graphs These can be changed by con fi guration

Slide 97

Slide 97 text

Interest Propagation Zenoh has a “interest” propagation based on set theory. The function declare_subscriber/declare_queryable “may” causes the emission of an interest packet. That said depending on previous declarations nothing may happen or a generalisation may take place Example I: declare_subscriber(“a/b/**”) declare_subscriber(a/b/c/*) — this won’t cause any emission

Slide 98

Slide 98 text

Query & Queryable

Slide 99

Slide 99 text

Queryable A queryable is a network endpoint that answers to queries matching its key expression The answer to a query is a fi nite stream of (key, values) Queryable are quite powerful and can be used to represent both the reading-half of a datastore/database as well as trigger computations

Slide 100

Slide 100 text

Declaring a Queryable The declaration of a queryable requires minimally the key expression associated with it let queryable = z.declare_queryable("zetta/webinar/zenoh/**") .complete(is_complete) .res().await.unwrap(); You can also specify the completeness of this queryable w.r.t. the set of keys represented by its key expression. If the queryable “has answers” for any key in the set expressed by its key expression then it ice complete, otherwise it is not.

Slide 101

Slide 101 text

Visualising Completeness Another way of visualising complete queryable, is like a set w/o any “holes” This property is especially important if you want to use queryable to do quorums Complete Non Complete

Slide 102

Slide 102 text

Query In Zenoh queries are issued by using the get operation z.get(k) .target(query_target) .consolidation(consolidation) .res().await.unwrap(); The result of a query is a fi nite stream of Reply pub struct Reply { pub sample: Result, pub replier_id: ZenohId, } Controls who, among matching, is eligible to be targeted Controls if and how replies are consolidated

Slide 103

Slide 103 text

Query Target The query target controls, among the queryable whose key expression matches that of the query, the set that should be used to execute the query pub enum QueryTarget { #[default] BestMatching, All, AllComplete, #[cfg(feature = "complete_n")] Complete(u64), } BestMatching. Bigger intersection and closer in routing terms All. All the queryable that intersect the query AllComplete. All queryable that fully cover the query. In other terms the query key expression is superset of the query expression Complete(N). Among the queryable that are complete pick N — routing considerations will be used to decide. (This is useful for read quorums, N is your read quorum :-)

Slide 104

Slide 104 text

Understanding Query Target zetta/webinar/** zetta/webinar/** zetta/webinar/** Router Router Router Router Router Peer Peer Peer Peer Peer Router Client Client Client Client Router Router Client Peer Peer Peer Peer Client zetta/webinar/** zetta/webinar/** zetta/news/** zetta/news/**

Slide 105

Slide 105 text

Understanding Query Target zetta/webinar/** zetta/webinar/** zetta/webinar/** Router Router Router Router Router Peer Peer Peer Peer Peer Router Client Client Client Client Router Router Client Peer Peer Peer Peer Client zetta/webinar/** zetta/webinar/** z.get("zetta/webinar/zenoh/*") .target(BestMatching) .res().await.unwrap(); zetta/news/** zetta/news/**

Slide 106

Slide 106 text

Understanding Query Target zetta/webinar/** zetta/webinar/** zetta/webinar/** Router Router Router Router Router Peer Peer Peer Peer Peer Router Client Client Client Client Router Router Client Peer Peer Peer Peer Client zetta/webinar/** zetta/webinar/** zetta/news/** zetta/news/** z.get("zetta/webinar/zenoh/*") .target(BestMatching) .res().await.unwrap();

Slide 107

Slide 107 text

Understanding Query Target zetta/webinar/** zetta/webinar/** zetta/webinar/** Router Router Router Router Router Peer Peer Peer Peer Peer Router Client Client Client Client Router Router Client Peer Peer Peer Peer Client zetta/webinar/** zetta/webinar/** zetta/news/** zetta/news/** z.get("zetta/webinar/zenoh/*") .target(BestMatching) .res().await.unwrap();

Slide 108

Slide 108 text

Understanding Query Target zetta/webinar/** zetta/webinar/** Router Router Router Router Router Peer Peer Peer Peer Peer Router Client Client Client Client Router Router Client Peer Peer Peer Peer Client zetta/webinar/** zetta/webinar/** zetta/news/** zetta/news/** zetta/webinar/** z.get("zetta/webinar/zenoh/*") .target(BestMatching) .res().await.unwrap();

Slide 109

Slide 109 text

Understanding Query Target zetta/webinar/** zetta/webinar/** zetta/webinar/** Router Router Router Router Router Peer Peer Peer Peer Peer Router Client Client Client Client Router Router Client Peer Peer Peer Peer Client zetta/webinar/** zetta/webinar/** zetta/news/** zetta/news/** z.get("zetta/webinar/zenoh/*") .target(All) .res().await.unwrap();

Slide 110

Slide 110 text

Understanding Query Target zetta/webinar/** zetta/webinar/** zetta/webinar/** Router Router Router Router Router Peer Peer Peer Peer Peer Router Client Client Client Client Router Router Client Peer Peer Peer Peer Client zetta/webinar/** zetta/webinar/** zetta/news/** zetta/news/** z.get("zetta/webinar/zenoh/*") .target(All) .res().await.unwrap();

Slide 111

Slide 111 text

Understanding Query Target zetta/webinar/** zetta/webinar/** zetta/webinar/** Router Router Router Router Router Peer Peer Peer Peer Peer Router Client Client Client Client Router Router Client Peer Peer Peer Peer Client zetta/webinar/** zetta/webinar/** zetta/news/** zetta/news/** z.get("zetta/webinar/zenoh/*") .target(AllComplete) .res().await.unwrap();

Slide 112

Slide 112 text

Understanding Query Target zetta/webinar/** zetta/webinar/** zetta/webinar/** Router Router Router Router Router Peer Peer Peer Peer Peer Router Client Client Client Client Router Router Client Peer Peer Peer Peer Client zetta/webinar/** zetta/webinar/** zetta/news/** zetta/news/** z.get("zetta/webinar/zenoh/*") .target(AllComplete) .res().await.unwrap();

Slide 113

Slide 113 text

Understanding Query Target zetta/webinar/** zetta/webinar/** zetta/webinar/** Router Router Router Router Router Peer Peer Peer Peer Peer Router Client Client Client Client Router Router Client Peer Peer Peer Peer Client zetta/webinar/** zetta/webinar/** zetta/news/** zetta/news/** z.get("zetta/webinar/zenoh/*") .target(Complete(2)) .res().await.unwrap();

Slide 114

Slide 114 text

Understanding Query Target zetta/webinar/** zetta/webinar/** zetta/webinar/** Router Router Router Router Router Peer Peer Peer Peer Peer Router Client Client Client Client Router Router Client Peer Peer Peer Peer Client zetta/webinar/** zetta/webinar/** zetta/news/** zetta/news/** z.get("zetta/webinar/zenoh/*") .target(Complete(2)) .res().await.unwrap();

Slide 115

Slide 115 text

Consolidation The query consolidation allow to control how to deal with multiple answers for the same key coming from di ff erent queryable pub enum ConsolidationMode { None, Monotonic, Latest, } None. The issuer of the query gets all replies Monotonic. Along the routing paths, samples for the same keys with older timestamp are dropped. Notice that as there may be di ff erent routing path more samples for the same key may still be received Latest. Ensures that only the latest value for each sample is receive

Slide 116

Slide 116 text

Latest News

Slide 117

Slide 117 text

Zenoh Moves to Tokio Zenoh has moved to the Tokio Async Framework This was a sizeable PR which was merged on main branch the 12/3/2024 All tests are passing and performance are stable… Some gains on latency.

Slide 118

Slide 118 text

Zenoh vs DDS, MQTT & Kafka Zenoh can deliver at peak performance of ~70Gbps at 8Kb payload: - 3.3x higher than DDS 
 - 23x higher than Kafka 
 - 35x than MQTT (higher for larger payload) 
 Zenoh’s latency 10us, 6us with ultra-low- latency support 
 - 25us for MQTT 
 - 75us for Kafka 
 - 8us DDS

Slide 119

Slide 119 text

Wrapping Up

Slide 120

Slide 120 text

Final Remarks The Zenoh team is innovating at fast pace The community is growing swiftly and expanding across Robotics, Automotive, IoT & More Growing awareness around the advantages provided by Zenoh Help us spreading the word!

Slide 121

Slide 121 text

Patience, persistence and perspiration make an unbeatable combination for success. Thank You

Slide 122

Slide 122 text

Latest News

Slide 123

Slide 123 text

Top 10 Automotive Startups ZettaScale has been identi fi ed as one of the 10 startups in vehicle communication to be watched in 2023 The core technology considered in the report was Zenoh

Slide 124

Slide 124 text

In a recent article that evaluates mainstream protocols, including MQTT, DDS, AMQP an CoAP Amazon describes Zenoh as: “Perhaps the most viable protocol that will help us mature to this ideal model is Zenoh which is an Eclipse Incubation project” Amazon IoT

Slide 125

Slide 125 text

2023-09 ROS 2 RMW alternate Abstract........................................................................................................................................ 1 User Challenges with DDS..........................................................................................................2 DDS has a fully-connected graph of participants.....................................................................2 DDS uses UDP multicast for discovery................................................................................... 3 DDS can have difficulty transferring large data....................................................................... 3 DDS can struggle on some WiFi networks.............................................................................. 4 DDS tends to have complex tuning parameters...................................................................... 4 Vendor specific non-standard DDS extensions....................................................................... 4 Next Steps............................................................................................................................... 5 Requirements gathering............................................................................................................. 5 User Survey............................................................................................................................. 5 Demographics..............................................................................................................6 Technical Data............................................................................................................. 6 Alternative middleware options.................................................................................... 8 Requirements.......................................................................................................................... 9 Comparative analysis of currently available middlewares.................................................... 11 Complete list of investigated middlewares.......................................................................11 Performance.................................................................................................................... 13 Middlewares X Requirements................................................................................................13 Conclusion................................................................................................................................. 14 Appendix A.................................................................................................................................15 Abstract The ROS MiddleWare interface (RMW) is an abstraction layer that allows ROS 2 to swap out its underlying communication mechanism (middleware) at both compile time and runtime. All current Tier 1 implementations of RMW are based on DDS. At the time that this solution was chosen, it met many of the initial requirements. Over the last 8 years of use, based on user feedback a number of problems have been identified, including: Intrinsics / Open Robotics in 2023 Zenoh selected as the fi rst non DDS protocol to be natively supported Intrinsic implementing Zenoh RMW as the major contribution for next ROS2 release Very insightful report, worth reading

Slide 126

Slide 126 text

No content

Slide 127

Slide 127 text

No content