Robotics StackExchange | Archived questions

rosbag record performance issues

Hello ROS community,

We are running our ROS system on a 6-core multiprocessor machine (8GB RAM, 32GB eMMC storage, 64bit ubuntu Linux) and experience significant load increase when turning on ROS recording.

In detail, without recording our system has roughly a load of 1 between 2. Once we turn on recording (rosbag record -a) our load climbs up to roughly 5 or even 6.

The amount of data we log is roughly 200KB/sec and is mostly comprised of float32 values. This is not insignificant, but I am still surprised that recording has such a high impact.

Since we do not fully max out our CPUs, I assume the load is mostly related to IO!?

My questions:

Thanks a lot for reading.

Asked by rob_ros on 2017-07-11 21:07:44 UTC

Comments

I assume the load is mostly related to IO!?

the first thing would probably be to do some profiling, then we know what is going on.

Take a look at rosbag/Commandline - record, have you investigated the effect of buffsize and chunksize?

Asked by gvdhoorn on 2017-07-12 01:54:49 UTC

Additionaly - but without profiling this is really all speculative: network topology and other system characteristics are going to influence everything, so it might be good to describe that a bit.

Asked by gvdhoorn on 2017-07-12 01:56:39 UTC

Is the increased load only in the rosbag process? I've found that recording high-throughput topics with no other subscribers can add significant serialization overhead to the publisher (which was previously idle).

Asked by Ed Venator on 2017-07-12 21:17:29 UTC

@gvdhoorn, I played with buff- & chunk-size, but this did not get big improvements. I only did some system profiling (iostat, netstat, etc.) but still need to profile the record node and others.

@Ed Venator, yep, this is true, I see other nodes' CPU rising when turning on recording.

Asked by rob_ros on 2017-07-17 13:42:11 UTC

@Ed Venator, I guess besides reducing messages sizes (which I have done as much as possible), reducing frequencies and not recording everything, there is not much to do to improve performance?

Asked by rob_ros on 2017-07-17 13:44:05 UTC

There's probably not much you can do. You could use topic_tools/throttle to reduce the rate of the topics going into the record node, but there's no way to completely isolate the effects of bagging.

Asked by Ed Venator on 2017-07-18 19:45:49 UTC

Just to get an idea: if load is increased because rosbag introduces additional subscribers then it might be interesting to know what sort of nrs of nodes we're talking about here. 10, 100? rosbag record -a obviously records everything, so that could result in quite some additional subscriptions.

Asked by gvdhoorn on 2017-07-19 06:08:28 UTC

Do you have any nodelets, or is everything only nodes? I don't know what the status is, but if you have nodelets then osrf/nodelet_rosbag could be interesting.

Asked by gvdhoorn on 2017-07-19 06:10:26 UTC

I see other nodes' CPU rising when turning on recording.

that is somewhat expected, but I would expect that transferring one additional float to a single additional subscriber should not lead to 5 times the load on the system. Can you say a bit more about topology and architecture?

Asked by gvdhoorn on 2017-07-19 06:12:22 UTC

@gvdhoorn: 10 nodes, which have increased CPU load when bagging is on. I see CPU rising from 5% to 10%. Including a record node (does "record -a") running at ~ 100% CPU could explain part of the load increase. probably IO adds to the load as well, which gives us the 4x load increase

Asked by rob_ros on 2017-07-19 19:37:38 UTC

@gvdhoorn: Topology is very simple: all ROS nodes run on a 6-core multiprocessor. once bagging is turned on, a recorder ROS node running on the same processor listens to all topics and writes a bag file to disk. Each message is comprised of float32 values. we send roughly 10 floats per message.

Asked by rob_ros on 2017-07-19 19:40:58 UTC

Answers

Did you specify the topic you want to record? The command shown in your question rosbag record -a will record ALL the topics present in your environment.

Regarding your questions:

  1. No, this is not normal. We have robots fully functional while recording topics which amount to as much as 1700KB/sec.

  2. Yes, it could help, but I really doubt that you need it with a topic as small as 200KB/sec. I believe you should try to find what is going on with more details and I would be that you are recording much more topics than needed.

What is the size and content of a recorded bag (rosbag info foo.bag) ?

Asked by Procópio on 2017-07-27 01:56:25 UTC

Comments

We have robots fully functional while recording topics which amount to as much as 1700KB/sec.

data rate is not everything, msg rate is also important.

Asked by gvdhoorn on 2017-07-27 02:32:10 UTC

also, it may be Linux writeback buffers issue: https://unix.stackexchange.com/questions/107703/why-is-my-pc-freezing-while-im-copying-a-file-to-a-pendrive/107722#107722

I am not an expert but it seems like it is highly plausible as your setup has lots of memory

Asked by Alexey on 2019-03-11 08:02:02 UTC

Comments