Description
Bug report
Required Info:
- Operating System:
- Ubuntu 22.04
- Installation type:
- binaries
- Version or commit hash:
- ROS2 Humble
- DDS implementation:
- Cyclone dds
- Client library (if applicable):
- rclcpp_components
Issue description
I have a simple node that publishes a camera image topic. Then, a component_container_isolated that is launching diferent components with a single thread executor in wich every component subscribes to the image topic, in the callback of the subscription a high demanding task is being processed.
The problem appears with the subscription of this image_topic. With two or three components I receive the images at 30fps as expected. After that, the more components I add the lower the fps received. At first, I thought the cause of this problem would be because of the CPU. After monitoring it the % of the cpu usage increments with the addition of components but never gets over the 80% of its total.
Expected behavior
I would expect that before decreasing the fps received in the components the CPU usage would increase, As an example the results I would expect are the following:
- 1 Component being run -> 30fps -> CPU 55%
- 2 Components being run -> 30fps -> CPU 55.5%
- ...
- 6 Components being run -> 30fps -> CPU 75%
- ...
- 8 Components being run -> 30fps -> CPU 90%
- ...
- 15 Components being run -> 10fps -> CPU 95%
Actual behavior
As an example the results I'm getting are the following:
- 1 Component being run -> 30fps -> CPU 55%
- 2 Components being run -> 30fps -> CPU 55.5%
- ...
- 6 Components being run -> 20fps -> CPU 60%
- ...
- 8 Components being run -> 15fps -> CPU 70%
- ...
- 15 Components being run -> 4fps -> CPU 80%
Additional information
I have tried the same but launching idependent nodes for the subscription (without using the component manager). In this situation, my CPU usage gets to 90% or more with only 5 nodes subscribed to the image. It is then when the frequency of the received images starts decreasing. This is in my opinion what shoul happend using the component manager.
So, is this behaviour normal? Is there any way to improve this CPU usage?