[FEA] add support to zero copy transport.
ZhenshengLee opened this issue · 7 comments
Performance test about eCAL has shown the possibility of replacing cyclonedds and fastdds as the best middleware option.
see https://github.com/continental/ecal/discussions/660 for more details.
One more step is to enable zerocopy in rmw, so rclcpp can use this function in the top application layer of ros2.
m_publisher->ShmEnableZeroCopy(1);
But how to get the publisher_t in rclcpp?
something like this?
// in rclcpp
rcl_publisher_get_rmw_handle(m_publisher->get_publisher_handle())
I'll check it out, i think RMW should automatically use zero copy mechanism if message types are eligible, let me just first deal with legacy distro support and basic CI. :)
Hey,
There is a way to enable zero-copy mode for all publishers in settings, I think it might be for the best if users were to use that setting to enable/disable it in RMW instead of RMW doing it automatically. You can try it eyven now since there is no need for any code changes in RMW to support it.
Hey, There is a way to enable zero-copy mode for all publishers in settings, I think it might be for the best if users were to use that setting to enable/disable it in RMW instead of RMW doing it automatically. You can try it eyven now since there is no need for any code changes in RMW to support it.
What the docs tell us is clear
Use zero-copy as system-default (not recommended!):
Activating zero copy system-wide is not recommended because of the mentioned disadvantages for small payloads. But if this is wanted for reasons it can be done by adapting your ecal.ini like this.
[publisher]
memfile_zero_copy = 1
Yeah, its currently experimental feature (we are currently working on a way to remove disadvantages for small messages), but that shouldn't affect the RMW that much (if at all) mainly because RMW has to copy message to its own layer at the moment, so the current behaviour is.
eCAL copies it into its layer -> RMW copies that copy in its layer
with zero copy enabled it would be
eCAL provides ptr to shm mapped address -> RMW copies it in its layer
with zero copy it would just emulate how eCAL works without RMW.
Yeah, its currently experimental feature (we are currently working on a way to remove disadvantages for small messages), but that shouldn't affect the RMW that much (if at all) mainly because RMW has to copy message to its own layer at the moment, so the current behaviour is. eCAL copies it into its layer -> RMW copies that copy in its layer with zero copy enabled it would be eCAL provides ptr to shm mapped address -> RMW copies it in its layer with zero copy it would just emulate how eCAL works without RMW.
Sounds great, I will add this option to performance_test repo!
Great! I might make it default in RMW once it gets out of experimental stage, in meanwhile i'll document the option in readme,
Documented, closing!