Ping localhost: high latency

I just bought a gl-inet B1300 and wondering whether to keep it. While evaluating various performance metrics, I found that the ping times are much higher than for the edgerouter ERX that it is replacing (for cost and consolidation reasons). With ERX (stock firmware), pinging the router had a latency consistently <0.5ms. With the gl-inet B1300 (openwrt), I get a latency of 1-2ms on average with it being up to 30ms for some packets. Then I sshed into the router and pinged localhost and was surprised to see similarly high latency which was in the ballpark as that for pinging from desktop to router.

root@OpenWrt:~# ping localhost
PING localhost (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: seq=0 ttl=64 time=0.451 ms
64 bytes from 127.0.0.1: seq=1 ttl=64 time=2.092 ms
64 bytes from 127.0.0.1: seq=2 ttl=64 time=2.916 ms
64 bytes from 127.0.0.1: seq=3 ttl=64 time=3.248 ms
64 bytes from 127.0.0.1: seq=4 ttl=64 time=0.320 ms
64 bytes from 127.0.0.1: seq=5 ttl=64 time=1.621 ms
64 bytes from 127.0.0.1: seq=6 ttl=64 time=2.111 ms
64 bytes from 127.0.0.1: seq=7 ttl=64 time=2.156 ms
64 bytes from 127.0.0.1: seq=8 ttl=64 time=0.319 ms
64 bytes from 127.0.0.1: seq=9 ttl=64 time=2.894 ms
64 bytes from 127.0.0.1: seq=10 ttl=64 time=2.135 ms
64 bytes from 127.0.0.1: seq=11 ttl=64 time=0.329 ms

For comparison, here is the result on my desktop:

[abhishek@optiplex home-aut]$ ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.027 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.039 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.038 ms
64 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.037 ms
64 bytes from 127.0.0.1: icmp_seq=5 ttl=64 time=0.040 ms
64 bytes from 127.0.0.1: icmp_seq=6 ttl=64 time=0.038 ms
64 bytes from 127.0.0.1: icmp_seq=7 ttl=64 time=0.040 ms
64 bytes from 127.0.0.1: icmp_seq=8 ttl=64 time=0.042 ms
64 bytes from 127.0.0.1: icmp_seq=9 ttl=64 time=0.033 ms
64 bytes from 127.0.0.1: icmp_seq=10 ttl=64 time=0.036 ms
64 bytes from 127.0.0.1: icmp_seq=11 ttl=64 time=0.041 ms

I'm fairly sure that this difference would not matter in practice. But I was wondering if I have misconfigured the openwrt (OpenWrt 19.07.3 r11063-85e04e9f46) running on my gl-inet B1300. Also, I am curious to understand why there is a much higher latency on the gl-inet B1300 (vs my desktop).
It would be great if other people having the same router could post their ping localhost results.

What was the CPU usage when you ran that test?

1 Like

I think the cpu usage was not high. top output was mostly like this:

Mem: 72772K used, 178188K free, 280K shrd, 2528K buff, 9640K cached
CPU:   0% usr   0% sys   0% nic  97% idle   0% io   0% irq   1% sirq
Load average: 0.16 0.09 0.11 2/79 5549

Yes, that looks normal, I also think there is something weird there, let's wait for other users to confirm the issue.

2 Likes
# for HOST in 127.0.0.1 ::1 localhost; do mtr -wbc 100 ${HOST}; done
Start: 2020-09-01T12:45:38+0300
HOST: vgrouter              Loss%   Snt   Last   Avg  Best  Wrst StDev
  1.|-- localhost (127.0.0.1)  0.0%   100    0.6   0.6   0.6   0.8   0.0
Start: 2020-09-01T12:47:26+0300
HOST: vgrouter        Loss%   Snt   Last   Avg  Best  Wrst StDev
  1.|-- localhost (::1)  0.0%   100    0.8   0.8   0.8   1.2   0.1
Start: 2020-09-01T12:49:12+0300
HOST: vgrouter        Loss%   Snt   Last   Avg  Best  Wrst StDev
  1.|-- localhost (::1)  0.0%   100    0.8   0.8   0.8   1.1   0.1

# ubus call system board
{
	"kernel": "4.14.187",
	"hostname": "vgrouter",
	"system": "Ralink RT3352 id:1 rev:6",
	"model": "D-Link DIR-620 D1",
	"board_name": "dlink,dir-620-d1",
	"release": {
		"distribution": "OpenWrt",
		"version": "SNAPSHOT",
		"revision": "r13850-e363470d1a",
		"target": "ramips/rt305x",
		"description": "OpenWrt SNAPSHOT r13850-e363470d1a"
	}
}
1 Like

You need to use performance governor, on demand causes massive ping spikes on my IPQ4018 router

2 Likes