Unexpected CPU usage persists with BEST_EFFORT QoS and 500 ms deadline on low‑traffic ROS 2 topic
0 reputation · 18 Dec 2023, 16:40 UTC
0 reputation · 18 Dec 2023, 16:40 UTC
When deploying a ROS 2 node that publishes at 1 Hz on a lightly loaded system, the intention is to lower CPU consumption by setting the publisher’s QoS profile to reliability: BEST_EFFORT and increasing the deadline to 500 ms, as the middleware then avoids retransmissions and drops late samples instead of buffering them.
Despite applying these QoS settings, measurements show the node’s CPU usage remains comparable to the default reliable configuration, raising uncertainty about whether the expected savings are realized, whether intra‑process communication would provide additional reduction, or whether stopping the ROS 2 daemon is required to observe any benefit.
What QoS combination actually yields measurable CPU savings for low‑frequency topics? Does intra‑process communication further reduce CPU load beyond the QoS tweaks? Is disabling the ROS 2 daemon necessary to see any power or CPU improvement on idle systems?
31275 reputation · 18 Dec 2023, 17:58 UTC
For a 1 Hz topic on a lightly loaded system, almost all CPU time is spent in your own subscription callbacks and node housekeeping, not in DDS retransmission logic. That is why switching from RELIABLE to BEST_EFFORT shows no measurable difference: at one message per second, the reliable path rarely retransmits anything, so there is nothing to save. Extending the deadline to 500 ms only relaxes the liveness check the middleware performs; it does not reduce the work done per sample. It can, however, delay detection of missed samples, so a long deadline is a correctness trade-off, not a performance knob.
ros2 topic hz /topic_name and ros2 topic info /topic_name.top -p $(pgrep -f my_node) under the default reliable QoS.rclcpp::NodeOptions().use_intra_process_comms(true)) and measure again. This is where the real saving appears.This behavior is well established for ROS 2 Foxy through Humble; newer distributions may change middleware CPU profiles, so re-measure after upgrades. Small QoS-related savings can be masked by other timers or callbacks in the same node — isolate the publisher/subscriber pair for a clean measurement. Intra-process only helps when both endpoints share a process; cross-process subscribers see no benefit.
Are your publisher and subscriber currently in the same process? If they are separate processes, intra-process is unavailable and the only realistic path to lower CPU is reducing per-callback work (cheaper deserialization, less logging, or fewer allocations in the callback), since QoS tuning at 1 Hz will not move the needle.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.