Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

High Telemetry Data Usage #11979

Closed
bgreenlee opened this issue May 22, 2018 · 11 comments
Closed

High Telemetry Data Usage #11979

bgreenlee opened this issue May 22, 2018 · 11 comments
Labels
high priority iOS Mapbox Maps SDK for iOS telemetry Integration with Mapbox Telemetry libraries

Comments

@bgreenlee
Copy link

bgreenlee commented May 22, 2018

We have an iOS app that tracks location continually, in the background, in a resource-efficient way (using Significant Location Change monitoring). We noticed that Time & Location data usage (Cellular -> System Services -> Time & Location) is very high when Mapbox Metrics (Telemetry) is enabled—generally around 30 MB/day. If we disable it, Time & Location data usage is around 0.5 MB/day.

Platform: iOS
Mapbox SDK version: 4.0.1

Steps to trigger behavior

  1. Launch app. Mapbox Metrics is enabled by default.
  2. Check your Time & Location data usage.
  3. Travel a few miles while on a cellular network, with the app backgrounded.
  4. Check your Time & Location data usage again.

Expected behavior

Time & Location data usage should be minimal (< 1 MB/day)

Actual behavior

Time & Location data usage is significantly higher (~30 MB/day)

@jmkiley jmkiley added iOS Mapbox Maps SDK for iOS telemetry Integration with Mapbox Telemetry libraries labels May 22, 2018
@friedbunny
Copy link
Contributor

/cc @rclee

@rclee
Copy link
Contributor

rclee commented Jul 18, 2018

Hi @bgreenlee

I apologize for the late response here. We're currently investigating the issue and adding more robust logging around these potential problem areas. During your testing, was this on a device with any other applications using location services?

I'll let you know as soon as we have more information. Thank you for your patience.

@NelsonMinar
Copy link

Hi, I work with Brad and did a bunch of testing for this issue. I can confirm it happens with a device running nothing else using location services. I set up a iPhone with a brand new OS install and turned off everything I could except for what was necessary to run our app which includes Mapbox Metrics.

The data usage seems most significant when the phone is in motion. It's consistent with something asking for location with high frequency and then iOS requiring some cellular data to resolve location, probably related to cell tower or wifi geolocation.

@stale stale bot added the archived Archived because of inactivity label Jan 26, 2019
@stale
Copy link

stale bot commented Jan 27, 2019

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

@stale stale bot closed this as completed Jan 27, 2019
@NelsonMinar
Copy link

From "apologize for the late response" to a high priority tag to auto-archived. Hopefully someone on the team can look at the data usage imposed by Mapbox Metrics some day.

@tmpsantos tmpsantos reopened this Jan 27, 2019
@stale stale bot removed the archived Archived because of inactivity label Jan 27, 2019
@andrlee
Copy link
Contributor

andrlee commented Jan 29, 2019

The data usage seems most significant when the phone is in motion. It's consistent with something asking for location with high frequency and then iOS requiring some cellular data to resolve location, probably related to cell tower or wifi geolocation.

@NelsonMinar given that we're using combination of region monitoring and location manager apis for location traces collection both in foreground and background mode (you can dig into specifics of this logic here: https://github.com/mapbox/mapbox-events-ios). It is expected that location system service is pre-fetching location data tiles more aggressively at higher speeds to be able to calculate location estimates in a reasonable time. I'm trying to understand your expectations on background location data usage (given that user granted Always access to location to Etsy app)?

@NelsonMinar
Copy link

Thanks for the answer. I realize now we've never explained what our app does. It's a passive location tracker. It runs in the background listening for Significant Location Changes from iOS. When the user moves it records their locations to an internal database for occasional uploading to iCloud. It's a very passive app and we're not using any Mapbox APIs at all in background mode. We do have a foreground app mode which displays a Mapbox map, but our users seldom use it, maybe once a month.

Our expectation is running our app in the background should use ~1MB / day for location tracking. That's what we observe with Mapbox Metrics turned off. But if we turn Metrics on the phone starts using 100MB/day or more, even when the app is entirely in the background (no map on display). As we noted above the usage is attributed to "Time & Location services", not our app itself, but it appears that Mapbox Metrics induces iOS to download a lot of data.

I appreciate your explanation about location data tiles. That makes sense if the map were being displayed. But in background mode we're not displaying anything and have no use for Mapbox location data tiles. Are they being fetched anyway? Given the data usage is attributed to Time & Location services rather than our app, I'm a little skeptical.

My own guess is iOS location monitoring uses a fair amount of data when it's turned on aggressively (ie, sampling movements once a second.) Cellular and WiFi positioning are the primary methods iOS uses for location and both of those require data. My guess is Mapbox Metrics is asking for locations very frequently and that results in iOS using a lot of data. But I haven't read your code to be sure, nor do I have access to Apple internals.

@andrlee
Copy link
Contributor

andrlee commented Jan 29, 2019

@NelsonMinar thanks sharing more context about how Etsy app works - this is very helpful. I'm not sure whether the terms of service explicitly states that all Mapbox SDKs are collecting telemetry data (https://www.mapbox.com/telemetry/) but we do that irrespectively of whether user sees map view or not (given that user has granted permissions the app to access location in background).

But in background mode we're not displaying anything and have no use for Mapbox location data tiles. Are they being fetched anyway? Given the data usage is attributed to Time & Location services rather than our app, I'm a little skeptical.

I was not referring to Mapbox map data tiles in this context, but iOS Core Location Service, which is the system service that's responsible for geolocation on the device, including network location, which requires data in order to provide location estimates.

My own guess is iOS location monitoring uses a fair amount of data when it's turned on aggressively (ie, sampling movements once a second.) Cellular and WiFi positioning are the primary methods iOS uses for location and both of those require data. My guess is Mapbox Metrics is asking for locations very frequently and that results in iOS using a lot of data. But I haven't read your code to be sure, nor do I have access to Apple internals.

Your guess is correct and we do explicitly request location updates for a short period of time in background when a geofence area, that we set, is exited. You can dig into implementation details here: https://github.com/mapbox/mapbox-events-ios (let me know if you want to hop on a call to have a quick chat about it). Now i don't see anything unexpected in this behavior from the technical point of view, imho it's a product discussion (cc: @benlevin47, who's telemetry PM at Mapbox). Please let me know if this is helpful.

@andrlee
Copy link
Contributor

andrlee commented Mar 6, 2019

@NelsonMinar any feedback on your end? what should be our next steps?

@NelsonMinar
Copy link

Thank you for the followup and my apologies for the slow reply.

You are correct that this is a product discussion, not a code bug. From my look through MMELocationManager.m it appears that every time an app gets a location update, the Mapbox telemetry code calls startMonitoringForRegion and asks for frequent location updates, something like updates every 5 meters for 5 minutes.

This behavior is just a mismatch for what our app does. Our app is running location tracking 24/7 but in as low impact a way as possible, using only significant location changes and doing basically no work on location changes except making a record. The app is never even in the foreground in normal usage, it's designed to be left running in the background and forgotten. We started looking at the MapBox code because the app was mysteriously using a lot of data. We now understand that it's Mapbox Metrics doing that, and why.

My product suggest is to document the telemetry behavior in more detail at https://www.mapbox.com/telemetry/ or wherever you think is appropriate. Specifically that you closely track the user's location for a few minutes whenever the app gets a location update and that tracking can use more bandwidth as the phone is updating the user's position.

If other MapBox users have a similar complaint, you might want to consider adding a second "lower impact" telemetry mode that works entirely passively. Never making any extra requests, but just recording the data that comes in. That would be a better match for our background use case.

(PS: one misunderstanding, this app has nothing to do with Etsy. It's a private project. We only have a small handful of users and aren't a paying MapBox customer, so feel free to close this out if you have higher priorities.)

@andrlee
Copy link
Contributor

andrlee commented Mar 11, 2019

@NelsonMinar thanks for your feedback, i've captured your recommendations:

My product suggest is to document the telemetry behavior in more detail at https://www.mapbox.com/telemetry/ or wherever you think is appropriate. Specifically that you closely track the user's location for a few minutes whenever the app gets a location update and that tracking can use more bandwidth as the phone is updating the user's position.

and

If other MapBox users have a similar complaint, you might want to consider adding a second "lower impact" telemetry mode that works entirely passively. Never making any extra requests, but just recording the data that comes in. That would be a better match for our background use case.

in our internal tickets and will include them into our roadmap discussions.

@chloekraw can we close the ticket for now?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
high priority iOS Mapbox Maps SDK for iOS telemetry Integration with Mapbox Telemetry libraries
Projects
None yet
Development

No branches or pull requests

9 participants