Repository navigation
Conversation
…rent file requests. Fixes issue #12655: don't let offline downloads starve interactive tile downloads.
|
Took this PR for a spin: for every run I did a clean install of the app:
Above numbers should be taken with a grain of salt as these are singular runs but the trend is that this PR makes offline downloads significantly slower. Happy to do more thorough benchmarking if needed. |
|
I'm not convinced that this is a correct solution for this problem. What kind of testing did you do to verify that this solves the underlying issue? Apart from manual testing, it'd also be cool to try to reproduce this with an automated test. Granted, it could be tricky since it's timing dependent, but maybe we could use a mock Online/HTTPFileSource that simulates this behavior? |
|
Oops! I just saw that I never submitted the comment below from two weeks ago! TLDR: yeah, let's try a different approach. @tobrun's quick benchmarking definitely seems to contradict my "10 concurrent connections oughta be plenty" hypothesis, so yeah, this approach probably doesn't make sense (although we could try a higher number still short of 20, I get that we don't really want a solution that "doesn't slow us down that much").
Just watching what happened in the debugger, this didn't look like a super-complicated situation to me, although maybe I'm missing something? It's just that the callback that mapbox-gl-native/platform/default/online_file_source.cpp Lines 120 to 125 in 710a7f5 cc @chaupow |
Fixes issue #12655: don't let offline downloads starve interactive tile downloads.
I started to look at implementing a dual-priority queue in
OnlineFileSource, and I don't think it would be too hard to do. But as I was looking at the code, I realized thatOfflineDownloadalready limits the number of concurrent requests it makes. Setting that concurrent request limit to something less than the maximum number of concurrent requests inOnlineFileSourceensures that there will always be some spots open for interactive downloads. I arbitrarily chose 50% (or 10 concurrent downloads given our current implementations) and played around with browsing tiles while simultaneously doing offline downloads in the macosapp -- seemed to work fine.The downside to this dead-simple approach is that the offline downloads are in some sense "throttled" even when there are no interactive tile requests, but I'm not sure it's a significant concern in practice: my guess would be that 10 concurrent requests is still enough to saturate most network connections.
/cc @tobrun @kkaefer @lilykaiser