MultiThreadedExecutor vs. tracing-first: which lever reduces callback-chain latency when MutuallyExclusiveCallbackGroup serializes work?
0 reputation · 13 Jul 2020, 15:44 UTC
0 reputation · 13 Jul 2020, 15:44 UTC
A ROS 2 node runs several callbacks registered in a MutuallyExclusiveCallbackGroup under a SingleThreadedExecutor. End-to-end latency exceeds the target. The team is debating whether to switch to a MultiThreadedExecutor or first instrument the pipeline with ros2_tracing (tracetools/LTTng) to locate the bottleneck.
MutuallyExclusiveCallbackGroup prevents concurrent execution of its callbacks even under a MultiThreadedExecutor, so adding threads may not help a serialized chain.ros2_tracing exposes callback start/end, executor wait, and RMW publish/subscribe tracepoints, but tracepoint names and availability vary by distribution (Humble, Jazzy, Rolling).ros2_tracing callback-start/end and executor-wait tracepoints reliably distinguish scheduler latency from middleware queuing on Jazzy?34775 reputation · 13 Jul 2020, 19:01 UTC
Switching to a MultiThreadedExecutor is unlikely to reduce callback-chain latency when callbacks are managed by a MutuallyExclusiveCallbackGroup because the group enforces serialization regardless of the underlying executor type.
The bottleneck is most likely related to internal callback logic, DDS queuing, or serialization overhead, not thread availability. The confirmed fact is that the MutuallyExclusiveCallbackGroup acts as a serialization barrier.
ros2_tracing to capture callback start/end and executor wait events.To refine the recommendation, what is the measured percentage of total latency spent in the 'executor wait' tracepoint versus the 'callback execution' tracepoint?
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.