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

[core] Improve tile cache sizing calculation - #7739

Merged
brunoabinader merged 2 commits into
masterfrom
brunoabinader-cachesize
Jan 26, 2017
Merged

brunoabinader merged 2 commits into
masterfrom
brunoabinader-cachesize

Conversation

@brunoabinader

Copy link
Copy Markdown
Contributor

TileCacheStrategy can now be passed on Map ctor as a hint for the style sources about their cache strategy:

  • NoCache: Do not retain tiles.
  • ConservativeCache: Retain visible tiles from all zoom levels.
  • DoubleCache: Twice as conservative.

This is also combined with updating the cache size whenever the transform dimensions or zoom range changes.

@brunoabinader brunoabinader added the Core The cross-platform C++ core, aka mbgl label Jan 16, 2017
@mention-bot

Copy link
Copy Markdown

@brunoabinader, thanks for your PR! By analyzing this pull request, we identified @jfirebaugh, @1ec5 and @incanus to be potential reviewers.

@brunoabinader
brunoabinader force-pushed the brunoabinader-cachesize branch from eac8b8e to 05f64cf Compare January 16, 2017 15:47
Comment thread include/mbgl/map/mode.hpp Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agressive?

@mb12

mb12 commented Jan 16, 2017

Copy link
Copy Markdown

Does 'NoCache' also disable disk cache (sqlite)?

@tmpsantos

Copy link
Copy Markdown
Contributor

Does 'NoCache' also disable disk cache (sqlite)?

Semantics need to be clarified. But this is not the disk cache, it is the memory cache of parsed tiles.

@brunoabinader
brunoabinader force-pushed the brunoabinader-cachesize branch from 05f64cf to 7bbaf51 Compare January 17, 2017 09:50
Comment thread include/mbgl/map/mode.hpp Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add Memory to the name of this enum

Comment thread src/mbgl/style/source_impl.cpp Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this optimization is worth it

Comment thread src/mbgl/style/source_impl.cpp Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The caching strategy can't change, since it's only ever set in the constructor. It shouldn't be part of the UpdateParameters.

@jfirebaugh

jfirebaugh commented Jan 17, 2017 •

Copy link
Copy Markdown
Contributor

Does this actually need to be configurable? I think 48dac2e and fc4f56d may be sufficient.

@kkaefer

kkaefer commented Jan 17, 2017

Copy link
Copy Markdown
Member

Like @jfirebaugh I doubt that this is something we'll have to configure. Instead, we could also make the cache size dependent on currently available RAM: if there's space free, we can cache as much as we want, but if there isn't, evicting items and the short reload delay are preferable to the App hitting OOM.

@brunoabinader

Copy link
Copy Markdown
Contributor Author

Does this actually need to be configurable? I think 48dac2e and fc4f56d may be sufficient.

Thanks for the feedback @jfirebaugh and @kkaefer - the only downside I see is that with fc4f56d the cache size gets recalculated on every Source::Impl::updateTiles for non-annotation sources - however I don't see any immediate perf impact by doing that.

I'll cherry-pick these and update this PR accordingly.

@brunoabinader
brunoabinader force-pushed the brunoabinader-cachesize branch from 7bbaf51 to b8fb71f Compare January 18, 2017 15:48
@jfirebaugh jfirebaugh changed the title [core] Introduce TileCacheStrategy enum [core] Improve tile cache sizing calculation Jan 25, 2017
@jfirebaugh

Copy link
Copy Markdown
Contributor

@kkaefer Can you re-review? 🙇

@brunoabinader
brunoabinader dismissed kkaefer’s stale review January 26, 2017 07:21

Comments on outdated/discarded changes.

@brunoabinader
brunoabinader merged commit 68440ee into master Jan 26, 2017
@brunoabinader
brunoabinader deleted the brunoabinader-cachesize branch January 26, 2017 15:48
@friedbunny friedbunny added the performance Speed, stability, CPU usage, memory usage, or power usage label Feb 13, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Core The cross-platform C++ core, aka mbgl performance Speed, stability, CPU usage, memory usage, or power usage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants