Random ping spikes

Hi, English is not my best language so my apologies for the case.

Two days ago I bought a TP-Link Archer C7 v5 hoping that OpenWrt could help me to control the network with SQM and be able to play video games with little latency and it almost did it, except because I have random ping spikes. It doesn't matter if I am alone or there are 10 people downloading at once, my ping is always low but every 1-5 minutes I have a random ping spike that make the game almost unplayable.

I have 50/10 optical fiber connection with a modem/router Huawei HG8245Q2 installed by my IPS, I have access to it, so I disable all Wi-Fi networks and connect my router TP-Link Archer C7 and opened 3 SSID there, one for 5GHz, one for 2.4GHz and one for guest following this guide: https://openwrt.org/docs/guide-user/network/wifi/guestwifi/guest-wlan-webinterface

Also, I installed SQM and set it to 85% of my network with eth0.2(wan, wan6), cake and piece_of_cake.qos, with 44 bytes per packet overhead following this guide: https://openwrt.org/docs/guide-user/network/traffic-shaping/sqm

When I didn't have the Archer C7 router, the modem my IPS installed worked as a router and I didn't have these random ping spikes when i was alone because the moment someone used the connection, the ping went up.

I already tried turning off the SQM, closing the guest network, changing to simple.qos and nothing works, if I connect the PC via cable Ethernet, the ping spike disappears, but I can't have this PC connected via Ethernet all the time.

I can post more info if needed, I was hopping someone could help me to figure out whats wrong with network.

