[HN Gopher] Apple Maps location scan spikes WiFi latency every 6... ___________________________________________________________________ Apple Maps location scan spikes WiFi latency every 60 seconds Author : ivank Score : 358 points Date : 2022-05-12 16:56 UTC (6 hours ago) (HTM) web link (twitter.com) (TXT) w3m dump (twitter.com) | alaricus wrote: | That can't be good for the battery life. | nojito wrote: | The default battery claims have location services turned on. | ComputerGuru wrote: | I don't think this does anything if maps isn't running? | urbandw311er wrote: | Interestingly, when I went to Security Preferences there | was an icon to show that Apple Maps had used my location in | the last 24 hours. This is in spite of almost _never_ using | Apple Maps on my MacBook, and certainly not in the last | month. So this smells like some sort of background daemon | or similar. | KennyBlanken wrote: | Hmm. | | Did you hop into a vehicle you have paired with | bluetooth? Apple Maps drops a "parked car" pin | automatically when you do, I think regardless of whether | it was in use at the time. | | Maybe you used an app that uses an Apple Maps view? | | Do you have any of the drive-time/traffic condition | widgets active in the lefthand thingy, or homescreen? | ComputerGuru wrote: | While some platforms go through the Maps app to get the | location, under macOS/iOS there's the locationd daemon | that provides the location independently of any app. | There, Maps is just a locationd consumer just like any | other app requesting a location so Maps _shouldn 't_ be | invoked in the background by non-Maps stuff. But perhaps | Maps has a timed trigger to background update your cached | location (so it can open up to the correct startup | location instead of locating you after startup) or | something similar. | defen wrote: | 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. | rootusrootus wrote: | I cannot replicate this on my M1 MBP running 12.3.1. | can16358p wrote: | Same. Have been trying for minutes with the same software | running and on Wi-Fi. All pings around 4ms with no spikes at | all. | acchow wrote: | 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)? | fragmede wrote: | 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. | diebeforei485 wrote: | Why are you still running 12.0.1? | tda wrote: | 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. | tomxor wrote: | > 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. | code_duck wrote: | 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. | astrange wrote: | https://support.apple.com/guide/mac-help/turn-power-nap- | on-o... | tomxor wrote: | Tried it, didn't work, I also dug out the old pmset command | but it seems to have been neutered. | | I'm glad I stopped using Apple stuff 10 years ago, their | macs are gradually devolving into iDevices. | astrange wrote: | Sleep isn't any different than it used to be. | | "pmset -g assertions" will show you why it thinks it's | awake, it could be a silent video playing in a web | browser or something. (and of course, if you can ssh in | to run that it must be awake.) | hoten wrote: | 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. | [deleted] | tda wrote: | 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 | draebek wrote: | 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 | trafficante wrote: | 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#... | ncann wrote: | 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-... | goodoldneon wrote: | Location services in general seem to cause latency spikes for me. | I just disabled the feature altogether | gernb wrote: | 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. | wintermutestwin wrote: | Look into issues with Dolby Atmos on AppleTV and your soundbar. | robbomacrae wrote: | 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? | lxgr wrote: | 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. | a-dub wrote: | 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... | qwertywert_ wrote: | 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. | a-dub wrote: | 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/ ? | dpcx wrote: | 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. | foobarian wrote: | 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. | Nextgrid wrote: | 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. | tedunangst wrote: | locationd probably wasn't tracking that state. Maybe now it is. | TSiege wrote: | portable wifi? edge case, but its possible this was the fix for | it | Bud wrote: | 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. | Zelizz wrote: | 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. | not2b wrote: | "better experience" only if you aren't doing something | latency-sensitive, like a video call. | Gigachad wrote: | Video calls aren't hyper latency sensitive, there is | already a lot of latency in encoding and processing | effects. I'd imagine this could be most disruptive to video | games but this isn't a market Apple has done much to work | with. | [deleted] | spookthesunset wrote: | 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? | GekkePrutser wrote: | 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. | JoeAltmaier wrote: | Often the antenna is shared - its a relatively large physical | thing. And it can't really be shared except time-shared I | believe. | GekkePrutser wrote: | 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. | cmckn wrote: | > 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. | daveidol wrote: | 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. | GekkePrutser wrote: | I'm more a unix user than a Windows user. I use all OSes | (including Mac and Windows) on a daily basis but FreeBSD is | my daily driver. I think macOS is pretty unique in this | regard (as well as being the only that use Meta-C / Meta-V | for copy/paste, something that still bites me every day as | I switch between OSes :) ). | | But I only used macOS since 10.2, never used classic. | GekkePrutser wrote: | 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 :) | | 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 :) | hamter wrote: | it's location services, not apple maps. | hotfixguru wrote: | This have happened since 12.3.1 at the office for me (not at home | though). Hope this resolves it. | kylecordes wrote: | 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. | daneel_w wrote: | 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. | causi wrote: | 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. | amarshall wrote: | 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.). | spookthesunset wrote: | > 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. | | Maybe I don't fully understand the Wi-Fi "space" but I | gotta wonder why the standard hasn't embraced a CDMA-like | system where your device can just roam around without | really caring which AP is the strongest... the access | points would all communicate with each other to figure out | which one should be responsible for a device. | | It would also fix all the nonsense with picking channels | for each access point. They'd all use the same spectrum. | | But I'm only an armchair observer so who knows... | sleepybrett wrote: | 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. | outworlder wrote: | 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. | herpderperator wrote: | 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. | motrm wrote: | 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 | dijit wrote: | 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. | carlhjerpe wrote: | I mean background scanning only has to be a read operation, | shouldn't that make it simpler? | | Also things these days often have multiple antennas. | | Also for 2.4ghz I believe Bluetooth shares the same | channels. I've noticed that my BT headphones reach longer | in no-wifi/few wifi locations. | GekkePrutser wrote: | On different bands you can with basic filters. On the same | band it would admittedly be tough (unless the band is super | wide like the 6E band). It is done by radio repeaters for | example but they do need big bulky filters, that kind of | thing would not work on a laptop. But it is possible to | transmit and receive on the same antenna at the same time, | it's not a technical limitation. You just need a good | enough filter. | rasz wrote: | 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. | RicoElectrico wrote: | Solution for Windows (replace interface name as needed): | netsh wlan set autoconfig enabled=no interface="Wireless | Network Connection" | | Caveat: you need to turn this back on if you need to re-connect | or scan networks. | causi wrote: | Is there a way to configure Windows to only scan for networks | when it isn't connected to one? | wnevets wrote: | or change how often it scans | MauranKilom wrote: | 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. | ncann wrote: | I used to have constant ping spike at regular interval and | had to do that bat script thing, which fixed it but it was | really annoying. Eventually I figured out it was because of | a Qt bug in the Qt lib that an application running in the | background is using, and there is a system property to | disable that behavior. | | https://bugreports.qt.io/plugins/servlet/mobile#issue/QTBUG | -... | not2b wrote: | 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. | bschne wrote: | ,,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" | bonestamp2 wrote: | True, but is that precision worth the hit to latency... | especially if you're trying to do a voice and/or video | call? I doubt it's worth the tradeoff most of the time. | lelandfe wrote: | How often are folks in meetings, connected to WiFi, and | opening up the WiFi connections list to hunt for other | networks? | | I'm frankly surprised that the author of these tweets | encountered this at all, much less was so annoyed by it | as to troubleshoot. | not2b wrote: | Not just within range, connected to. Meaning you're close | enough to have a strong signal. If it isn't a strong signal | this can be detected and the system could scan in that | case, looking for a better one. | theptip wrote: | 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. | 13of40 wrote: | 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. | culturestate wrote: | _> 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. | Gigachad wrote: | > I don't know the proper terminology here, bootstrapping? | | There is the term "Time to first fix" Maybe "getting first | fix" could be derived from that. | | Wikipedia lists a set of interesting situations with what | the device is actually doing that causes the delay | https://en.wikipedia.org/wiki/Time_to_first_fix | carlhjerpe wrote: | I'm thinking that my devices could have an offline list of | known WiFi mac-addresses from when it's checked GPS before | and return those for very accurate results without scanning | anything. | urda wrote: | 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. | mhh__ wrote: | Anything apple (both ways) is a good way to get clicks on | hackernews at least. | pessimizer wrote: | It's a lot better than it used to be, when every Daring | Fireball entry stayed on the front page for days. | urda wrote: | 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. | leodriesch wrote: | 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. | outworlder wrote: | 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. | urda wrote: | 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. | ActionHank wrote: | I've seen this myself, turning off location services solved the | issue for me. | | It's definitely there and happening. | chomp wrote: | Seconded, this is definitely a thing. | op00to wrote: | Thirded, my game streaming got way better when I turned off | location services. | can16358p wrote: | 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. | tonymet wrote: | i became obsessed with mtr. your ping latency and variance is a | better indicator of vc quality | tedunangst wrote: | I like that the first reply is to switch from zoom to google | meet. Very helpful. | jedisct1 wrote: | But no one said "you should rewrite it in Rust" yet. | carlhjerpe wrote: | 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. | nvr219 wrote: | I set up automation to prompt me to turn off WiFi when I leave | the house. ___________________________________________________________________ (page generated 2022-05-12 23:00 UTC)