58

I'm experiencing extreme ping spikes to my AirPort Extreme (local IP: 192.168.1.1), however I am not getting these ping spikes on another MacBook Pro right next to it.

Here are my ping results.

PING 192.168.1.1 (192.168.1.1): 56 data bytes
64 bytes from 192.168.1.1: icmp_seq=0 ttl=64 time=24.703 ms
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=145.378 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=975.540 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=577.900 ms
64 bytes from 192.168.1.1: icmp_seq=4 ttl=64 time=2.802 ms
64 bytes from 192.168.1.1: icmp_seq=5 ttl=64 time=5.377 ms
64 bytes from 192.168.1.1: icmp_seq=6 ttl=64 time=5.922 ms
64 bytes from 192.168.1.1: icmp_seq=7 ttl=64 time=3.854 ms
64 bytes from 192.168.1.1: icmp_seq=8 ttl=64 time=3.522 ms
64 bytes from 192.168.1.1: icmp_seq=9 ttl=64 time=4.593 ms

--- 192.168.1.1 ping statistics ---
10 packets transmitted, 10 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 2.802/174.959/975.540/316.450 ms

MacBook Pro (Retina, 13-inch, Early 2015)

2
  • Have you disconnected all wi-fi or hard-wired devices (other computers, including iDevices, AppleTV(s), home automation devices, etc,) from the APEx , except for the device you are sending the pings? From these brief blips I would assume the APEx is connecting to the external network for some reason. Let it run for at least 100 iterations (or more) and see if there is some sort of pattern which would indicate a process on the APEx periodically 'phoning home'. Report back with what you see. Don't paste in a huge ping listing, please. :-)
    – IconDaemon
    Jul 21, 2017 at 12:25
  • IMHO I found the ping listing helpful
    – Brian Low
    Mar 12, 2018 at 3:57

17 Answers 17

47

I'm posting this reply on a few threads to make it easier to find. I chased the same issue and finally found the cause.

Locationd. Open the console app and watch while you do a continuous ping. Every time you see latency spike, you'll see entries for locationd. Go to System Preferences -> Security & Privacy -> Location Services. From there, you can disable and you'll likely see the problem disappear. However, you lose the "find my mac" ability.

What made mine acceptable was going to system services (scroll down)->details->check show icon in menu bar when [...]. Then, take look at what is requesting location. Disallowing Evernote helped a lot. I pruned down to the minimum and the frequency of the spikes has gone down to an acceptable level for me.

edit: filed a bug with Apple because even when location services are disabled, locationd scans (verified in console), impacting latency. Apple marked it as a dupe, so hopefully fixed soon.

9
  • 9
    Can confirm that I'm also seeing these latency spikes that directly correspond to locationd entries in the Console and disabling location services eliminates the spikes. Handy tip: There's an option in ping that'll include a timestamp making it easy to x-ref the logs: ping -i 0.25 192.168.1.1 --apple-time Oct 23, 2018 at 17:15
  • 1
    OP: This should really be the accepted the answer @C-regan! I've been trying everything and this is the rule. If the latency spikes only happen on macosx and you have tried at least 2 different APs this is very likely the answer to your problem! Dec 13, 2018 at 13:23
  • 1
    @user163253 in my case I solved the problem by disabling only some location services, in particular: Weather, Maps, Locations-Based Suggestions, Setting Time Zone, Significant Locations. I still have the following services ON: Calendar, Reminders, Find my mac, Wifi Networks. I suppose the latter are not used as frequently as the former and therefore they have minimal impact on latency. I also noticed that reducing the number of known/saved wifi networks under Network->WiFi->Advanced mitigates the problem.. Dec 13, 2018 at 14:16
  • 3
    I narrowed it down further to specifically the "Time Zone & System Customization" checkbox inside "System Services". I think that is attempting to quickly disconnect from the access point and scan for Wifi access points to get the current time, time zone, and location.
    – Brandon
    May 15, 2019 at 16:01
  • 1
    Care to share a link to your bug report @MJohnson? I had this problem with a unifi network, and would like to keep track of the issue, know when it's solved. Thanks! Nov 27, 2019 at 19:44
