-
Notifications
You must be signed in to change notification settings - Fork 106
Servicing stale cached responses and immediate purging #522
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
Comments
While #515 is blocked by the full index rework in #1869, we still can implement an elementary TDB removal and finish this task. Need to implement Once we add a new cache entry to HTrie, we should scan the target bucket and call We should never remove index nodes (the same approach is used in the new HTrie version). Records removing can and should be done under the bucket lock. If a bucket becomes empty, then do not reclaim it. Remove only the data (variable length data, which is web cache entries are). I think we can use reference counters (either in |
Uh oh!
There was an error while loading. Please reload this page.
Depends on #515
Servicing stale responses from the cache
Implement
cache_use_stale
option, which doubles Nginx's proxy_cache_use_stale. 3rd case in #506 mentions the stale responses flags, so the issues are dependent.imeout
,error
and HTTP status codes must be implemented. The new configuration option synthax:, where
status_code
is numerical HTTP status codes,error
implies any 50x 0r 40x error codes. If a status code specified, thenerror
isn't allowed. Examples:stale-while-revalidate
andstale-if-error
headers from RFC 5861 also must be supported.Implementation
The caching workflow must be adjusted:
req->resp
) and mark (probably as a flag in the response or request) that the response is stale. (The cache entry must be locked or reference counted, see TDBv0.2: Cache background revalidation and eviction #515)cache_use_stale
or timeout occured, then do not link the error response withreq->resp
, but send the stale cache response to a clientWe should keep not more than 1, the latest one, maybe stale though, response in the cache. All older stale versions of the response must be purged. So with adding a cache entry wich already has stale version, we need to remove the stale version. The stale version can be removed directly by just linked
req->resp
and we don't need to traverse the TDB index.Immediate purging
#501 required two strategies for cache purging:
immediate
andinvalidate
. While we're actually always service stale responses due to #788, we store all the stale responses in the cache. So theimmediate
strategy must be implemented when TDB removal is done in #515.Testing & documentation
Please update https://github.com/tempesta-tech/tempesta/wiki/Caching-Responses and develop appropriate functional tests or create an issue.
The text was updated successfully, but these errors were encountered: