Robotics StackExchange | Archived questions

run 64 nodes , cpu utilization becomes 100%

On the ROS2(Ardent) environment , when I start 32 Publisher nodes and 32 Subscriber nodes, CPU utilization becomes 100%.

As Publisher, I use the example code from

https://github.com/ros2/examples/blob/master/rclcpp/minimal_publisher/member_function.cpp

As Subscriber, I use the example code from

https://github.com/ros2/examples/blob/master/rclcpp/minimal_subscriber/member_function.cpp

launched as follows

test.launch

from ros2run.api import get_executable_path

def launch(launch_descriptor, argv):
    ld = launch_descriptor

    for loop in range(32):
        ld.add_process(
            cmd=[get_executable_path(package_name='examples_rclcpp_minimal_subscriber', executable_name='subscriber_member_function')],
        )
        ld.add_process(
            cmd=[get_executable_path(package_name='examples_rclcpp_minimal_publisher', executable_name='publisher_member_function')],
        )

My emviromment

Operating System : Ubuntu 16.04

DDS implementation:FastRTPS

CPU : Intel core i3 (2.4GHz)

Asked by yan3x on 2018-09-11 08:28:34 UTC

Comments

Have you tried the same with the latest release Bouncy? Can you share your ready-to-user example to reproduce the problem?

Asked by Dirk Thomas on 2018-09-11 10:34:08 UTC

What CPU are you running this on?

Asked by allenh1 on 2018-09-11 18:28:30 UTC

Thomas

Sorry, I haven't tried on Bouncy yet.

Publisher and Subscriber source code is downloadable from Github example .

and just launched 32 subscriber_member_functions and 32 publisher_member_function.

Asked by yan3x on 2018-09-12 03:46:39 UTC

Allen

CPU is Intel core i3 , 2,4GHz.

Operating System : Ubuntu 16.04

DDS implementation : FastRTPS

Asked by yan3x on 2018-09-12 03:48:55 UTC

Please provide a working snippet (copy-n-pastable) to save time for everyone who volunteers to help.

Asked by Dirk Thomas on 2018-09-12 10:39:05 UTC

The snippet still doesn't look complete. How do you run your launch file?

Asked by Dirk Thomas on 2018-09-12 13:59:31 UTC

Please try the same without launch - running all the publishers and subscribers via ros2 run instead - to compare if the load is the same.

Asked by Dirk Thomas on 2018-09-12 15:56:31 UTC

I've already test with ros2 run, and have a same result.

I 've done as follows

ros2 run examples_rclcpp_minimal_publisher publisher_member_function &

ros2 run examples_rclcpp_minimal_subscriber subscriber_member_function&

repeat these command 32 times.

Asked by yan3x on 2018-09-12 21:04:39 UTC

sorry, test.launch file was for python case .

I corrected test.launch for cpp .

(with python , I had same result)

Asked by yan3x on 2018-09-12 21:09:10 UTC

I just tried 32+32 nodes on Bouncy on an i7-7700 (Quad Core 3.6GHz, 4.2Ghz Turbo) and I'm seeing ~20% utilization across all 8 CPUs.

Asked by clyde on 2018-11-07 12:36:56 UTC

Clyde, thank you for information. Your result means that problem will be resolved in Bouncy ?

Asked by yan3x on 2018-11-08 08:35:25 UTC

My results were from Bouncy. But I don't know what caused your slowdown, so YMMV.

Asked by clyde on 2018-11-10 12:51:51 UTC

Clyde, thank you. I'd like to test with Bouncy. But now I can't do so because my enviromment constraint. When I confirm with Bouncy, I will report it.

Asked by yan3x on 2018-11-12 08:59:53 UTC

I know this is quite an old post but this might be an interesting read for the people who end up here: https://github.com/nobleo/ros2_performance . This github was made to show that the executor implemented in ROS2 is creating a lot of CPU overhead. We are currently looking for ways to fix this, if you are interested in this topic you can follow the link to our discourse discussion at the bottom of the githubs README.

Asked by MCornelis on 2019-08-08 02:05:49 UTC

Answers