New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Persistent cache 2 #557
Persistent cache 2 #557
Conversation
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Read entire cache dir when initializing a persistent tile cache Obey cache size with persistence enabled Fix potential NPE in FileSystemTileCache#containsKey() with persistence on Compatibility constructors for apps developed for 0.5.0 Use file timestamp to determine age of map file Rename TTL to TimeToLive in all identifiers Comment for default TTL Change Mapnik default TTL to 8279 sec and add comment Signed-off-by: mvglasow <michael -at- vonglasow.com>
Thanks Michael for the report and for keeping the 2nd commit separate (we can check more easily the changes).
|
I am just looking at it now, will comment later. On 20 December 2014 at 11:24, Emux notifications@github.com wrote:
|
|
My thoughts about the pattern have emerged due to mvglasow@e318562#diff-187ae3feaa74b08b44371bbc1c7288bbR397 where the reading of the cache directory takes place and eventually the construction of the keys. Yes the common practice is z/x/y |
In reality, I probably should remove the reference to z/x/y from the comment because the code is agnostic to that. If the cache directory is at At that point it doesn't matter whether the convention is z/x/y or z/y/x or even x/y/z – the code will handle anything gracefully, as long as the path depth is correct (two levels of subdirs from the cache path) and the file has the correct extension. So the following would be rejected:
|
+1 |
I would prefer to be rewritten with a bit more code reuse and not to have logging on dead I am just testing, but I only have another few minutes, so I am sending On 20 December 2014 at 13:41, mvglasow notifications@github.com wrote:
|
Just found an interesting problem, that totally confused me for quite some It is replicable with the Samples app:
The problem is that the style menu is only created when the Rendertheme is I do not really have a good solution right now. I always thought that that Ludwig On 20 December 2014 at 14:25, Ludwig notifications@github.com wrote:
|
@applantation what do you mean by "dead branches"? Those that don't refer to valid dirs/files? I've dropped that while adding Since the two new methods allow their About the Samples app: is there anything that needs to be fixed in my code? |
I am just trying to fix this render theme problem, which I hope will be a Will look at your changes a bit later. Ludwig On 21 December 2014 at 16:29, mvglasow notifications@github.com wrote:
|
I just pushed a fix for the problem I described to dev, it moves the It looks like that this does not affect your pull request, but it needs to git fetch origin refs/pull/557/head:refs/remotes/pr/557 git checkout pr/557 git rebase dev Ludwig On 21 December 2014 at 18:07, ludwigb notifications@github.com wrote:
|
Yes I think I can see a performance hit on the rendering because of the render theme's parsing move. |
Yes, I think that is when the UI thread gets blocked. Moving that into a On 22 December 2014 at 11:24, Emux notifications@github.com wrote:
|
Talking about threads: I looked through the code again, hoping that I could use the existing worker thread for my purposes. However, only creating the list entries one by one could be offloaded into the worker thread if I did it that way. The bulk of the work is to parse the directory tree, though, and that would have remained in the main thread. To clarify: at this stage I am just feeding key/file mappings into To get a feeling for startup performance when reading data from a previous instance, I set up a test that populates a cache with the area of a city rendered at zoom level 16 and all lower ones, then has another instance re-read the cache. I did some test runs on my machine, and rebuilding a cache of ~4600 tiles took somewhere in the range of 100–150 ms. Would such a delay be acceptable? If not, I'd probably need a hand with the thread stuff – I'd like to see Ludwig's commit for moving render theme parsing into a separate thread so I could copy from his code. |
The general rule for Android is not to have anything long-running or I was just working on a solution with futures for the Rendertheme parsing, Ludwig On 22 December 2014 at 13:40, mvglasow notifications@github.com wrote:
|
No problem, I might not get around to doing a lot of coding myself over |
Compatibility versions for all changed methods in AndroidUtil isValidDirectory and isValidFile methods for FSTC Improved documentation of readCacheDirectory Signed-off-by: mvglasow <michael -at- vonglasow.com>
PS: I just pushed the changes I have made so far (excluding the cache rebuild speed test) in a separate commit. |
I have just pushed a changes that moves the rendertheme parsing into a This seems to be working very well with the persistent cache changes: now So far I have not seen any concurrency issues, but I will continue to test This feels like a big improvement in user perceived performance, which is a Thanks. Ludwig On 22 December 2014 at 16:34, mvglasow notifications@github.com wrote:
|
(We should probably move the conversation about the render theme parsing in mailing list, as it involves the whole library) I integrated the new commit Ludwig but I still see the performance hit at 1st rendering (compared with 0.5), will continue the tests. |
I have just pushed the changes that Michael proposed and implemented in his On top of Michael's change I have pushed two more changes:
What is currently missing is a purge-cache operation if any of the My impression from limited testing is that particularly for larger-screen Ludwig On 23 December 2014 at 13:02, Emux notifications@github.com wrote:
|
Thanks for the merge and the improvements! Glad to finally have the code |
I have pushed on dev an addition for complete methods of tile cache creation. Thanks @mvglasow for the PR. |
Includes improvements discussed with Emux and Ludwig:
As mentioned before, in order to enforce cache size (and also to fix the NPE Ludwig found) I now examine the entire cache dir when the cache is initialized and enter anything I find there in the lruCache. This might affect startup performance if the cache dir holds a large number of files.