-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Use django-cacheops to speed up serving docs and support DB going down #6321
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
Conversation
ad1e236
to
022136b
Compare
`django-cacheops` allows us to cache querysets into a redis backend in a granular way. We can define which models we want to cache and we can specify which instances (el proxito, web, workers, etc) will use this cache and which of them will invalidate it. This initial approach configure El Proxito to make usage of this cache when performing queries and configure Web/Celery/Build instances only to invalidate the cache when a model changed. This setup allows us to serve docs faster but also keep serving docs during `CACHEOPS_TIMEOUT` seconds even when the DB goes down. Because the way it's configured now (web is not using the cache), when the DB goes down, the footer API call will fail and the flyout menu won't be replaced properly. We could change this if we want by performing Manual caching on that view or by enabling cacheops in Web instance as well.
ca06f8b
to
a80604f
Compare
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
We haven't rolled out completely El Proxito yet and we are not sure we are going to need this. Although, the PR does work and the approach could be interesting. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
We haven't made a decision about what to do with this yet. El Proxito has been pretty stable so far and we may don't need this work at all. Although, I will leave it open for another month or so, and we can back when stale bot mentioned us again. |
This may not be needed. Our Proxito is pretty stable now and we are adding CDN in front of it. I'm closing it for now and we can revisit in the future if we think it's still a good idea. |
I may give it a second change and see if I can implement this PR quickly into our code under a feature flag to compare execution times with the regular implementation. Maybe we can make Proxito fast without too much effort. |
django-cacheops
allows us to cache querysets into a redis backend in agranular way. We can define which models we want to cache and we can
specify which instances (el proxito, web, workers, etc) will use this
cache and which of them will invalidate it.
This initial approach configure El Proxito to make usage of this cache
when performing queries and configure Web/Celery/Build instances only
to invalidate the cache when a model changed.
This setup allows us to serve docs faster but also keep serving docs
during
CACHEOPS_TIMEOUT
seconds even when the DB goes down.Because the way it's configured now (web is not using the cache), when
the DB goes down, the footer API call will fail and the flyout menu
won't be replaced properly. We could change this if we want by
performing Manual caching on that view or by enabling cacheops in Web
instance as well.