macOS wifi ping spikes

Hey Apple devs,


Has anyone encountered ping spikes on macOS when using WiFi? When you run a constant ping, it looks like this…


64 bytes from 192.168.0.30: icmp_seq=502 ttl=128 time=1.443 ms

64 bytes from 192.168.0.30: icmp_seq=503 ttl=128 time=3.007 ms

64 bytes from 192.168.0.30: icmp_seq=504 ttl=128 time=1.684 ms

64 bytes from 192.168.0.30: icmp_seq=505 ttl=128 time=186.861 ms

64 bytes from 192.168.0.30: icmp_seq=506 ttl=128 time=69.545 ms

64 bytes from 192.168.0.30: icmp_seq=507 ttl=128 time=141.434 ms

64 bytes from 192.168.0.30: icmp_seq=508 ttl=128 time=24.043 ms

64 bytes from 192.168.0.30: icmp_seq=509 ttl=128 time=2.961 ms

64 bytes from 192.168.0.30: icmp_seq=510 ttl=128 time=1.827 ms

64 bytes from 192.168.0.30: icmp_seq=511 ttl=128 time=1.171 ms


Seems to happen reliably when you open the WiFi menu bar on High Sierra. Other apps can cause this too.


I think others are seeing this issue too (especially gamers):

https://apple.stackexchange.com/questions/263638/macbook-pro-experiencing-ping-spikes-to-local-router


As well as games, real time network apps like Synergy suffer too:

https://symless.com/help/mac-wifi-lag


Cheers,

Nick

Accepted Reply

Before we start:

  • I’m presuming that by “spikes” you’re referring to the sections of increased latency.

  • Also, make sure to read Wi-Fi Fundamentals because I’ll assume terms from there.

Most Wi-Fi hardware only has a single radio, and that radio must be tuned to a specific channel. Thus, the hardware can only work on one channel at a time.

However, there are situations where a STA need to switch channels. For example:

  • When actively scanning for networks

  • When an Apple STA is coordinating peer-to-peer Wi-Fi work

While it’s on that temporary channel, the STA can’t be on the channel it’s using to communicating with the AP, and thus you see spikes in latency.

If you want to investigate this further you should read Investigating Network Latency Problems. That shows how to isolate the cause of the latency to one specific subsystem. And, in the C and D case, you can use a Wi-Fi level packet trace to see what’s really happening on the ‘wire’.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Replies

can you let me know if this is already logged as a bug?

Realistically, you should file your own bug about this even if it’s others have already done so. These problems are often specific to both your hardware and your environment.

Before filing a bug, review the comments in my 2 Mar 2018 and 25 Oct 2018 posts. Investigating bugs like this is hard, and it’s best if you can provide detailed information about the problem. IMO it’s worth going through the debugging procedure described in Investigating Network Latency Problems to help isolate the hop that’s causing the delay. And retain the evidence you collect during that process so that you can attach it to your bug report.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

I just came across this thread and here's an update ...


My problem


I'm using Airfoil to transmit music playback from the Music to the Sonos One speaker and I'm experiencing lot of sound drops (playback interruptions). This problem occurs only and only when my MacBook Pro is connected via WiFi. There's no issue if I turn WiFi off and use an USB dongle with ethernet cable.


I can easily reproduce this problem by holding down the Option key and start rapidly clicking on the WiFi menu bar icon. The problem appears almost immediately and while I'm rapidly clicking on the icon there's basically no music playback.


Network traffic


Airfoil sends +- 4MB of data per minute, roughly 125 UDP (IPv4) packets/second. When this problem occurs, packet rate drops down to +- 60 packets/second, immediately goes up to 600 packets/second and then back to normal 125 UDP packets/second.


Other notes


When I open the Wireless Diagnostics, I see that my Tx rate is about 600Mbps & MCS Index is 7. But when I'm rapidly clicking on the WiFi menu icon, MCS Index circulates 7 -> 9 -> 7 -> 9 -> ... and the Tx rate goes up to 800Mbps and then back to 600Mbps. Not sure if it's related to this issues, but these (Tx rate & MCS Index) changes appear at the same time when the sound drops out.


Comparison to the Music.app


The official Music isn't affected. One can quit the Airfoil and transmit music via Airplay in the Music directly (there's a button on the right side of the volume slider). No matter what I do, there's no sound drop at all. The difference here is that the Music:


  • utilizes AirPlayXPCHelper,
  • amount of data sent per minute is +- 2MB (half of the Airfoil traffic),
  • more importantly, Instruments & Wireshark tells me that the music is sent via TCP (IPv6) and there's also lot of PTPv2 traffic.


Other network traffic


There's no other network traffic. While this is happening, no uploads, no downloads, just the music transmission.


Workaround


I don't have a solution for this problem, but when I disabled Location Services completely (System Preferences - Security & Privacy - Location Services and uncheck the Enable Location Services) & rebooted, the problem disappeared completely. I can rapidly click on the WiFi menu icon, no sound drops at all. Thanks for the tip in this thread!


HW & OS


  • macOS Catalina (10.15.3 -19D76)
  • MacBook Pro (15-inch, 2016 - MacBookPro13,3)
  • tp-link Archer VR300 v1 VDSL modem (1.0.0 0.8.0 v009c.0 Build 181214 Rel.51117n)


This was reported on Mar 1, 2018. Writing this down on Mar 6, 2020 and the issue is still there. 2 years, pretty sad for such a crucial component like networking.


What's next?


I'll test it for the whole day with disabled Location Services (so far good) and then I'll start enabling apps/system services one by one to see if there's a difference and to find which one is causing this issue. Then I'll gather wireless diagnostics, system logs & Airfoil logs and will report it to the Apple & Rogue Amoeba (Airfoil).


I'm in touch with Rogue Amoeba support, but at this stage, I can't really say if there's anything they can do in the Airfoil to prevent this or not. I still don't know what's causing this. Disabled Location services is a hint, but it's still too broad.


In the meanwhile, no location services, no Find My MBP, ...

Reported as FB7619830 in case anyone reads it.

Reported as FB7634737.

I was experiencing the exact same thing on an early 2015 MBP w/ Catalina. It was extremely aggravating as the 2.4GHz radio seems dead and 5GHz wasn't working well due to location relative to AP. Timestamping ping and running "/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport logger" showed that there was dependence on ping spikes (~1.5ms jumping up to ~200ms) to the local gateway with this airportd autojoin message, "Wed Jan 27 10:53:47: AutoJoin: <airportd[219]> Successful cache-assisted scan request for locationd" The MBP was constantly scanning, and without a decent WiFi connection, networking would ultimately fail.

The ping spikes were also dependent on the "kernel_task" process running, which probably means that networking was blocked in the kernel during the time airportd was doing a scan for locationd.

So, observing that all this was dependent and locationd had way more CPU time then one would imagine, it quickly led to the "Find My Mac" feature. Turning this off quieted locationd and the MBP completely stopped doing a WiFi scans.

Hopefully this helps others.

Hi,

here is my experience with the new MacbookPro from 2021 and macOS Monterey 12.3.

The ping spikes are still an annoying problem especially if you are working remotely via SSH. After endless debugging and tracing I solved the problem by deactivating the "Find My Mac" feature in the iCloud settings and restarting. I don't get why Apple is not addressing this problem. In my case I had the ping spikes every 5 seconds causing SSH, RDP connections to lag big time. This needs to be fixed because the "Find My Mac" feature is a huge plus and I don't want to deactivate it every time I leave the house.

Greetings

This bug has been driving me absolutely nuts for about 6 months. I was sure it was my router or my ISP (who would suspect a brand new $2500 macbook pro??). Spent countless hours trying to troubleshoot a nonexistent issue with those. I finally dug out my old 2014 macbook pro and the connection is absolutely perfect. The ping is an extremely consistent 20-30ms. On my new mac running monterey, every 30-60 secons or so, the ping will spike up to 1000ms+ or completely drop packets for ~2-3 seconds. Apple has built up a tremendous loyalty from me over the years, but these are the sorts of issues that will very quickly erode all of that.

I found a workaround which worked for me. If you have an iPad connected to the same network, disable Bluetooth and the lag spike goes away on the Mac.

This problem still exists on 2021 Macbook Pro M1 laptop. Every ~10 seconds there's a spike in network latency raising the ping responses from the router up to 300ms. Disabling the Location Services has no impact, but disabling Bluetooth solves the issue and I'm getting consistent ping responses. iPhone connected to the same router doesn't have this problem, same for a couple of Windows laptops - all can work fine with Bluetooth AND Wifi enabled at the same time.

  • Tank you, man! I even bought a new Keenetic router instead of a quite new TP-Link, attempting to solve this problem. I can't believe that Bluetooth could influence ping that hard. Well done apple engineers.

  • Disabling bluetooth helped me too. Well, at least laptop still has a headphone jack... I had those 10 sec spikes of latency and as soon I turned off bluetooth it stopped spiking. Crazy 4, 4, 4, 4, 3, 3, 3, 4, 3, 63, 95, 28, 4, 3, 4, 3, 4, 4, 4, 3, 4, 4, 4, 82, 115, 64, 4, 4, 2, 3, 4, 4, 3, 3, 4, 3, 4, 53, 79, 114, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3

Add a Comment

I realize this is an old thread, but this (disabling awdl0) has been the sure-fire solution for me: https://medium.com/@mariociabarra/wifriedx-in-depth-look-at-yosemite-wifi-and-awdl-airdrop-41a93eb22e48

The WiFriedX app is optional, but is nice if you don't want to have to monitor the active state of awdl0.

  • Here is a much more in-depth overview of AWDL and how it works: https://wlanprofessionals.com/an-overview-of-apple-wireless-direct

Add a Comment