[Nav2] Dynamic Composition Support!

Hi all, your friendly neighborhood navigator here.

I wanted to let you know due outstanding ongoing work from @gezp, Nav2 is finally able to leverage dynamic composition in the current Rolling development branch that will merge into the next LTS distribution, Humble!

That means now we can load all of the nodes, dynamically, at run-time into a single process to help message latency and resource utilization. Without any explicit intraprocess communication or DDS optimization, we see an astonishing drop in resource utilization. We will have more formal numbers in the coming weeks but we see approximately

- Approximately 70% drop in memory utilization
- Approximately 15% drop in CPU utilization

You can see the pull request support dynamic composed bringup by gezp · Pull Request #2750 · ros-planning/navigation2 · GitHub, but that only tells half the story. Zhengpeng has been working with us since the start of last summer to improve the performance of Nav2 and has made contributions across the ecosystem including rclcpp, tf2, and launch to make this happen. We’ve incrementally gone from fewer nodes being created, to manual composition, to finally fully dynamic composition.

I think these numbers really highlight the value of composition in ROS 2 as a means to significantly improve your software’s performance. We expect to see the CPU number decrease even further with more middleware related optimizations and intraprocess communication support for a more diverse set of QoS settings.

Happy composing,



Is this performance improvement caused only by switching to dynamic node composition? I would have expected that the “link-time” composition via composed_bringup.cpp performs equally good. Do you know where this improvement comes from?

That is with respect to no composition, e.g. the typical setup that folks are using today since there hasn’t been a new distribution release to see those changes in a system.

The manual composition results in a bit more resource utilization in Nav2 than dynamic composition due to architectural flexibility we want to maintain in Nav2, though for a typical system I would expect them to be in line, in general. It’s not worth going into in excessive detail, considering we’ve removed the manual composition that was a placeholder for dynamic composition.