Avoid copies when combining intra-process communication and shared memory transports
@alsora is already working on this.
Since Jun 15, 2023.
- Dominant language
- C++
- Stars
- 805
- Forks
- 564
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 27
Description
Feature request
ROS 2 supports multiple communication modes.
Consider the following scenario, with two processes:
- a process contains publisher A and subscriber X
- a process contains subscriber Y
Intra-process communication allow the publisher to send the message to subscriber X without copies.
Similarly if zero-copy shared memory transports are enabled, the publisher should be able to send the message to the subscriber Y without performing any copy.
However, the mechanism breaks when both modes are used at the same time: indeed inter and intra-process currently need different copies of the message.
Note that disabling intra-process communication is a suboptimal solution.
Indeed intra-process communication is faster and uses less CPU than shared memory transport, even if no copies are involved.
Depending on the size of the message, the performance penalty from not using intra-process comm may be larger than the overhead caused by the copy that is needed when combining the two transport modes.
However, it should be possible to get the best of both worlds when all subscribers are only interested in read-only access to the message.
This would require to essentially use the same loaned message for both inter and intra process deliveries.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.