SOME/IP over iceoryx2: swapping the kernel UDP stack for shared memory in someipx

Hi all,

I’d like to share how we ended up using iceoryx2 as a transport for a SOME/IP stack, and what we measured along the way.

About the project: someipx is a clean-room SOME/IP implementation in C (with C++, ara::com, Rust and C# layers on top, running on Mac, Linux, Windows, QNX and many more). It supports Service Discovery, pub/sub with eventgroups, request/response methods, fields, and SOME/IP-TP segmentation. The one design decision that matters for this post is that the stack never touches a socket. It talks to a small, vendor-neutral POSIX-style transport port (one header: open, bind, send, receive upcall, main function), and an adapter implements that port on whatever is underneath: BSD sockets, Winsock2, an in-process loopback for tests, or a serial link. We plan to open-source someipx soon; I’ll add the repository link here when it’s public.

Why iceoryx2: A lot of SOME/IP traffic in a real system never leaves the host: several processes on one ECU talking to each other, with the kernel UDP loopback in between. That’s two kernel copies and a handful of syscalls per datagram, for messages that are often 16 to a few hundred bytes. Because our stack only knows the transport port, we could replace the whole kernel path without changing a line in the SOME/IP logic. iceoryx2 was the obvious candidate for me: zero-copy, no central daemon, a clean C API, and the dead-node cleanup story we needed for crashed processes.

How the adapter maps SOME/IP onto iceoryx2:

The adapter (someip_net_iox2.c, about 1k lines) carries one UDP datagram per iceoryx2 sample:

  • Payload: The payload type is a u8 slice with initial_max_slice_len = 1500 and the static allocation strategy, so a sample is one MTU-sized datagram and the slice length is never reallocated.
  • Header: A small user header carries what UDP would have given the receiver for free: address family, source address and port, a sender ID (the PID), and a per-sender sequence number.
  • Service Names: These mirror the socket model. A bound unicast port P becomes <prefix>/udp/P with exactly one subscriber. A multicast join of group G on port P becomes <prefix>/mcast/<G as hex>/P, and every joined socket in every process holds a subscriber on it, so one publish fans out to all of them. The prefix isolates process groups (and lets ctest -j run tests in parallel without seeing each other).
  • Safe Overflow: enable_safe_overflow is on. A full receive queue overwrites its oldest sample, which is exactly UDP’s drop-when-full behaviour, and a sender never blocks. The receiver tracks the sequence number per sender and counts gaps as dropped datagrams.
  • Port Checks: The “exclusive bind” check (EADDRINUSE) reads the service’s dynamic subscriber count. Transient ports are probed the same way.
  • Caching: Senders keep an LRU cache of publishers keyed by destination service. An evicted publisher is retired for one more main-function cycle before it’s dropped, because dropping a publisher discards its unread samples.
  • Zero-Copy Integration: On send, when the stack hands us a copy callback instead of a buffer, we loan the slice and let the stack serialise straight into shared memory. On receive, we pay one copy per datagram, because the port’s receive upcall takes a mutable buffer and the stack may send from inside it.
  • Cleanup: SomeIpNet_Init runs dead-node cleanup, so a crashed process doesn’t leave stale ports behind.

Everything above the port is unmodified: our existing pub/sub binaries run SD, the subscribe/ack handshake, events, methods, and TP reassembly across processes as iceoryx2 samples. The whole thing is opt-in behind a CMake option (plus a separate Bazel module and a Conan (ROS2) option) so the default build never downloads iceoryx2 or needs a Rust toolchain.

Numbers:

Same stack, same benchmark sources, same poll loop; only the linked transport differs. Tested on Apple M3 Max, macOS, iceoryx2 v0.10.0, one run (so indicative rather than universal).

Metric POSIX UDP loopback iceoryx2 adapter
Method round trip, 16 B payload, p50 / p99 47.1 / 558.7 µs 1.6 / 3.2 µs
Method round trip, 1392 B payload, p50 / p99 35.7 / 122.4 µs 1.8 / 4.3 µs
Method round trip, 8000 B (6 TP segments), p50 94.7 µs 7.4 µs
Event throughput, 1024 B, one subscriber 27.8k msg/s (28.5 MB/s) 709k msg/s (726 MB/s)
Event multicast, 1024 B, four subscribers 11.8k msg/s per sub 238k msg/s per sub

For reference, the in-process loopback adapter (pure SOME/IP stack cost, no IPC) sits at 0.3 to 0.4 µs p50, and a raw iceoryx2 ping-pong without SOME/IP sits at 0.8 to 0.9 µs. So the stack over iceoryx2 is well below even raw UDP without any SOME/IP on top (around 27 to 29 µs here). Under saturation, the iceoryx2 rows show 0.03 to 0.43% loss, which is the safe-overflow queue doing its job while UDP loopback on this machine simply throttled the sender.

Things we noticed, for whoever finds it useful:

  • The v0.10.0 C FFI had every call we needed (slice loan, user header, safe overflow, allocation strategy, dynamic subscriber count, dead-node cleanup). We didn’t have to drop into Rust at all.
  • The dynamic allocation strategy caught us once (“losing dynamic data” on reallocation); for a fixed-MTU datagram transport, static is the right choice anyway.
  • The adapter currently busy-polls its main function (that’s what the transport port offers today). A WaitSet-driven, blocking main loop would need a new port API and is on the list; it would change the CPU picture a lot more than the latency one.

A ROS 2 angle:

someipx also ships a ROS 2 gateway (Jazzy, production testing status): our Franca IDL generator emits the .msg / .srv files plus an rclcpp node that embeds the someipx runtime, so a SOME/IP service shows up as ordinary ROS 2 topics and services (events become topics, fields become a latched topic plus a setter service, methods become services), with SOME/IP-SD discovery and ECU restarts handled underneath. Today that bridge talks SOME/IP over UDP.

Since the transport is a link-time choice, the obvious experiment is to put the bridge on the same host as the SOME/IP processes, link it against the iceoryx2 adapter, and run ROS 2 itself on rmw_iceoryx2, so a message would travel SOME/IP process → bridge → ROS 2 node without ever touching the kernel network stack. We haven’t run that combination yet, but it’s an exciting architectural prospect.

What’s next:

Rust and C# versions of the adapter (both runtimes have the same pluggable transport trait/interface), a WaitSet-based main loop, and a per-transport MTU so large payloads can skip SOME/IP-TP entirely on shared memory, where a 1500 B limit is artificial.

Greetings to Berlin and a big shoutout to the iceoryx2 team :heart: The combination of a clean C API and predictable queue semantics made this a really short task rather than a long one. Happy to answer questions.

4 Likes

This is awesome. We should make a blog post out of it with some small examples showing the potential of someipx.

I think your design decision with the vendor-neutral POSIX-style transport port absolutely makes sense; this is also how we operate with our platform abstraction layer.

I am just curious if our platform abstraction layer would have already provided you with all the features you would have needed, or if something is still missing. If you have time, I would like to explore this further - either we learn something that is still missing in iceoryx2-pal, or you get to know iceoryx2-pal better.

Our goal with this platform abstraction layer was that every software that depends on it automatically runs on all platforms that are also supported by iceoryx2.

Really cool stuff! Looking forward to taking a look if and when you do decide to make it open source.

someipx also ships a ROS 2 gateway

Wondering if you had a chance to take a look at the iceoryx2-link component for this functionality. It has a “gateway backend” which is intended for exactly this and can be extended to any other middlewares, and one currently exists for ROS 2. It is relatively new though, so I wouldn’t be surprised it it did not exist when you were working on this.

Nevertheless, it would be interesting to know if it would be able to cover your use-case as-is with some configuration, or if it would need to be tweaked to do so.

Did not think it through completely and do not know your use-case deeply, but the configuration that comes to mind is having the iceoryx2-link to translate ROS 2 messages into the form that someipx uses and place them directly into shared memory with the correct service names. Then the someipx endpoints should be able to access the bytes directly without copies. If it fits it could be interesting to reduce some maintenance effort of this functionality on your side. We also have request-response support coming by the end of the month!

If it interests you, we have some articles covering the iceoryx2-link over here:

  1. Links - The iceoryx2 Book

  2. Gateway to ROS 2 - The iceoryx2 Book

Those latency numbers are pretty interesting, especially for such small messages.

I’m curious about the CPU side of it though. Since the adapter is busy-polling at the moment, I wonder how much of that improvement would remain with a WaitSet-based loop.

I think even a simple comparison of idle CPU usage and p99 latency would be useful.

Not sure the lowest possible latency is always the best trade-off if the process spends most of its time waiting for messages. Would be interesting to see how the numbers change once you try the blocking approach.