From your description it looks like you have a problem with the WiFi and not with the SQM (since you don't have problems with the wired connection).
Are you connected to the 5Ghz or 2.4Ghz network? Try to use the 5Ghz if possible.
There are also some optimizations can be done to the WiFi. I'm not using this specific router, but if you search you will find some recommendation for WiFi improvements.

1 Like

I tried both connections and is exactly the same problem, with the IPS modem/router, both connections worked fine, isn't there any way I can track the issue?

Okay, I would try the following to try to localize the problem a bit better:

  1. disable the two wifi radio's on the router and try playing via a wired connection (disabling the radios will make sure that there should be no interference from wifi at all).
  2. Open a ssh shell to the router and run top -d 1 (note you need to use ctrl-c to end this) to monitor the CPU usage:
Mem: 41256K used, 17456K free, 796K shrd, 3360K buff, 6612K cached
CPU:   0% usr   9% sys  89% nic   0% idle   0% io   0% irq   0% sirq
Load average: 1.06 1.03 1.00 2/69 31189

Here is the output from my link, during gaming, when the ping spikes occur have a look at the X% idle and the X% sirq fields, if idle dips below 5-10% it would indicate that your router is running out of CPU cycles. (Typically sirq will go up, but the totals load is 100 - X% idle). Please note that traffic shaping does not only need enough CPU cycles in total, but it also needs the quickly enough, so even at a load < 100% sqm might already struggle.

So these SSDs are handled by the OpenWrt device? Anyway, unless the ISP router is in bridge mode you probably deal with double NAT wich is not ideal (but typically tolerable).

That should work ore or less. Could you post the output of tc -s qdisc and cat /etc/config/sqm please?

Oha, there is your problem, wifi, as so often... Really consider running a long cable... I had issues like yours and it turned out it was macos on my laptop insisting upon cyclically scanning all wifi channels and during the scans latency went up, only reliable solution for me was not running a cable (or not caring too much as I do not game, and the latency spikes are rare/short enough to not bother my interactive ssh sessions (using mosh instead of plain ssh helps there as well)).

1 Like

Also, please note, over wifi, it could also be the wifi devices of your neighbors the cyclically do crazy things and almost lock you out of air time.

Which two connections precisely you are talking about here, 2.4 and 5GHz, wifi and wired?

I read recently (on this forum I think) that the beacon interval better be set to a prime number instead of the default 100ms: 101 or 103 to minimize the chances of overlapping with surrounding APs. Would that help?

1 Like

this is an interesting idea, but I doubt it will help, there is already a protocol for collision avoidance, and not everyone turns on their router at the same. millisecond :sweat_smile:

I don't think it would hurt, but your problem is much more likely caused by AP scans like @moeller0 suggested. or other things. your neighbors might do.

Gaming on wifi is just inherently variable. For gaming sessions a wire is far preferred.

2 Likes

With ethernet cable, there are no spikes at all, only with WiFi from the OpenWrt device, also, the spikes not only happens when gamming, if I do for example ping 8.8.8.8 -t i can see the ping spike

Also, I have been cheking %idle and is always at 90 - 98% with or without the ping spikes, %sirq is 0 - 5% also with or without the ping spikes

Yes, all the SSIDs are handled by the OpenWrt device, I am going to investigate about bridge mode to activate it or see if is activated

Here the tc -s qdisc

root@OpenWrt:~# tc -s qdisc
qdisc noqueue 0: dev lo root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc fq_codel 0: dev eth0 root refcnt 2 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 4Mb ecn
 Sent 248413464 bytes 2113910 pkt (dropped 0, overlimits 0 requeues 24)
 backlog 0b 0p requeues 24
  maxpacket 219 drop_overlimit 0 new_flow_count 24 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc noqueue 0: dev br-lan root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc noqueue 0: dev eth0.1 root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc cake 8004: dev eth0.2 root refcnt 2 bandwidth 8500Kbit besteffort triple-isolate nonat nowash no-ack-filter split-gso rtt 100.0ms noatm overhead 44
 Sent 202913108 bytes 1968946 pkt (dropped 128, overlimits 263511 requeues 0)
 backlog 0b 0p requeues 0
 memory used: 219296b of 4Mb
 capacity estimate: 8500Kbit
 min/max network layer size:           28 /    1452
 min/max overhead-adjusted size:       72 /    1496
 average network hdr offset:           14

                  Tin 0
  thresh       8500Kbit
  target          5.0ms
  interval      100.0ms
  pk_delay        1.6ms
  av_delay        382us
  sp_delay          8us
  backlog            0b
  pkts          1969074
  bytes       203083657
  way_inds         7848
  way_miss        14129
  way_cols            0
  drops             128
  marks               3
  ack_drop            0
  sp_flows            1
  bk_flows            1
  un_flows            0
  max_len         14660
  quantum           300

qdisc ingress ffff: dev eth0.2 parent ffff:fff1 ----------------
 Sent 5732922181 bytes 4259956 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc cake 8005: dev ifb4eth0.2 root refcnt 2 bandwidth 42500Kbit besteffort triple-isolate nonat wash no-ack-filter split-gso rtt 100.0ms noatm overhead 44
 Sent 5789947104 bytes 4258162 pkt (dropped 1794, overlimits 7218858 requeues 0)
 backlog 0b 0p requeues 0
 memory used: 1388800b of 4Mb
 capacity estimate: 42500Kbit
 min/max network layer size:           46 /    1500
 min/max overhead-adjusted size:       90 /    1544
 average network hdr offset:           14

                  Tin 0
  thresh      42500Kbit
  target          5.0ms
  interval      100.0ms
  pk_delay         87us
  av_delay         13us
  sp_delay          7us
  backlog            0b
  pkts          4259956
  bytes      5792561565
  way_inds         9630
  way_miss        13982
  way_cols            0
  drops            1794
  marks               3
  ack_drop            0
  sp_flows            1
  bk_flows            1
  un_flows            0
  max_len          1514
  quantum          1296

qdisc noqueue 0: dev wlan1 root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc cake 8016: dev wlan1-1 root refcnt 5 bandwidth 1100Kbit besteffort triple-isolate nonat nowash no-ack-filter split-gso rtt 100.0ms noatm overhead 44
 Sent 440 bytes 4 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
 memory used: 2240b of 4Mb
 capacity estimate: 1100Kbit
 min/max network layer size:           76 /     116
 min/max overhead-adjusted size:      120 /     160
 average network hdr offset:            0

                  Tin 0
  thresh       1100Kbit
  target         16.5ms
  interval      111.5ms
  pk_delay          9us
  av_delay          0us
  sp_delay          0us
  backlog            0b
  pkts                4
  bytes             440
  way_inds            0
  way_miss            1
  way_cols            0
  drops               0
  marks               0
  ack_drop            0
  sp_flows            0
  bk_flows            1
  un_flows            0
  max_len           130
  quantum           300

qdisc ingress ffff: dev wlan1-1 parent ffff:fff1 ----------------
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc cake 8017: dev ifb4wlan1-1 root refcnt 2 bandwidth 1100Kbit besteffort triple-isolate nonat wash no-ack-filter split-gso rtt 100.0ms noatm overhead 44
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
 memory used: 0b of 4Mb
 capacity estimate: 1100Kbit
 min/max network layer size:        65535 /       0
 min/max overhead-adjusted size:    65535 /       0
 average network hdr offset:            0

                  Tin 0
  thresh       1100Kbit
  target         16.5ms
  interval      111.5ms
  pk_delay          0us
  av_delay          0us
  sp_delay          0us
  backlog            0b
  pkts                0
  bytes               0
  way_inds            0
  way_miss            0
  way_cols            0
  drops               0
  marks               0
  ack_drop            0
  sp_flows            0
  bk_flows            0
  un_flows            0
  max_len             0
  quantum           300

qdisc noqueue 0: dev wlan0 root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0

Here the cat /etc/config/sqm

config queue 'eth1'
        option qdisc_advanced '0'
        option interface 'eth0.2'
        option download '42500'
        option upload '8500'
        option debug_logging '0'
        option verbosity '5'
        option qdisc 'cake'
        option script 'piece_of_cake.qos'
        option linklayer 'ethernet'
        option overhead '44'
        option enabled '1'

The thing is, the WiFi work well with my IPS router but doesn't with the OpenWrt device, I really cant run a long ethernet cable, thats why i brought the Archer C7

Where I live there is no neighborhoods
Yes, the two connectios with ping spikes are the 2.4 and 5GHz from the OpenWrt device, if I enable the 2.4 and 5GHz from the IPS modem, the ping spikes are not there

Where I live, there is not neighborhoods, the only Wi-Fi signal in meters is mine.
I will try disabling the continuous scanning and will report back.

Edit: I disable the scanning with netsh wlan set autoconfig enabled=no interface="Wi-Fi" and the spikes are still there

Ping statistics for 8.8.8.8:
    Packets: Sent = 246, Received = 246, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 60ms, Maximum = 191ms, Average = 62ms

Great, that indicates it is not a simple overload and also easily avoidable by a cable run (and note ethernet segments with halfway decent cable can be up to 100m in length, maybe allowing to route the cable outside of the house). Except as you say cable is not an option...

Okay, that rules out normal interference by veridical wifi APs and STAs sharing the same or interfering channels, but that still leaves all other sources of signal an noise in the right frequency bands...

That said could you post the output of cat /etc/config/wireless maybe this is related to some configuration, BUT please REACT your WIFI PASSWORDs as these are readable in the config file! (Sorry for shouting, but I want to see no private passwords in the forums ;))

