Skip to content

Build zero-copy UTransport #280

@PLeVasseur

Description

@PLeVasseur

Why a zero-copy transport for uProtocol?

  • It's very common in Advanced Driver-Assistance Systems (ADAS) / Automated Driving (AD) systems to have large messages which are being sent around, including large camera images and point cloud data from LIDARs
  • It's becoming common in automotive systems to have a gateway concept where inter-device communication flows into each device's gateway over a different transport (e.g. SOME/IP, CAN) and is then copied into shared-memory to allow zero-copy publishes to consumers
  • By providing a zero-copy UTransport we open up uProtocol to the ADAS / AD domains and wider adoption in OEMs / integrators which desire this functionality in a gateway

Main goals

Implement a zero-copy UTransport where the UMessage is not copied from sender to receiver but is passed on by means of a shared memory reference only (or equivalent mechanism).

  • In a first step, use the existing Protobuf encoding of UMessage to serialize the message to an (opaque) byte array which can then be passed on by means of a shared memory reference.
  • In a second step, figure out what it would take to avoid serialization and deserialization of UMessage altogether, even across programming languages. This will most certainly require the sender and receiver implementations to have the same understanding of how memory is laid out for a particular data structure.
  • In a third step, implement the zero-copy, no-serialization approach.

Constraints

  • Use iceoryx2 to implement the zero-copy transport, as it is a forward-looking solution and is headed for ASIL-D safety-qualification

Desired outcomes

  • A Rust based UTransport implementation (up-transport-iceoryx2-rust crate) which can be published to crates.io.

Extra integration into uProtocol ecosystem

  • Show integration of up-transport-iceoryx2-rust into up-streamer-rust reference implementation
  • Attempt to use the Eclipse Zenoh shared-memory transport option
    • Interesting to ask: Why did Eclipse Zenoh choose not to use iceoryx2?
  • Create a C-based implementation of the zero-copy transport (up-transport-iceoryx2-c)
  • Show interoperability between up-transport-iceoryx2-rust and up-transport-iceoryx-c
    • Use Gherkin feature files to show compatibility as is being done for up-rust tests

Additional resources

Eclipse Foundation

Rust

Mindset

Typical community suggestions

Things also sometimes recommended, maybe more niche

iceoryx2

How does iceoryx2 allow for zero-copy shared memory understanding of memory layout between languages? Doesn't each language have different memory layouts and representation?

True! So in the iceoryx ecosystem they have libraries for languages which allow a common understanding:

Getting started with iceoryx2

  • Great to start with the docs on crates.io!
  • Consider building their examples and experimenting with them

Eclipse uProtocol - Topology

There's a somewhat outdated, but still conceptually relevant diagram in the uProtocol Roadmap.

Generally speaking, unless constraints would prevent otherwise, within a single logical or physical system, a zero-copy / shared memory transport should be used (the black lines in the diagram). Between logical or physical systems, other mechanisms are used as appropriate.

The uStreamer is used as a protocol bridging library and service to allow the transition to/from different underlying protocols.

Image

UTransport

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions