ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

rosnode CPU usage in Dockercontainer vs Bare Metal

asked 2018-07-24 03:19:02 -0500

sgt_droelf gravatar image

updated 2018-07-24 05:44:19 -0500

Hello there,

i've noticed a strange property regarding ROS and Docker. Just executing roscore & (and thus rosout) results in vastly different cpu usages.

When executing on bare-metal i get about 0-0.3% CPU usage. I guess that's how it's supposed to be, since there is nothing else running. On the other hand, executing the same command roscore & inside a docker container results in 100-150% CPU usage on the same PC.

Can somebody explain this to me or help me fixing this? I wanted to run a couple of nodes in the container but since the CPU usage is so high i'm not sure i should. Thanks in advance!

Edit: Okay, so using roscore after i stopped a roslaunch file results in 130%. When restarting the container (with bash only, nothing else) and then executing roscore i get 0-0.3, which looks fine to me. Still - after stopping roslaunch i doublechecked via ps aux if there really wasn't anything else running and there wasn't. Any ideas?

edit retag flag offensive close merge delete


Related: #q298348.

gvdhoorn gravatar image gvdhoorn  ( 2018-07-24 04:35:31 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-07-24 04:31:26 -0500

fvd gravatar image

updated 2018-07-24 04:40:04 -0500

We have been using both indigo and kinetic inside docker for over a year, and never had any issues of that sort. I also tested roscore & on my machine now, and there's no difference between executing it on the host vs the container.

I assume it is something to do with your docker settings. Try checking your docker-compose.yml, or execute the command in a fresh container, or on a different PC. Do report back if you find the problem.

edit: I just saw your other question. Your nodes or other trailing processes might be the issue, too.

PS: I don't know that "roscore &" is very elegant, especially while developing. I would suggest keeping it in a separate terminal and occasionally restarting it to make sure that nothing is left on the parameter server etc.

edit flag offensive delete link more


notice my edit.

sgt_droelf gravatar image sgt_droelf  ( 2018-07-24 05:44:25 -0500 )edit

What do you mean by "stopped a roslaunch file"? If no roscore is running when a roslaunch file is launched, it starts up its own roscore in the background. What if the roslaunch file terminates normally? What if you run the nodes in the roslaunch file manually? Consider opening a new question.

fvd gravatar image fvd  ( 2018-08-08 03:47:46 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2018-07-24 03:19:02 -0500

Seen: 423 times

Last updated: Jul 24 '18