Add experimental Linux shared-memory IPC transport - #4918
Conversation
|
Preliminary Linux throughput results I reran the IPC throughput matrix for the draft Environment:
Benchmark setup:
Sampled receiver validation, median throughput, GiB/s:
Full receiver payload scan, median throughput, GiB/s:
Interpretation:
|
|
Update: I have also been testing an alternative prototype direction for shared-memory IPC acceleration before deciding how to harden this draft further. The current draft PR started as a standalone However, I do not expect the automatic A standalone The alternative For normal So I currently see these as two separate design options:
I reran the benchmark with four modes:
Setup:
Same-NUMA, sampled receiver:
Same-NUMA, full-scan receiver:
Cross-NUMA, sampled receiver:
Cross-NUMA, full-scan receiver:
Observations:
Before iterating further, I would like feedback on the intended architecture: Should shared-memory acceleration, if pursued, be integrated as an opt-in In particular:
|
Summary
This is a draft implementation of a Linux-only shared-memory IPC transport for local processes.
The PR adds:
shm://transport path forZMQ_PAIRSCM_RIGHTSmemfd_createandmmap(MAP_SHARED)zmq_shm_msg_initandzmq_shm_msg_sendZMQ_SHMmessage inspection so applications can tell when received payload storage is sharedMotivation
The existing
ipc://transport uses Unix domain sockets, so payload bytes still pass through kernel socket buffers. For large same-host messages this can dominate cost. This draft explores using UDS only for connection setup, fd transfer, wakeups, and liveness, while moving payloads through shared memory.The direct-message path lets an application reserve a shared slot, construct payload data directly in that slot, send the message, and release the slot when the last
zmq_msg_treference is closed. That is the application-to-application zero-copy case this draft is trying to evaluate.Design Notes
ZMQ_HAVE_LINUX.shm://reuses the IPC address path for bind/connect but installs a shared-memory engine after the UDS handshake.zmq_sendcopies application data into a shared slot.zmq_shm_msg_initreserves a shared slot before construction, initializes amsg_tover that storage, and binds slot release to the message finalizer.Related Work
Draft Status
This is intentionally opened as a draft to get early feedback on the transport shape and public API before hardening it further.
Open areas before this should be considered ready:
zmq_shm_msg_init/send, be draft-gated, or be shaped differentlyshm://should be a separate transport or an IPC backend optionValidation
git diff --check upstream/master..HEADtest_shm_ring,test_shm_channel, andtest_pair_shmThis has not been marked ready for review yet because the API and production-hardening questions above need maintainer feedback first.