44

I've had exactly the same problem, it was troubling me quite a long time. It is especially annoying when working remotely over SSH or playing multiplayer games. Here is my long-term solution:

Diagnosis

Run ping with frequency 10 scans per second to see when is the glitch occurring:

ping 8.8.8.8 -i 0.1

Scanning & Location services

As mentioned by others, WiFi spikes are typically caused by WiFi daemon scanning another WiFi networks around. The scanning goes through all channels so if the current receiving channel is not the same as your AP is transmitting, you have a ping spike.

The scanning is usually triggered by location services. You can review the location services in: System Preferences -> Security & Privacy -> Privacy tab -> Location Services.

Location services

If you go to Advanced check the Show location icon in the menu bar... to see when the apps are querying location thus scanning WiFi neighborhood.

Location services were still active because of System services. Mainly Time Zone & System Customisation and Significant Locations. But after turning that off I still had a WiFi glitch in spite of that Location setting window showed no other application acquiring the location.

Finding the culprit

You need to enable WiFi logging to see why is WiFi daemon doing the scan.

Hold option/alt key (next to the command key) and click WiFi icon in the top toolbar. Click Enable Wi-Fi Logging.

Enable Wi-Fi logging

After that open a new terminal:

tail -f /var/log/wifi.log

You should see something like this:

Mon Jan 14 20:01:21.353 AutoJoin: <airportd[83093]> Successful cache-assisted scan request for texstudio with channels {(
Mon Jan 14 20:01:21.353     <CWChannel: 0x7fbcfadc5b20> [channelNumber=56(5GHz), channelWidth={40MHz(-1)}, active, DFS],
Mon Jan 14 20:01:21.353     <CWChannel: 0x7fbcfadcbfb0> [channelNumber=60(5GHz), channelWidth={40MHz(+1)}, active, DFS],
Mon Jan 14 20:01:21.353     <CWChannel: 0x7fbcfd44c790> [channelNumber=64(5GHz), channelWidth={40MHz(-1)}, active, DFS],
Mon Jan 14 20:01:21.353     <CWChannel: 0x7fbcfadc6ba0> [channelNumber=149(5GHz), channelWidth={80MHz}, active],
Mon Jan 14 20:01:21.353     <CWChannel: 0x7fbcfad2be90> [channelNumber=153(5GHz), channelWidth={80MHz}, active],
Mon Jan 14 20:01:21.353     <CWChannel: 0x7fbcfadf4870> [channelNumber=157(5GHz), channelWidth={80MHz}, active]
Mon Jan 14 20:01:21.353 )} took 0.0005 seconds, returned 2 results
Mon Jan 14 20:01:21.353 Scan: <airportd[83093]> Cache-assisted scan request for texstudio on channel 161 does not require a live scan
Mon Jan 14 20:01:21.353 Scan: <airportd[83093]> Cache-assisted scan request for texstudio on channel 165 does not require a live scan
Mon Jan 14 20:01:21.353 Scan: <airportd[83093]> Cache-assisted scan request for texstudio on channel 100 does not require a live scan
Mon Jan 14 20:01:21.353 Scan: <airportd[83093]> Cache-assisted scan request for texstudio on channel 104 does not require a live scan
Mon Jan 14 20:01:21.353 Scan: <airportd[83093]> Cache-assisted scan request for texstudio on channel 108 does not require a live scan
Mon Jan 14 20:01:21.353 Scan: <airportd[83093]> Cache-assisted scan request for texstudio on channel 112 does not require a live scan
Mon Jan 14 20:01:21.353 Scan: <airportd[83093]> Cache-assisted scan request for texstudio does not require a live scan

Now observe ping terminal and wifi log terminal next to each other. You can clearly see the glitch occurrs precisely when WiFi is doing the scan.

In my case the culprit was a program texstudio, as you can see from the log. It was acquiring location every 5 seconds (wt.?), which was is confirmed also by this guy: https://justus.berlin/2016/04/reducing-cpu-load-and-energy-consumption-of-texstudio-on-the-mac/

This solved my problem. The Texstudio was not mentioned in the location services list so this advanced approach was necessary.

Summary:

  • The culprit is location services and wifi scanning
  • Check location services you have enabled
  • Hold Option keyboard key, click the WiFi icon in the top toolbar, click Enable Wi-Fi Logging
  • Execute in terminal: ping 8.8.8.8 -i 0.1
  • Execute in terminal: tail -f /var/log/wifi.log, in a new window. Observe side by side, wait for glitch.
  • Check the log when the glitch was observed, kill the program.
6
  • 3
    The tip on enabling wifi logging was key for me to track down the source
    – Jehiah
    Mar 29, 2019 at 0:45
  • I find SystemUIServer and Joxi(app for screenshot). Thanks Jul 11, 2019 at 10:03
  • Beautiful. This is how I discovered Mega was causing my issue.
    – Birowsky
    Jan 10, 2020 at 14:05
  • @Birowsky Same here, the problem was Megasync. It's very suspicious that it asks for location every 10 seconds.
    – Lechucico
    Jan 23, 2020 at 7:21
  • This is helpful. Kobo is the offender for my case. It's not using location, but trying to scan wifi (to find its reader device?) every 10 sec.
    – Du Song
    Jan 19, 2021 at 17:06
15

In my case, something related to the AWDL was causing ping spikes, and in order to fix it, I had to shut down the awdl0 network interface.

TLDR: this command resolved my ping spike issues: sudo ifconfig awdl0 down

How did I come up with the command above

I've used multiple recommendations from other answers in this thread. I've disabled the Location Services and Bluetooth and still had regular ping spikes. Then I enabled wifi logging by holding alt\option key and clicking wifi icon. Then I've opened two consoles side by side:

  1. ping -i 0.25 192.168.1.1 --apple-time
  2. tail -f /var/log/wifi.log

The ping results were stable until a log message appears:

Tue Feb 16 15:03:40.621 Info: <airportd[12479]> AWDL started

It's interesting that after this message there were no other suspicious messages in the wifi.log, but there were constant ping spikes.

I've continued the investigation and occasionally found this thread on Github with a recommendation to run the command below:

sudo log stream | grep -iE --color 'location|wireless|awdl|phone|rapport|sharing|handoff' That command streams system logs, showing you any lines containing any of those words.

I've run the command above in the third console.

Then I've noticed a lot of messages with a text like "AWDL is still enabled due to active sockets, but no services[nonAirplay:0 Airplay 0]"

2021-02-16 15:39:16.602945+0700 0x1337f7   Default     0x0                  0      0    kernel: (IO80211Family) com.apple.p2p: IO80211AWDLPeerManager::monitorAWDLState AWDL is still enabled due to active sockets, but no services[nonAirplay:0 Airplay 0]

Further digging has led me to the suggestions to verify if awdl0 status is active. (last property in the output)

$ ifconfig awdl0

awdl0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1484
    options=400<CHANNEL_IO>
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect
    status: active

And if the awdl0 is active, in that case, there was a recommendation to shut it down:

sudo ifconfig awdl0 down

After stopping it, ping spikes have gone and the messages "AWDL is still enabled due to active sockets, but no services[nonAirplay:0 Airplay 0]" were gone too.

When I start awdl0 again by calling sudo ifconfig awdl0 up ping spikes return.

3
  • 5
    This answer worked for me. Thank you! (Disabling location services, bluetooth, unlock with apple watch did not work)
    – Josh P
    Nov 25, 2021 at 16:33
  • same here, more information on awdl0 stackoverflow.com/questions/19587701/…
    – 1a1a11a
    Jul 19, 2022 at 19:39
  • How do we get that awdl0 down forever? I think it will go up again after restart.
    – Finn
    Sep 2, 2022 at 3:36
5
+50

Please run this script from the Terminal.app:

while x=1; do /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | grep Ctl; ping -c 1 192.168.1.1; sleep 1; done

This script checks for Signal/Noise ratio. You probably have some interference.

4
  • Can you provide some benchmarks so that we can know what acceptable numbers are?
    – Mike McKay
    Aug 26, 2019 at 17:12
  • SNR 20db is generally ok for file transfer, 25db is enough for voice Aug 27, 2019 at 15:36
  • You can just Alt/Option Click the Wifi icon in the menu bar and get the same info, as well as TX rate. Which is kinda helpful. Apr 17, 2022 at 19:19
  • 1
    Signal/Noise is given as a negative integer, the closer to 0 the better, its a percentage. so -77 means you are only receiving 23% clean, and 77% noise. Apr 17, 2022 at 19:20
4

Following this guide worked for me:

Fix Wi-Fi problems on MacOs Sierra

essentially in the folder /Library/Preferences/SystemConfiguration/ backup and delete files

com.apple.airport.preferences.plist
com.apple.network.eapolclient.configuration.plist
com.apple.wifi.message-tracer.plist
NetworkInterfaces.plist
preferences.plist

Then restart your Mac.

2
  • Interesting - I've seen that buffering come and go - are you thinking that the WiFi is roaming to check other base stations and clearing those preferences / records out keep the WiFi connection more stable?
    – bmike
    Jul 21, 2017 at 19:11
  • What about pinging a different node; say one of the other MacBooks on the network? Does the problem still exist?
    – Allan
    Jul 22, 2017 at 0:40
2

From my experience, in 90% of all cases, restarting the router will fix the issue.

2

In addition to disabling Location Services, disable Wi-Fi roaming too. It turns out that periodically my Mac decides to scan for any other networks that might have better signal, right in the middle of the game, causing Wi-Fi disconnect for a few seconds.

This is how it looks in /var/log/wifi.log:

==> Tue Oct 13 02:54:06.014 AutoJoin: <airportd[2664]> BEST CONNECTED SCAN request on interface en0 for network 'XXXXXX' 
    Tue Oct 13 02:54:06.140 Driver Event: <airportd[2664]> _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0)
    Tue Oct 13 02:54:06.142 AutoJoin: <airportd[2664]> Successful cache-assisted background scan request with channels {(
    Tue Oct 13 02:54:06.142     <CWChannel: 0x7fc439c40cc0> [channelNumber=1(2GHz), channelWidth={20MHz}, active],
    Tue Oct 13 02:54:06.142     <CWChannel: 0x7fc439c44240> [channelNumber=2(2GHz), channelWidth={20MHz}, active],
    Tue Oct 13 02:54:06.142     <CWChannel: 0x7fc439c246b0> [channelNumber=3(2GHz), channelWidth={20MHz}, active]
    Tue Oct 13 02:54:06.142 )} took 0.1262 seconds, returned 2 results
    Tue Oct 13 02:54:06.142 Info: <Wi-Fi Menu Extra[296]> scan cache updated

This is how it's fixed:

sudo defaults write /Library/Preferences/com.apple.airport.opproam disabled -bool true

Reboot after applying.

If you'll need to enable Wi-Fi roaming again, replace true with false in the command above.

1
  • Thank you very much. After having suffered this for the better part of a year, this is what finally fixed the frequent connection freezes for me on 10.15 Catalina. The output of my wifi.log was significantly different, but still clearly related to roaming.
    – janfoeh
    May 5 at 19:53
1

In my case, it was an app for taking screenshots. I detected it by doing the following: I ran ping command and was closing apps one by one, then I noticed after closing this app, ping spikes had gone.

0
1

In my case the high pings were caused by the Deepl application. Hope this helps somebody.

1

Same issue here - can't comment yet, but a little more insight nonetheless:

For me the issue was resolved with regards to the top comment, simply disabled locationd. (mbp 2010, osx 10.13, fresh install)

However, for me it occurred ONLY on en0 = ethernet, but somehow not on WiFi. This might sound benign, but having said that, for someone looking for this issue, the tags "wifi and airport" may sound diverting if their setup is similar to mine.

Also - the ping spikes are not limited to the local router for me. My setup consists of an Access point, connected to my separate (wifi-less) router. My ping spikes were as follows:

  • MacBook -> Access Point (plugged in Ethernet Switchport)
  • MacBook -> Router (via AP Switch)
  • MacBook -> Internet

Also also - it wasn't even spikes for me - more like avg. pings around 1000ms, with frequent drops to the low 100s or almost "normal"

1
  • Welcome to Ask Different! Please refrain from adding comments in the Answer section, this is for answers to the questions. Once you have sufficient reputation you’ll be able to add comments and ask follow-up questions. To gain reputation, answer questions that are clear and concise. - From Review
    – fsb
    Aug 22, 2020 at 14:42
0

I have tracked similar problems to Airplay/Bonjour, ping spikes while airplay is in use or being checked.

I believe this behaviour is actually linked to the bluetooth of the device being linked with the wireless adapter in the device.

I am going to conduct some more tests soon and submit an apple bug report.

if you keep bluetooth disabled you will probably find you will get no ping spikes.

0

The problem still occurs on Mojave, so let me put my two cents here. The source of the problem was locationd and to fix the spikes all I had to was to go to Settings -> Security & Privacy -> Location Services -> (System Services) Details -> uncheck "Time Zone & System Customization"

No idea why would the Mac check time zone every few minutes...

1
  • This is exactly what the top-voted answer already said & adds nothing new.
    – Tetsujin
    Aug 31, 2019 at 12:06
0

Adding for more information as identifying why my mac was dropping off WiFi was excruciatingly painful and time wasteful. TL;DR look at the airportd log to see who is requesting WiFi scans.

The 2.4GHz radio in my mac seems dead. And coincident with that failure, the mac was constantly scanning creating obvious ping spikes to the local gateway which were shown as dependent on the scanning. I believe the ping time went up as networking was blocked on kernel_task. airportd was receiving requests from locationd and this traced to the "Find my mac" feature. When turned off, the MBP stopped scanning. I wonder if dead 2.4GHz hardware results in missed cache hits and actual scanning occurring (vs a several minute cache expiration).

Here is my report to Apple:

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.

0

Turn of the bluetooth. worked for me

1
0

I’m working to correlate log files with this but I don’t yet know how to track/explain/produce these two wifi.log events.

  • Driver Event: <airport[310]> _bsd_80211_event_callback: APPLE80211_M_RSSI_CHANGED (en0)

  • BTC: <airport[310]> __BluetoothCoexHandleUpdateForNode: Driver supports APPLE80211_CAP_COEX_PROFILE_OFFLOAD. Airportd won't BluetoothCoexModeSet() and defer coex profile loading to UDM coex manager (UCM/WRM) ...

My experience is they log before the spikes happen.

1
  • Seeing the same thing. Did you find out what the APPLE80211_M_RSSI_CHANGED is? Dec 7, 2022 at 20:02
0

The following almost completely removed spikes and brought average ping times to 192.168.1.1 (my router) to 3-5s:

while sleep 1; do sudo ifconfig awdl0 down; done

This AWDL interface keeps restarting on its own when AirPlay, AirDrop, Location Services or Bluetooth are changed. This loop from the command line keeps it down. I found that is all I need to do.

-1

If all else in this thread fails...

Restart your Mac!

I've tried every single suggestion here and nothing worked. Then I restarted my Mac and voila - back to stable 10ms pings and no spikes.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .