-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Adjusting ambient cache size does not work if the SDK's offline functionality is used #15025
Comments
I was going to start using the new cache apis soon, my plan was that after an offline map download completes, I'd get the total size of all offline maps and then set the cache to be that size +X Mb for the cache. Caching tiles would temporarily be unavailable between a new offline download taking up those X Mb and it finishing, but that is a small window. Maybe the set ambient cache size should do this internally, so rather than setting a hard size limit to the db, you're setting a offline data + cache size Another concern is that offline tiles download from the same url host which interferes with the user engaging with the map (I think you support 20 simultaneous connections to the same host), so if there are 20 offline downloads taking place already, the tiles for where the user is looking waits until they complete. This is further compounded if prefetching is enabled. Maybe using a wildcard when storing the tile's url would solve this and allow active use to download tiles from a.tile-server.com and offline downloads from b.tile-server.com, but they are both stored as *.tile-server.com (with reads to db updated to support it) |
The 20 connection limit isn't per host name (Mapbox GL Native doesn't suffer from the hostname-limits that browsers have), it's a global "concurrent request" limit. |
This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions. |
Addressed by #15622 |
With #14925, we added an api in core that allows developers to adjust the size of the ambient cache, as well as to disable the ambient cache by setting size to 0.
A trap for users is rooted in the fact that our ambient and offline cache are part of the same sqlite database, and the cache management apis for the ambient cache do not block offline downloads. This is fine except in the case where a developer intends to set the size of the ambient cache and allow their users to use the offline cache.
Because mapbox-gl-native shares the same table of tiles between both the ambient and offline cache, and offline downloads can subsume space seemingly allocated to the ambient cache, a developer/end user can unknowingly limit the ambient cache size through their offline map downloads. This has been reported in #4411.
Further, we don't provide a mechanism for developers or end users to know the size in MB that their offline downloads will take up in advance, so there's no real way to set the ambient cache size if you use offline downloads in our current implementation (unless you sideload or give your users a set, immutable offline package).
In sum:
What can we do?
@mapbox/maps-android @mapbox/maps-ios @mapbox/gl-native
The text was updated successfully, but these errors were encountered: