-
Notifications
You must be signed in to change notification settings - Fork 230
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
Serve stale data instead of blocking with lock=True
#289
Comments
Now cacheops immediately erases data on event, so you can't serve anything stale. Need to change this first. And there could be lots of strategies with that. You can move it, mark it stale or add to invalidated list. This depends on how you want to work it later. |
@Suor thanks for the feedback. So something like this:
If I'm reading correctly, this should:
|
This could work. Have you tried implementing it? Also, volatile keys are expired and deleted even without any |
@Suor Thanks for the feedback on the approach. I have not had a chance to try and implement it yet. I have currently just backported dogpile mitigation (locking) to an old version of django-cacheops for use in a Django 1.6 project. That is working to reduce load but is not improving response times. Time is now just spent with most requests waiting for the locks to release instead of recreating cache data in parallel. Next I will try to implement the above, and hopefully with minor tweaks it can be adapted for the current version of django-cacheops too, assuming it works. |
This should be easier to do in new insideout mode. That ones doesn't drop the cache key on invalidation but only removes conj stamps. |
I will leave a hint in case anyone wants to champion this:
|
@cached_as(..., lock=True)
can be used to avoid dog-pile effect, but this still results in slow queries as clients wait to acquire lock while cache is being populated (but at least results in lower resource utilisation).I'd like an option to immediately serve stale data (if available) from the cache instead of blocking while the cache is being populated. This was mentioned in #134 (comment) as the second point of avoiding dog-pile.
Can you give some advice on how to approach this implementation in django-cacheops?
The text was updated successfully, but these errors were encountered: