Skip to content
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

Caching merged range requests #30

Open
geospatial-jeff opened this issue May 29, 2020 · 1 comment
Open

Caching merged range requests #30

geospatial-jeff opened this issue May 29, 2020 · 1 comment

Comments

@geospatial-jeff
Copy link
Owner

geospatial-jeff commented May 29, 2020

Ref #23

I think there are a few options which could work:

  • Cache individual tiles after the ranged request. This has the benefit of caching the tile regardless of how it was requested (merged vs. unmerged), but adds complexity because we need to check if all of the tiles encapsulated by a specific merged request are cached before doing the request, skipping the merged request and pulling tiles directly from the cache if this is the case.
  • Cache the range request itself, using start/end as the cache key. This is easier to implement but wont cache the same tile across merged and unmerged requests. Another downside is we will only get a cache hit if the exact same range request is performed (ex. if you have two ranges A->D and B->D there will not be a cache hit even though 75% of the imagery is the same between the two requests).
  • Another solution is to cache with some sort of range key so we never request the same byte from the image more than once. This would of course be useful for every range request we perform and would be implemented on the lower-level Filesystem which is a nice design pattern, but I don't think aiocache has support for this.

There is also an argument to be made that choosing a caching stragegy which works across both merged/unmerged requests since (I think?) most users would be exclusively using either merged or un-merged range requests.

@geospatial-jeff
Copy link
Owner Author

geospatial-jeff commented May 29, 2020

  • but I don't think aiocache has support for this

A redis specific implementation is creating a sorted set specific to each image where each member of the set is a range we've already request. Then using mget to query the sorted set. Aiocache supports passing raw commands to the underlying cache client so this is possible, but we lose compatibility with other backends.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant