0
$\begingroup$

Rosanswers logo

Hello,

My main question is : what could cause messages to be detectable by a queue by batches instead of right after they are published ?

Here are the details :

  • I publish a message at 500Hz
  • I'm checking the callback queue (=spinning) at 500Hz
  • the callback duration is < 0.1ms ( when a batch of 10 ( max queue size ) callabacks are called, it takes less then a ms )
  • using the callbackqueue->isempty() function, i can see that the CallbackQueue is empty most of the time which is not normal ( its size should be 1 (+-1) at each iteration )
  • After a variable time, the callbackqueue is no more empty ( isempty =0 ) and I receive all the messages that i should have received earlier ( in the limit of my queue ).

All the informations i'm giving above have been verified using text outputs.If needed i can upload codes and text outputs ( but the texts output takes arround 200 lines to be meaningfull ).

I tried to test the standard ros behavior by creating 2 simple nods : 1 publisher at 500hz, 1 subscriber at 500Hz, the subscriber node code being nearly the same than in my real code and it worked as expected. At nearly each iteration, isempty = false and i receive a message.

So my question is, is there any known things could delay the detection of the send messages (or the pushing in the queue?) and be responsible for the behavior i'm experiencing ?

Thanks a lot if anyone as an idee, TTDM


Originally posted by TTDM on ROS Answers with karma: 267 on 2017-10-05

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

See also this answer. As stated there, this is probably due to TCP/IPs Nagle's algorithm at work, which is default enabled for ROS communication and has to be explicitly disabled.


Originally posted by Stefan Kohlbrecher with karma: 24361 on 2017-10-05

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by TTDM on 2017-10-06:
My bad for not seing it, thanks for the answer! It's quite surprising that the Nagle's Algorithm, which, according to the first 2 wikipedia lines, should mainly be applied on short messages has an undesired effect only on large messages ! I will try to look into it If i find the time. Thank again!

Comment by gvdhoorn on 2017-10-06:
"large" and "small" are rather relative terms, so they may change over time.

Comment by TTDM on 2017-10-06:
Sure but the way I understand it, it should have an effect on messages in the [0, any limit] ("small") size interval, when it currently have an effect on [any limit, +inf ] ("large") size, edit : see link in answer above

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.