-
Notifications
You must be signed in to change notification settings - Fork 12
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
Fastly soft purge tiles based on diff updates #947
Comments
If the soft purging could be implemented then we could allow fastly to cache tiles for significantly longer eg:
|
Note that we don't use osm2pgql's expiry list but instead our own simpler one. |
A quick hacky of a script to submit URLs into a redis queue: https://gist.github.com/Firefishy/58a250759b29638d3c2e6842fb2ea5aa and a hacky script to submit the purge requests from queue (likely should be async submit): https://gist.github.com/Firefishy/c890afbbb2bd67649f7ab244880dbf07 |
Here is the current expiry implementation which is focused at metatile expiry: https://github.com/openstreetmap/chef/blob/master/cookbooks/tile/files/default/bin/expire-tiles-single |
The Fastly API rate limit documentation: Single-URL and surrogate key purges: limited to an average of 100,000 purges per customer per hour. https://developer.fastly.com/reference/api/#rate-limiting Purging purely based on metatiles is within the realms of possibility at 1666 metatiles per minute. |
We need to identify how many purge requests per second we'll be sending, as Fastly rate limits it to 1666/minute per customer, and we should be well below that. Frequent purges are generally a design flaw when using a CDN. |
I am proposing we use a queue (redis?), we can define the rate at which we process the queue. We could monitor queue length / queue time. Since openstreetmap/chef@edb9dbc we now collect the data to inform the estimation. |
Fastly supports soft purging which can be used to tell Fastly that a URL is stale and should be refreshed. The stale cache will still be used if the upstream is unavailable.
As part of the osm2pgsql diff import step a list of tiles to invalidate should be created. osm2pgsql has a native implementation of generating the list of tiles to expire.
Potentially the list of expired files should be added to a queue which is then asynchronously soft purged at fastly.
The text was updated successfully, but these errors were encountered: