Latency doesn't change when switching TCP to UDP in TransportHints

asked 2019-02-26 12:18:20 -0600

VTH2018 gravatar image

I have tried changing the topics ros uses when doing the simple C++ publisher and subscriber. From what I understand, UDP should be faster in terms of latency and I wanted to test by how much, compared to TCP. After running the test, it doesn't seem to be different. Here is a picture of the results that I got when sending 89 characters using different settings in TransportHints. I was wondering why this is the case.

Some information on how I tested latency: Using the seconds in the terminals I found the difference for 200 samples for each topics.

edit retag flag offensive close merge delete


Two comments:

  1. UDP is not inherently faster in all cases
  2. please don't post screenshots of terminals, it's just text, so copy-paste the text
gvdhoorn gravatar image gvdhoorn  ( 2019-02-26 12:39:24 -0600 )edit

Just to add; if you're testing both nodes on the same computer, you likely won't see any substantial difference between TCP and UDP because the messages are sent locally, and aren't actually sent over the network cable.

ahendrix gravatar image ahendrix  ( 2019-02-26 13:43:20 -0600 )edit