So if you only enable and use 2.4GHz you see the ping spikes as well as when you only enable and use the 5GHz radio?

BTW, according to this you only have one active sqm instance, but from the tc -s qdisc output it is clear there is another cake pair living on wlan1-1

What is up with that instance?

root@OpenWrt:~# cat /etc/config/wireless

config wifi-device 'radio0'
        option type 'mac80211'
        option hwmode '11a'
        option path 'pci0000:00/0000:00:00.0'
        option channel '36'
        option country 'US'
        option legacy_rates '1'
        option htmode 'VHT80'

config wifi-iface 'default_radio0'
        option device 'radio0'
        option network 'lan'
        option mode 'ap'
        option ssid 'OpenWrt 5GHz'
        option encryption 'psk2'
        option key 

config wifi-device 'radio1'
        option type 'mac80211'
        option hwmode '11g'
        option path 'platform/qca956x_wmac'
        option htmode 'HT40'
        option legacy_rates '1'
        option channel '1'
        option country 'US'

config wifi-iface 'default_radio1'
        option device 'radio1'
        option network 'lan'
        option mode 'ap'
        option ssid 'OpenWrt'
        option encryption 'psk2'
        option key

config wifi-iface
        option device 'radio1'
        option mode 'ap'
        option ssid 'OpenWrt - Invitado'
        option network 'guest'
        option encryption 'psk2'
        option key
        option isolate '1'

OpenWrt - Invitado is the guest one

Exactly, I get ping spikes over 2.4GHz and over 5GHz as well if the signal come from the OpenWrt device

I forgot to copy that one sorry

config queue
        option debug_logging '0'
        option verbosity '5'
        option interface 'wlan1-1'
        option download '1100'
        option upload '1100'
        option qdisc_advanced '0'
        option linklayer 'ethernet'
        option overhead '44'
        option enabled '1'
        option qdisc 'cake'
        option script 'piece_of_cake.qos'

This is a second sqm that allow me to block the download and upload from the guest network, but already try turning both sqm off and the spikes are still there, the sqm works surprisingly well btw

I was thinking, could the problem be my PC? I dont have a second PC to try until like a week but this problem is really weird maybe my network card is the issue?

I have same problem as OP, I am sitting next to archer C7 V2 running openwrt 19.07.
Running ping myrouteripaddress is reporting average 30ms ping but every 5-10 second ping spike has about 130-200ms, my connection on phone is terrible. Could it be OpenWRT fault ? I havent tried installing stock firmware if that could help...I will report with this later.

If anybody have this kind of problem please report this, all my mobile device are useless now because it affects loading images, files on drive etc, on pc connected with cable its fast as hell.

I think all my problems started from version 18.06.04, I have no balls for downgrading now but if this issue will be confirmed by more people I will test it.

I have the same problem as OP as well.
I am sitting next to an Archer C7 V5 running openwrt 21.02.2

I've had this issue for years across multiple laptops and I can't seem to figure out what in the world is the problem!

I am not using SQM. I feel like there is a certain script kiddie attack that this router is sensitive to, acting like a mini DoS attack that occurs every few minutes.

Even when I'm in the house all by myself with nothing connected except my laptop, it will happen.

I am hundreds of feet from the nearest house, my channels are 100% clean.

It happens on both 2.4 and 5Ghz.

I am going to verify the DoS attack by disconnect the ethernet between the C7 and the internet gateway to see if the issue stops.