Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using TCP Acks to measure latency to a server?

I am trying to measure latency to a server that I don't control. This is in a colocated environment, so the latency is on the order of 500 us (.5 ms).

I understand that Cisco gear frequently deprioritizes ICMP traffic, making ping times unreliable. Is there a way for me to tell if this is the case on the gear I am traversing?

Can I use TCP acknowledgements to determine the minimum latency to the remote server? To do this, I would somehow need to force the remote server to send a TCP ack immediately on receiving my data.

like image 622
Ted Graham Avatar asked May 05 '10 15:05

Ted Graham


2 Answers

Try hping. You can send acks and measure the latency:

hping -A -p 80 host

or with a SYN:

hping -S -p 80 host

Also note, deprioritization on a layer-2 link is unlikely (but possible). In addition, seeing ARP being slower than ICMP doesn't necessarily mean ICMP isn't deprioritized---it might mean bandwidth is insufficient to hit the limiting threshold.

ARP will almost always be slower because it broadcasts and may suffer port-queuing at the switch. You could unicast ARP, but that might look suspicious if anyone is looking for it.

like image 143
Eric Wheeler Avatar answered Sep 18 '22 21:09

Eric Wheeler


You could try using arping, which does a ping using ARPs.

like image 36
caf Avatar answered Sep 20 '22 21:09

caf