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

Store other formats to allow better cache usage #14

Merged
merged 3 commits into from
Feb 1, 2016

Conversation

rmarianski
Copy link
Member

Depends on tilezen/tilequeue#66

@zerebubuth could you review please?

if self.store and coord.zoom <= 20:
self.io_pool.apply_async(
async_store, (self.store, tile_data, coord, format))

# since we're a request for all, enqueue the coordinate to
# ensure other formats get processed
if self.sqs_queue and coord.zoom <= 20:
Copy link
Member

Choose a reason for hiding this comment

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

Do we only want to do this when layer_spec == 'all', or is it worth doing this always? I guess what I'm trying to figure out is: If we add something to the TOI, should we always enqueue work to render the tile as if the tile were originally seeded?

The way the code is at the moment, we always add the tile to the TOI (e.g: perhaps it's a buildings layer request), and we'd store the JSON and (if any) other format that was requested, but not all the formats.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes that's right. But if we always enqueued, the scenario that wouldn't work out so well would be consistently receiving requests for a custom layer, eg buildings. We would enqueue tiles for every request, even though nothing would be changing.

I think it makes sense to enqueue when we receive a request for something that would have gotten served by the cache. Currently it's just the all layer, but we talked about starting to store tiles for the popular layers like buildings. If we did, then we would want to enqueue and store when we receive requests for these as well.

I'm inclined to leave it the way it is currently, and when code gets added to start storing other layers on s3, update this bit as well to reflect that, maybe through some explicit configuration in case we want to add more combinations in the future.

Thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

If the (JSON) tile data was in the store, then we'd have returned on line 257, wouldn't we? In which case, once we store the JSON and enqueue a re-render, we shouldn't end up in this branch more than once per tile (modulo it concurrently happening on several tileservers, and us potentially returning None from tile fetching because there was an error rather than no tile).

So, while a request for, say, buildings would end up at the tileserver again, it should be able to generate it from the JSON we stored last time rather than come through this branch again? Which my very circuitous way of trying to say I think it's safe to enqueue anything that gets added to the TOI.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think I follow what you mean now. Does it look better with d95a5fd?

@zerebubuth
Copy link
Member

👍, looks good to me!

rmarianski added a commit that referenced this pull request Feb 1, 2016
Store other formats to allow better cache usage
@rmarianski rmarianski merged commit 0102b9e into master Feb 1, 2016
@rmarianski rmarianski deleted the store-formatted-tile branch February 1, 2016 17:18
@zerebubuth zerebubuth added this to the v0.8.0 milestone Feb 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants