I noticed this too when I used steam to stream a game to my laptop over good wifi. Every minute it would stutter for a second. I set up iperf3 tests and noticed the wifi lag increasing every minute between my macbook and my server and between my windows desktop pc and my server (when connected over wifi). Of course no lag when using cables, so I reasoned it was wifi related, and had noting to do with my setup (I used different clients, and different AP's). I then took my macbook (only portable computer I had) it too a nearby coffee shop with good wifi and I could still measure lag spikes every minute. So then I was really puzzled, was there some rogue device interfering with wifi all over the neighborhood? Finally I found a suggestion to turn off location services (or whatever it is called), and the spikes disappeared. And I learnt that even when it is not used (not sure it the lid was closed) a macbook can cause significant interference to the wifi for all other nearby devices.
> And I learnt that even when it is not used (not sure it the lid was closed) a macbook can cause significant interference to the wifi for all other nearby devices.
My partner has an older MBP, I noticed this the last time she was forced to updated her OS a major version... the thing no longer sleeps when you tell it to or when you close the lid, it will stay connected to wifi and quite happily saturate the network downloading updates.
Only way to be sure is to power off the stupid thing.
"Do not leave XPS laptop in any sleep/hibernate/standby mode when placed in a bag" because they stay connected to wifi and may attempt to run updates etc when the user is not expecting or prepared for that, as far as cooling.
Yesterday my home DNS weren't resolving and noticed on PiHole that there were >30,000 requests of *.in-addr.arpa (Reverse DNS Lookup) from the iPhone+iPad of the guest to whom I gave the WiFi access and was saturating the Pi's CPU. I re-enabled rate limiting on PiHole and blocked the request with a filter.
A cursory search on the issue says Bonjour is the culprit, I'm forwarding DNS requests to my PiHole instances on my gateway and latest iOS doesn't seem to like it; I haven't faced such issue earlier and I have this setup for several years now.
For extra fun, if while it's sleeping it's connected to a Display Port or USB-C display, it'll wake it up everytime it wakes the wifi for its 'power naps'. Disabling them in System Prefs doesn't change this.
Can confirm that the scripts posted itt by vJan00 [0] solved the stuttering problems that were plaguing me 4-5 months ago. Didn't bother setting up a cronjob; I just toggle it on/off as needed.
Wow, I guess this is also why my local steam streaming (well, I use Moonlight but same difference) started lagging out of nowhere. I first noticed it 2 days ago, but before that I clocked 30 hours no problem, so I guess this is a brand new problem.
Gonna try turning off all my Mac devices location services, thanks for the tip.
This was a few years ago on a 2015 MBP running Catalina or whatever came before that. My guess is the adaptive bandwidth algorithm acutely switches to a lower bandwidth due to the lag spike, and then slowly recovers in the ten seconds after. And then 50 seconds later it starts over again. I suspect if I could have manually set the streaming quality to a fixed value the lag spike would hardly not be noticable at all, but the constant switching of the stream quality is what actually caused chopiness. Same might be the case with the OP's zoom calls
if you have the wherewithal to use iperf then why not wireshark too? it's probably actively sniffing surrounding wifi frames to feed back to its proprietary version of WiGLE.net under the guise of super helpful "location based services"
This is normal across all wifi clients; they can't scan for networks and transfer data simultaneously so there will always be increased latency during that event. You can test this yourself by doing a low-interval ping and clicking the wifi icon to show you nearby networks - you'll notice a brief latency spike.
I agree that it's not a good default to have an app doing this, though.
This may not always be the case, fortunately! I recall the Broadcom Wi-Fi 7 chipset announcement[0] in April mentioned a dedicated scan core which may well offload the network searches to a separate part of the chip, freeing the AP connectivity core(s) from having to do other tasks for a second or two each minute.
Here's hoping it works as I understand it and other chipsets start doing similar things!
Supporting 802.11g means scans are send at 1Mbit. 802.11a bumps it to 6Mb/s, so not much better. This means that every time you want to send a beacon you have a pause equal to the duration it takes to send a packed at 1-6Mbit, not to mention scanning all the channels.
Thank you, this solved a problem I was having with Citrix Workspace. Every ten seconds I would get a ping spike. It reliably destroyed video calls and made typing in the workplace a pain.
My old Mac does not have this problem. Makes no sense to me that Windows allows any random program to trigger wifi scans. It’s a performance issue and privacy issue too.
It’s good to know. I suppose the unintuitive part is that “location” means “Wi-Fi scan”. Makes sense for a laptop when you think about it but I wouldn’t have thought of this as the first thing to check.
It's kind of a weird situation we're in with this. Facebook and Google track your location by default and you can go back and look where you've been on a map. I used it to figure out the details of an automated traffic ticket I got on a trip to Europe a couple of years back, so it's not totally useless from a consumer perspective, but it's still creepy. So you opt out, but "location services" keeps tracking you and sending your location data (as represented by the SSIDs and signal strength around you) but not telling you you're being tracked. So you opt out of that, and all the sudden you're subject to a bunch of dark patterns insisting you need to enable it again, even though it's perfectly capable of just using the GPS and keeping everything on the client. I'm glad my life isn't interesting enough for it to matter, I guess.
> the unintuitive part is that “location” means “Wi-Fi scan”
I was under the impression that this has been SOP for mobile device location forever: get rough location via WiFi and/or tower multilateration while GPS is...I don't know the proper terminology here, bootstrapping? That's why your dot tends to start somewhere nearby-ish and then quicky jump to your exact location.
It's possible that I'm way off base or my understanding is outdated, though.
But if the laptop is currently connected to a WiFi network with a known location, what's the point of scanning for networks to locate it? You already know that you're within range of a known spot.
Roaming. Although a desktop might not usually be moving while it's on, a laptop user might move around the house, conference room, or lecture hall, and switching APs could result in a stronger signal. It's better to switch before your signal gets weak/drops to minimize disruptions during BSS transitions.
On an unrelated note, in my experience Apple devices are consistently the most frustrating devices when it comes to wifi. They are insanely picky about what networks they will connect to, and they are never consistent.
„Within range of one network“ doesn‘t give you as much information as „all these networks are visible and here‘s how strong they look from where you are“
What helped me was not using a hidden SSID. Apparently, with hidden networks, the computer has to actively probe for the network, but passive probes don't affect latency as much.
It happens to me when using Ubiquiti UniFi access points, but not as much with other brands of APs. In fact, certain models of UI APs seem to be more problematic when used with newer Macs.
I discovered this exact problem over lock down 2020. My Teams calls would freeze every 60s.
There's a better solution though! Delete all your saved wifi connections. All those hotels and coffee shops you have connected to in your apple lifetime are the trigger. Reduce them down to those you actually use and the problem goes away.
I'm amazed more people haven't come across this, though from what I've seen people tend to just live with these problems as they don't know where to start in figuring it out.
On Windows, there was an infamous Qt bug that also caused regular ping spike, so check it out if you have the issue and you also happen to be using a Qt program:
I wonder why they keep rescanning the wifi environment even though the fact that it remains connected to the same BSSID and the RSSI doesn’t fluctuate too much should suggest that it’s very unlikely the device moved far enough to warrant another scan.
My anecdotal experience (partially informed by working on the Windows Wi-Fi team) is that iOS/macOS are more aggressive about switching APs. It's a tradeoff - on one hand, you can have disruptive scans like this, but on the other, if it results in switching to a better network during a long period when the user is stationary, it can result in a better experience.
It also depends a lot on what your hardware is, whether you're doing a full scan or a partial scan, whether you have more than one NIC etc, etc.
Maybe it wasn’t a problem worth fixing at the time? Maybe they’ll do exactly this in future versions of the location finder stack.
Edit: somebody pointed out that these scans could be for roaming purposes as well. Maybe there is another access point with a better signal and it’s time to move?
You're forgetting how sensitive this location detection is, these days. Let's say you are moving in a direction roughly parallel to the circle carved out by a given signal strength. You could move quite a long ways without RSSI fluctuating much.
I imagine they have to handle the scenario where you're connected to a mobile access point and can't assume that 0 movement means you're in the same physical location. Watching other APs is going to provide a better picture.
What's the newest Wifi standard? ax? Anyway: it's quite... something? My standard router runs four different networks on two different IDs and if I understand it correctly, the fasted frequencies are subject to occasional use by... my local Patriot air defense system(?) which it needs to occasionally check for.
> the fasted frequencies are subject to occasional use by... my local Patriot air defense system(?)
I think you're you're talking about Radar detection?
My apartment is on the approach-path for one runway of a major airport - I regularly get reports of Radar detection on my Unifi APs when planes are landing in this direction.
I just tried this myself and can't replicate on a 2019 i7 running Big Sur. I wonder if it's related to the number of Wifi networks in range (mine is the only one)... Also, the Apple Maps thing didn't seem to change anything for me, either.
Environment can have huge impact on this. With a larger number of devices, there could be more collisions, increasing traffic more than linearly, and then in case of scanning traffic, the modulation used would likely be the lowest available which means the packets take up a lot of wall clock time. So a broadcast storm with collisions, retries, at the lowest bitrate = brief outage.
I reckon that'd be because it isn't relevant to the topic at all. I'd say most things that advertise written in Rust is because it's a valid upside, not all but definitely most.
I noticed this when using a meeting/streaming tool that detected these bits of latency and went in to a degraded mode, even with abundant bandwidth available.
I tried the various settings for avoiding it, discussed in many other comments here. The only thing that worked for me: get out a USB ethernet adapter and a long wire, don't use WiFi when doing things where it matters.
... which is ridiculous; I don't want or need location scans at all, I am sitting stationary in my home office.
Ok that sucks. If they do a scan, at least use the radio that's not in use so it doesn't affect the one communicating (e.g. use 2.4 Ghz when you're connected on 5).. That would be a good way to avoid this latency hit.
Also, I'm assuming Maps only does this when it's open, but Apple's annoying tendency to keep an app running when you close the last window (with the exception of system preferences and a few others) makes this very hard to diagnose. While I still used Macs a lot I would always close apps with Command-Q for that reason. This behaviour would exacerbate the problem as the user isn't aware that the app is stil running.
Apple's reasoning is I believe to "not worry about open apps, the OS will handle it". But it doesn't always, I often get prompts that my memory is full and I have to close something now or else... And that is with me being rigorous closing apps. My work buys only base level machines with standard ram, unfortunately.
> Apple's annoying tendency to keep an app running when you close the last window
This is…just how macOS works. Windows applications (generally) tie their lifecycle to the existence of a window, but Macs have a different paradigm: the program can live without any windows. Pretty much every Mac app behaves this way. It’s been this way as long as I can remember.
iOS is different; you can force close an app with the app switcher, but the OS generally encourages you to leave things “open” and the OS will periodically wake your process so it can perform various tasks. The OS is very stingy about how much work your process can do when it’s in the background in this way. This is one of the challenges when developing for iOS, for sure.
But yes I know it's just how macOS works. I never really got used to it except that it ingrained "Command-Q" into my muscle memory :) I agree it makes sense for some apps. For example for mail, which will continue receiving in the background and notify you. But not for Maps. This is an app that isn't useful when its window is not open.
But I mean this uniqueness to macOS is causing this to cause unintended side-effects. While working in Apple Maps, I imagine the user would not care so much about latency issues and the location tracking would be useful. By the app shouldn't do it while it's not actively being used IMO, as long as there is no way to avoid the latency.
I wonder if the same happens with Apple's own FaceTime by the way, or if they made an exception for that :)
Yeah, I think OP is right that this behavior is confusing for Windows users, but as a longtime macOS user I don't find it confusing or problematic at all.
The frequencies are different enough for it to be possible technically. The same way mobile phones can be active on multiple bands at the same time. But indeed the used chipset may not support it.
It's something I would expect Apple to have taken advantage of though, as they own both the hardware and the software.
> Ok that sucks. If they do a scan, at least use the radio that's not in use so it doesn't affect the one communicating (e.g. use 2.4 Ghz when you're connected on 5).. That would be a good way to avoid this latency hit.
Is this possible? Or is AP scanning perhaps always over 2.4?
Is this the "weird WiFi latency on Mac OS" thread? I've got a WiFi network with a MacBook Pro (running 11.6 because I hate upgrading) and a System76 linux box (as well as lots of other devices). Both of the machines can ping a google dot com server (which is approximately 150 miles away, going by the hostname) consistently in the 8-12 ms range.
Pinging the System76 box from the laptop, the latency varies from 2-250(!) ms. Pinging the laptop from the System76 box varies from 2-125ms.
I don't even know where to start debugging that but the latency is driving me crazy.
So I've tried this and cannot reproduce anything like it. Yes, when I tell Macos to scan for network, there is a short latency spike, as can be expected. But _only_ when I open up the networks menu.
I have maps open, refresh my location etc. Nothing at all. So there must be some other factors at play. Given the authors wireless woes that I've never had trouble with, I feel like they might just be living in a bunch of farayday cages ;)
Please read the article you are commenting on. In it, they identify the cause and lay out a solution. The solution is not to botch your macbook by disabling core components as AWDL (disabling it will break airplay, handoff and other).
Not sure why you assumed I did not read the article. Anyway I just wanted to point out that this has been and still is an issue recognized by Google Stadia and others.
Other anecdote: I have a thinkpad L450, and randomly during the day, the wifi firmware just "crashes" and disable itself, and needs to be reset via the "troubleshoot" dialog in windows 10.
It's quite annoying, and I can't really think of why it happens.
The latency is also massively better -- I surgically implanted an "ancient" ath9k into my laptop and 5ghz wifi latencies dropped 6x compared to the "modern" broadcom chip on the laptop's motherboard. Still getting 300mbit/sec.
All it cost me was the left speaker, removed to make space for the superior wifi card with open-source firmware.
As a means to keeping this feature on when out in public, but not have it cause latency spikes at home, is it possible to configure the router to block these requests from location services? Or do we need to setup each device to automatically disable location services when on the house wifi?
Wifi positioning does not actively talk to the network you‘re connected to, but rather does a beacon frame sweep and then matches BSSIDs seen with some database.
One side effect of this is that in order to scan all possible wifi channels, your baseband needs to tune to different frequencies at least for a short period of time.
Theoretically this interval should be short enough to avoid any disruptions – practically that‘s apparently not always the case.
It's not just Apple Maps either! Even with location services disabled, try opening AirDrop (even on another device you own) while running a ping and you'll see your en0 device's latency spike, while Apple tries to divide traffic between awdl0 and en0.
I see system_profiler doing a scan when I gather the logs. Is that just the logger itself doing something, and if not is there a way to find what it invoking system_profiler?
I’ve seen this sporadically. A reboot clears it for me. I probably spent a good hour trying to figure out if it was my ISP or router. Improve your QA Apple
lol. i wonder if it's quietly popping the nic out of the associated state, quickly scanning for aps and then jumping back where it left off without telling userland or the remote ap that anything happened...
Background scanning is a normal WiFi feature, you don't break association state when doing this. It is required for regular and fast roaming.
Also it must be notifying userland it happened because location services is trying to gather that info.
Most WiFi clients enable background scanning when signal strength is below some threshold, so you would never notice latency spikes unless connection is already poor.
interesting. so they just switch it on even when the signal is strong.
> Most WiFi clients enable background scanning when signal strength is below some threshold, so you would never notice latency spikes unless connection is already poor.
A bit of a clickbait-y tweet. Exact same thing happens with any OS and Wi-Fi device when briefly scanning for surrounding access points. In the case of my setup (2017 MacBook Air running 10.15/Catalina) the penalty seems forgettable - avg. ping jumps from 2 ms to 25 ms during 1.5 seconds, on 802.11n/5GHz with about 20 other 2.4GHz/5GHz access points in my vicinity. My Asus ZenBook running Linux Mint and equipped with Intel Centrino Wi-Fi suffers a lot more from the same procedure.
Why would someone program an OS to do this when it's already connected to an access point? This is like me eating a sandwich and stopping mid-chew every minute to check the fridge.
Reason one is that one doesn’t generally connect to an access point (BSSID), but rather to a an SSID. That SSID may have many access points, as the device may roam. Periodic scans check to see if another access point for the same SSID is now a better choice, and switch accordingly. On Linux, configuring the connection to a specific BSSID generally disables periodic scans.
Reason two is to determine location from WiFi network data. Location may not be static even if connected to a single network, since that network may cover a large area and be roam-able, or be moving (hotspot, train, etc.).
Because on devices with only WIFI the only way to give you 'GPS' like data is to scan for nearby wifi access points. There are several big databases in the sky that know about a great many Access Points and when your laptop says 'i see these 10 APs with this amount of signal' it can figure out where you are.
It's not really forgettable if any app can request a scan at any time – collect wireless logs, then start the Maps app, you will see repeated scans. Locationd doing this ever so often might be acceptable, but not when any app can do this, repeatedly.
Also, 25 milliseconds is about a round trip across half the continental US. Not really sure that's a good tradeoff for devices that are mostly stationary.
A 750-1000 ms increase would be disturbing, but a 20 ms round trip increase for a brief two seconds is entirely forgettable. It's nothing. It (and more) happens all the time between you and practically any destination out on the Internet as part of normal traffic/congestion patterns.
You got downvotes for being wrong about the issue being real. You get credit for attempting a test but your personal test failed. Oh well. A few downvotes in that case are normal and fine.
I just can't replicate it, and another user ( leodriesch ) pointed out they may be a few versions behind. That's not something I can replicate right now.
I noticed this too when I used steam to stream a game to my laptop over good wifi. Every minute it would stutter for a second. I set up iperf3 tests and noticed the wifi lag increasing every minute between my macbook and my server and between my windows desktop pc and my server (when connected over wifi). Of course no lag when using cables, so I reasoned it was wifi related, and had noting to do with my setup (I used different clients, and different AP's). I then took my macbook (only portable computer I had) it too a nearby coffee shop with good wifi and I could still measure lag spikes every minute. So then I was really puzzled, was there some rogue device interfering with wifi all over the neighborhood? Finally I found a suggestion to turn off location services (or whatever it is called), and the spikes disappeared. And I learnt that even when it is not used (not sure it the lid was closed) a macbook can cause significant interference to the wifi for all other nearby devices.
> And I learnt that even when it is not used (not sure it the lid was closed) a macbook can cause significant interference to the wifi for all other nearby devices.
My partner has an older MBP, I noticed this the last time she was forced to updated her OS a major version... the thing no longer sleeps when you tell it to or when you close the lid, it will stay connected to wifi and quite happily saturate the network downloading updates.
Only way to be sure is to power off the stupid thing.
My understanding is this is an issue with new features of all sorts of laptop/desktop devices.
For example, https://news.ycombinator.com/item?id=28639952
"Do not leave XPS laptop in any sleep/hibernate/standby mode when placed in a bag" because they stay connected to wifi and may attempt to run updates etc when the user is not expecting or prepared for that, as far as cooling.
22 replies →
Yesterday my home DNS weren't resolving and noticed on PiHole that there were >30,000 requests of *.in-addr.arpa (Reverse DNS Lookup) from the iPhone+iPad of the guest to whom I gave the WiFi access and was saturating the Pi's CPU. I re-enabled rate limiting on PiHole and blocked the request with a filter.
A cursory search on the issue says Bonjour is the culprit, I'm forwarding DNS requests to my PiHole instances on my gateway and latest iOS doesn't seem to like it; I haven't faced such issue earlier and I have this setup for several years now.
https://support.apple.com/guide/mac-help/turn-power-nap-on-o...
3 replies →
For extra fun, if while it's sleeping it's connected to a Display Port or USB-C display, it'll wake it up everytime it wakes the wifi for its 'power naps'. Disabling them in System Prefs doesn't change this.
People doing game streaming might be interested in this bug in the moonlight-qt repo that discusses people having this same problem, including various fixes: https://github.com/moonlight-stream/moonlight-qt/issues/159
Can confirm that the scripts posted itt by vJan00 [0] solved the stuttering problems that were plaguing me 4-5 months ago. Didn't bother setting up a cronjob; I just toggle it on/off as needed.
[0] https://github.com/moonlight-stream/moonlight-qt/issues/159#...
Wow, I guess this is also why my local steam streaming (well, I use Moonlight but same difference) started lagging out of nowhere. I first noticed it 2 days ago, but before that I clocked 30 hours no problem, so I guess this is a brand new problem.
Gonna try turning off all my Mac devices location services, thanks for the tip.
This was a few years ago on a 2015 MBP running Catalina or whatever came before that. My guess is the adaptive bandwidth algorithm acutely switches to a lower bandwidth due to the lag spike, and then slowly recovers in the ten seconds after. And then 50 seconds later it starts over again. I suspect if I could have manually set the streaming quality to a fixed value the lag spike would hardly not be noticable at all, but the constant switching of the stream quality is what actually caused chopiness. Same might be the case with the OP's zoom calls
if you have the wherewithal to use iperf then why not wireshark too? it's probably actively sniffing surrounding wifi frames to feed back to its proprietary version of WiGLE.net under the guise of super helpful "location based services"
This is normal across all wifi clients; they can't scan for networks and transfer data simultaneously so there will always be increased latency during that event. You can test this yourself by doing a low-interval ping and clicking the wifi icon to show you nearby networks - you'll notice a brief latency spike.
I agree that it's not a good default to have an app doing this, though.
This may not always be the case, fortunately! I recall the Broadcom Wi-Fi 7 chipset announcement[0] in April mentioned a dedicated scan core which may well offload the network searches to a separate part of the chip, freeing the AP connectivity core(s) from having to do other tasks for a second or two each minute.
Here's hoping it works as I understand it and other chipsets start doing similar things!
[0] https://news.ycombinator.com/item?id=31060452
Supporting 802.11g means scans are send at 1Mbit. 802.11a bumps it to 6Mb/s, so not much better. This means that every time you want to send a beacon you have a pause equal to the duration it takes to send a packed at 1-6Mbit, not to mention scanning all the channels.
To do passive scanning you need to "be quiet" for sufficiently long to pick up beacons from other stations, so that is unlikely to help.
1 reply →
Surely you can’t use the same antennae for two different operations at the same time…
The noise would be unsalvageable and you would lose packets, surely.
2 replies →
Solution for Windows (replace interface name as needed):
Caveat: you need to turn this back on if you need to re-connect or scan networks.
Still have two .bat scripts (on/off) on my desktop from a time when I only had wifi. And it still baffles me that such measures can be necessary.
1 reply →
Is there a way to configure Windows to only scan for networks when it isn't connected to one?
1 reply →
Thank you, this solved a problem I was having with Citrix Workspace. Every ten seconds I would get a ping spike. It reliably destroyed video calls and made typing in the workplace a pain.
My old Mac does not have this problem. Makes no sense to me that Windows allows any random program to trigger wifi scans. It’s a performance issue and privacy issue too.
If you have an Intel WiFi card, there's a driver setting "Global BG Scan Blocking" to never scan if you already have a good signal. Works great
1 reply →
It’s good to know. I suppose the unintuitive part is that “location” means “Wi-Fi scan”. Makes sense for a laptop when you think about it but I wouldn’t have thought of this as the first thing to check.
It's kind of a weird situation we're in with this. Facebook and Google track your location by default and you can go back and look where you've been on a map. I used it to figure out the details of an automated traffic ticket I got on a trip to Europe a couple of years back, so it's not totally useless from a consumer perspective, but it's still creepy. So you opt out, but "location services" keeps tracking you and sending your location data (as represented by the SSIDs and signal strength around you) but not telling you you're being tracked. So you opt out of that, and all the sudden you're subject to a bunch of dark patterns insisting you need to enable it again, even though it's perfectly capable of just using the GPS and keeping everything on the client. I'm glad my life isn't interesting enough for it to matter, I guess.
> the unintuitive part is that “location” means “Wi-Fi scan”
I was under the impression that this has been SOP for mobile device location forever: get rough location via WiFi and/or tower multilateration while GPS is...I don't know the proper terminology here, bootstrapping? That's why your dot tends to start somewhere nearby-ish and then quicky jump to your exact location.
It's possible that I'm way off base or my understanding is outdated, though.
3 replies →
But if the laptop is currently connected to a WiFi network with a known location, what's the point of scanning for networks to locate it? You already know that you're within range of a known spot.
Roaming. Although a desktop might not usually be moving while it's on, a laptop user might move around the house, conference room, or lecture hall, and switching APs could result in a stronger signal. It's better to switch before your signal gets weak/drops to minimize disruptions during BSS transitions.
On an unrelated note, in my experience Apple devices are consistently the most frustrating devices when it comes to wifi. They are insanely picky about what networks they will connect to, and they are never consistent.
„Within range of one network“ doesn‘t give you as much information as „all these networks are visible and here‘s how strong they look from where you are“
5 replies →
What helped me was not using a hidden SSID. Apparently, with hidden networks, the computer has to actively probe for the network, but passive probes don't affect latency as much.
Passive scans would be possible.
I'm on Wi-Fi on my MacBook (Pro 16" 2021). I opened Maps.app (which gets my location correctly), started pinging my router, it's been a few minutes...
No spike. It must be occuring at some corner case, not for everyone.
It happens to me when using Ubiquiti UniFi access points, but not as much with other brands of APs. In fact, certain models of UI APs seem to be more problematic when used with newer Macs.
I could not replicate after several minutes with the maps app open on my M1 MacBook Pro.
I did find the Last.FM app seeming to request scans though?!
Try pinging your router every .1 seconds.
I discovered this exact problem over lock down 2020. My Teams calls would freeze every 60s.
There's a better solution though! Delete all your saved wifi connections. All those hotels and coffee shops you have connected to in your apple lifetime are the trigger. Reduce them down to those you actually use and the problem goes away.
I'm amazed more people haven't come across this, though from what I've seen people tend to just live with these problems as they don't know where to start in figuring it out.
On Windows, there was an infamous Qt bug that also caused regular ping spike, so check it out if you have the issue and you also happen to be using a Qt program:
https://bugreports.qt.io/plugins/servlet/mobile#issue/QTBUG-...
I wonder why they keep rescanning the wifi environment even though the fact that it remains connected to the same BSSID and the RSSI doesn’t fluctuate too much should suggest that it’s very unlikely the device moved far enough to warrant another scan.
My anecdotal experience (partially informed by working on the Windows Wi-Fi team) is that iOS/macOS are more aggressive about switching APs. It's a tradeoff - on one hand, you can have disruptive scans like this, but on the other, if it results in switching to a better network during a long period when the user is stationary, it can result in a better experience.
It also depends a lot on what your hardware is, whether you're doing a full scan or a partial scan, whether you have more than one NIC etc, etc.
"better experience" only if you aren't doing something latency-sensitive, like a video call.
2 replies →
Maybe it wasn’t a problem worth fixing at the time? Maybe they’ll do exactly this in future versions of the location finder stack.
Edit: somebody pointed out that these scans could be for roaming purposes as well. Maybe there is another access point with a better signal and it’s time to move?
You're forgetting how sensitive this location detection is, these days. Let's say you are moving in a direction roughly parallel to the circle carved out by a given signal strength. You could move quite a long ways without RSSI fluctuating much.
portable wifi? edge case, but its possible this was the fix for it
I imagine they have to handle the scenario where you're connected to a mobile access point and can't assume that 0 movement means you're in the same physical location. Watching other APs is going to provide a better picture.
What's the newest Wifi standard? ax? Anyway: it's quite... something? My standard router runs four different networks on two different IDs and if I understand it correctly, the fasted frequencies are subject to occasional use by... my local Patriot air defense system(?) which it needs to occasionally check for.
> the fasted frequencies are subject to occasional use by... my local Patriot air defense system(?)
I think you're you're talking about Radar detection?
My apartment is on the approach-path for one runway of a major airport - I regularly get reports of Radar detection on my Unifi APs when planes are landing in this direction.
locationd probably wasn't tracking that state. Maybe now it is.
it's checking for nearby devices so it can upload them to "help" location accuracy
I just tried this myself and can't replicate on a 2019 i7 running Big Sur. I wonder if it's related to the number of Wifi networks in range (mine is the only one)... Also, the Apple Maps thing didn't seem to change anything for me, either.
Environment can have huge impact on this. With a larger number of devices, there could be more collisions, increasing traffic more than linearly, and then in case of scanning traffic, the modulation used would likely be the lowest available which means the packets take up a lot of wall clock time. So a broadcast storm with collisions, retries, at the lowest bitrate = brief outage.
How many saved wireless networks do you have?
I like that the first reply is to switch from zoom to google meet. Very helpful.
But no one said "you should rewrite it in Rust" yet.
I reckon that'd be because it isn't relevant to the topic at all. I'd say most things that advertise written in Rust is because it's a valid upside, not all but definitely most.
I noticed this when using a meeting/streaming tool that detected these bits of latency and went in to a degraded mode, even with abundant bandwidth available.
I tried the various settings for avoiding it, discussed in many other comments here. The only thing that worked for me: get out a USB ethernet adapter and a long wire, don't use WiFi when doing things where it matters.
... which is ridiculous; I don't want or need location scans at all, I am sitting stationary in my home office.
Location services in general seem to cause latency spikes for me. I just disabled the feature altogether
I cannot replicate this on my M1 MBP running 12.3.1.
This happens on my M1 Macbook Air running 12.0.1 and is extremely evident when playing games on Stadia, unless location services is disabled.
Why are you still running 12.0.1?
Same. Not able to replicate on M1 MBA
Aren’t modern Wifi chips capable of holding two simultaneous connections (one for wifi, one for wifi-direct/Airdrop)?
Same. Have been trying for minutes with the same software running and on Wi-Fi. All pings around 4ms with no spikes at all.
Ok that sucks. If they do a scan, at least use the radio that's not in use so it doesn't affect the one communicating (e.g. use 2.4 Ghz when you're connected on 5).. That would be a good way to avoid this latency hit.
Also, I'm assuming Maps only does this when it's open, but Apple's annoying tendency to keep an app running when you close the last window (with the exception of system preferences and a few others) makes this very hard to diagnose. While I still used Macs a lot I would always close apps with Command-Q for that reason. This behaviour would exacerbate the problem as the user isn't aware that the app is stil running.
Apple's reasoning is I believe to "not worry about open apps, the OS will handle it". But it doesn't always, I often get prompts that my memory is full and I have to close something now or else... And that is with me being rigorous closing apps. My work buys only base level machines with standard ram, unfortunately.
> Apple's annoying tendency to keep an app running when you close the last window
This is…just how macOS works. Windows applications (generally) tie their lifecycle to the existence of a window, but Macs have a different paradigm: the program can live without any windows. Pretty much every Mac app behaves this way. It’s been this way as long as I can remember.
iOS is different; you can force close an app with the app switcher, but the OS generally encourages you to leave things “open” and the OS will periodically wake your process so it can perform various tasks. The OS is very stingy about how much work your process can do when it’s in the background in this way. This is one of the challenges when developing for iOS, for sure.
Not just Windows though. *nix also.
But yes I know it's just how macOS works. I never really got used to it except that it ingrained "Command-Q" into my muscle memory :) I agree it makes sense for some apps. For example for mail, which will continue receiving in the background and notify you. But not for Maps. This is an app that isn't useful when its window is not open.
But I mean this uniqueness to macOS is causing this to cause unintended side-effects. While working in Apple Maps, I imagine the user would not care so much about latency issues and the location tracking would be useful. By the app shouldn't do it while it's not actively being used IMO, as long as there is no way to avoid the latency.
I wonder if the same happens with Apple's own FaceTime by the way, or if they made an exception for that :)
Yeah, I think OP is right that this behavior is confusing for Windows users, but as a longtime macOS user I don't find it confusing or problematic at all.
5 replies →
Often the antenna is shared - its a relatively large physical thing. And it can't really be shared except time-shared I believe.
The frequencies are different enough for it to be possible technically. The same way mobile phones can be active on multiple bands at the same time. But indeed the used chipset may not support it.
It's something I would expect Apple to have taken advantage of though, as they own both the hardware and the software.
> Ok that sucks. If they do a scan, at least use the radio that's not in use so it doesn't affect the one communicating (e.g. use 2.4 Ghz when you're connected on 5).. That would be a good way to avoid this latency hit.
Is this possible? Or is AP scanning perhaps always over 2.4?
Is this the "weird WiFi latency on Mac OS" thread? I've got a WiFi network with a MacBook Pro (running 11.6 because I hate upgrading) and a System76 linux box (as well as lots of other devices). Both of the machines can ping a google dot com server (which is approximately 150 miles away, going by the hostname) consistently in the 8-12 ms range.
Pinging the System76 box from the laptop, the latency varies from 2-250(!) ms. Pinging the laptop from the System76 box varies from 2-125ms.
I don't even know where to start debugging that but the latency is driving me crazy.
So I've tried this and cannot reproduce anything like it. Yes, when I tell Macos to scan for network, there is a short latency spike, as can be expected. But _only_ when I open up the networks menu.
I have maps open, refresh my location etc. Nothing at all. So there must be some other factors at play. Given the authors wireless woes that I've never had trouble with, I feel like they might just be living in a bunch of farayday cages ;)
it's location services, not apple maps.
This has been an issue for at least over a year.
Turn off location services and disable the awdl0 interface is the only way (for me) to run lag free zoom calls over wifi with a mac.
https://support.google.com/stadia/answer/9595943?hl=en#zippy...
Please read the article you are commenting on. In it, they identify the cause and lay out a solution. The solution is not to botch your macbook by disabling core components as AWDL (disabling it will break airplay, handoff and other).
Not sure why you assumed I did not read the article. Anyway I just wanted to point out that this has been and still is an issue recognized by Google Stadia and others.
Moonlight project issue discussed in the thread are also recommending to disable awdl to mitigate the issue https://github.com/moonlight-stream/moonlight-qt/issues/159
I never ment to step on any toes, just wanted to raise possible solutions.
Other anecdote: I have a thinkpad L450, and randomly during the day, the wifi firmware just "crashes" and disable itself, and needs to be reset via the "troubleshoot" dialog in windows 10.
It's quite annoying, and I can't really think of why it happens.
I wonder if radio interference might be a cause.
Why do network scans spike latency? Seems like a WiFi firmware bug to me. I wonder if it happens with open source WiFi firmware like ath9k_htc.fw
https://github.com/qca/open-ath9k-htc-firmware
It does not.
The latency is also massively better -- I surgically implanted an "ancient" ath9k into my laptop and 5ghz wifi latencies dropped 6x compared to the "modern" broadcom chip on the laptop's motherboard. Still getting 300mbit/sec.
All it cost me was the left speaker, removed to make space for the superior wifi card with open-source firmware.
Kinda makes you go "hrm."
Which ath9k card did you get?
2 replies →
Wifi chipsets can't scan networks and do regular wifi-y stuff at the same time.
That seems odd, when they can connect to 2 networks at the same time
2 replies →
As a means to keeping this feature on when out in public, but not have it cause latency spikes at home, is it possible to configure the router to block these requests from location services? Or do we need to setup each device to automatically disable location services when on the house wifi?
Wifi positioning does not actively talk to the network you‘re connected to, but rather does a beacon frame sweep and then matches BSSIDs seen with some database.
One side effect of this is that in order to scan all possible wifi channels, your baseband needs to tune to different frequencies at least for a short period of time.
Theoretically this interval should be short enough to avoid any disruptions – practically that‘s apparently not always the case.
Best is to disable location services, which results into multiple disadvantages:
- maps don't show your location, which you would have to live with..
- I recommend F.lux instead of night shift and dark mode: you can manually configure a location in F.lux and let it enable dark mode as well.
- also manually set time zone
It's not just Apple Maps either! Even with location services disabled, try opening AirDrop (even on another device you own) while running a ping and you'll see your en0 device's latency spike, while Apple tries to divide traffic between awdl0 and en0.
I see system_profiler doing a scan when I gather the logs. Is that just the logger itself doing something, and if not is there a way to find what it invoking system_profiler?
I’ve seen this sporadically. A reboot clears it for me. I probably spent a good hour trying to figure out if it was my ISP or router. Improve your QA Apple
Silly question - but does this problem occur only when Maps is running? Or is there a background daemon doing this stuff?
I've never had this problem on my iMac
This have happened since 12.3.1 at the office for me (not at home though). Hope this resolves it.
Great hardware with some crazy choices on top... at least the old intels use 3x antennas
Kids, this is why you should randomize when clients check in if your model allows it.
It's 2022. Apple should just have a separate WiFi radio for location scans.
lol. i wonder if it's quietly popping the nic out of the associated state, quickly scanning for aps and then jumping back where it left off without telling userland or the remote ap that anything happened...
Background scanning is a normal WiFi feature, you don't break association state when doing this. It is required for regular and fast roaming.
Also it must be notifying userland it happened because location services is trying to gather that info.
Most WiFi clients enable background scanning when signal strength is below some threshold, so you would never notice latency spikes unless connection is already poor.
interesting. so they just switch it on even when the signal is strong.
> Most WiFi clients enable background scanning when signal strength is below some threshold, so you would never notice latency spikes unless connection is already poor.
i assume s/unless/because/ ?
That can't be good for the battery life.
The default battery claims have location services turned on.
I don’t think this does anything if maps isn’t running?
3 replies →
I set up automation to prompt me to turn off WiFi when I leave the house.
i became obsessed with mtr. your ping latency and variance is a better indicator of vc quality
Is this why Airplay no longer works? As of MacOS 12.3 when I AirPlay from M1 to AppleTV every ~2 minutes it drops to ~1fps for ~30 seconds.
Look into issues with Dolby Atmos on AppleTV and your soundbar.
A bit of a clickbait-y tweet. Exact same thing happens with any OS and Wi-Fi device when briefly scanning for surrounding access points. In the case of my setup (2017 MacBook Air running 10.15/Catalina) the penalty seems forgettable - avg. ping jumps from 2 ms to 25 ms during 1.5 seconds, on 802.11n/5GHz with about 20 other 2.4GHz/5GHz access points in my vicinity. My Asus ZenBook running Linux Mint and equipped with Intel Centrino Wi-Fi suffers a lot more from the same procedure.
Why would someone program an OS to do this when it's already connected to an access point? This is like me eating a sandwich and stopping mid-chew every minute to check the fridge.
Reason one is that one doesn’t generally connect to an access point (BSSID), but rather to a an SSID. That SSID may have many access points, as the device may roam. Periodic scans check to see if another access point for the same SSID is now a better choice, and switch accordingly. On Linux, configuring the connection to a specific BSSID generally disables periodic scans.
Reason two is to determine location from WiFi network data. Location may not be static even if connected to a single network, since that network may cover a large area and be roam-able, or be moving (hotspot, train, etc.).
2 replies →
Because on devices with only WIFI the only way to give you 'GPS' like data is to scan for nearby wifi access points. There are several big databases in the sky that know about a great many Access Points and when your laptop says 'i see these 10 APs with this amount of signal' it can figure out where you are.
It's not really forgettable if any app can request a scan at any time – collect wireless logs, then start the Maps app, you will see repeated scans. Locationd doing this ever so often might be acceptable, but not when any app can do this, repeatedly.
Also, 25 milliseconds is about a round trip across half the continental US. Not really sure that's a good tradeoff for devices that are mostly stationary.
A 750-1000 ms increase would be disturbing, but a 20 ms round trip increase for a brief two seconds is entirely forgettable. It's nothing. It (and more) happens all the time between you and practically any destination out on the Internet as part of normal traffic/congestion patterns.
I cannot replicate this, I believe the twitter use got hooked on a red herring here. To be fair anything anti-apple is a quick way to get clicks.
I've seen this myself, turning off location services solved the issue for me.
It's definitely there and happening.
Seconded, this is definitely a thing.
1 reply →
The screenshots are from a version before the Big Sur visual refresh, so at least 2 major versions behind the current release.
Could just be a bug that has been fixed already.
I saw infrequent scans from locationd, every few minutes. Until I opened the Maps app, that is. Then it started triggering frequent scans.
Sure, Maps may want to know your location, but it should not have the ability to constantly poll wifi.
Also, different chipsets may display different behavior. Older wifi chipsets may have more trouble with this.
I did not realize this / check this. I had made the assumption of latest macOS and-what-have-you.
I however, cannot setup that environment right now.
Downvotes because another user disagreed with a tweet after they made a fair attempt to reproduce the issue? That's not the spirit of HN.
You got downvotes for being wrong about the issue being real. You get credit for attempting a test but your personal test failed. Oh well. A few downvotes in that case are normal and fine.
Don't play dumb, you're receiving downvotes because you implied OP was lying:
> To be fair anything anti-apple is a quick way to get clicks.
Anything apple (both ways) is a good way to get clicks on hackernews at least.
This is also true!
I just can't replicate it, and another user ( leodriesch ) pointed out they may be a few versions behind. That's not something I can replicate right now.
It's a lot better than it used to be, when every Daring Fireball entry stayed on the front page for days.