Why hping3 rtt >> sockperf latency

1k Views Asked by At

I tried to run tcp hping3 on linux VM in same network, got avg rtt ~5ms

sudo hping3 -S -p 22 10.1.0.8 -c 100
...
len=44 ip=10.1.0.8 ttl=64 DF id=0 sport=22 flags=SA seq=98 win=29200 rtt=0.6 ms
len=44 ip=10.1.0.8 ttl=64 DF id=0 sport=22 flags=SA seq=99 win=29200 rtt=1.4 ms

--- 10.1.0.8 hping statistic ---
100 packets transmitted, 100 packets received, 0% packet loss
round-trip min/avg/max = 0.6/5.2/9.7 ms

If I measure latency using sockperf tool avg latency is getting ~ 0.5ms

(sockperf.bin ping-pong -i 10.1.0.8 -p 8302 -t 15 --pps=max )
sockperf output: 
[[2;35m====> avg-lat=495.943 (std-dev=484.312)
[[0msockperf: # dropped messages = 0; # duplicated messages = 0; # out-of-order messages = 0sockperf: Summary: Latency is 495.943 usecsockperf: 
[[2;35mTotal 15119 observations
[[0m; each percentile contains 151.19 observationssockperf: ---> <MAX> observation = 6839.398sockperf: ---> percentile 99.999 = 6839.398sockperf: ---> percentile 99.990 = 5292.623sockperf: ---> percentile 99.900 = 4023.327sockperf: ---> percentile 99.000 = 2434.115sockperf: ---> percentile 90.000 = 1005.612sockperf: ---> percentile 75.000 =  638.746sockperf: ---> percentile 50.000 =  360.516sockperf: ---> percentile 25.000 =  178.134sockperf: ---> <MIN> observation =   45.356

Wanted to know what could be the reason for such large difference between latency of these two tool. Does internal way of measuring tcp rtt from hping3 and tcp latency from sockperf same? Am I doing anything wrong here?

To verify I also tried to measure tcp latency between two windows VM in same network using psping tool

Connecting to 10.1.0.7:8888: from 10.1.0.6:62312: 1.03ms

TCP connect statistics for 10.1.0.7:8888:
  Sent = 100, Received = 100, Lost = 0 (0% loss),
  Minimum = 0.59ms, Maximum = 9.82ms, Average = 1.05ms
0

There are 0 best solutions below