-
Notifications
You must be signed in to change notification settings - Fork 136
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
No urls are shown as cached in the wagtail admin - terrible performance #576
Comments
A couple things to consider:
|
I got something to work, but I'm not sure what it was in all the chaos. But I can see URLs in the cache in the admin now, and the performance is much better 1-2.5 sec per pageload, which is acceptable. I see the HTTP header; X-Wagtail-Cache: miss. Does that mean it has no cache entry? It didn't change when I reloaded the page several times either. But things are looking much better, and I did not know the cache only applied to non-authenticated users, so that's good to know. PS! I see that I get a massive amount of SQL queries in the django-debug-toolbar, especially related to images. Will using cachalot or something similar have any effect on the number of queries? My site will be image-heavy so any optimization tips would be helpful. It probably didn't help that I have a rather big custom image model as well, because I need EXIF and IPTC metadata. Anyhow, thanks a lot for all your help :-) |
I'm not familiar with cachalot... but wagtail-cache will cache the entire page response, so images etc. have no effect on the performance of an already cached page (other than of course network bandwidth). I would recommend reading "Notes about the request/response cycle" in the wagtail-cache docs to learn more how it works under the hood: https://docs.coderedcorp.com/wagtail-cache/getting_started/hooks.html#notes-about-the-request-response-cycle |
It's the frontpage using the crx navbar with a search form, including CSRF token so that's probably it. I'm also checking to see if the current user is authenticated or not and toggle a login in or sign up link based on that. I'm not using search so I might remove that section, and find a different way to log users into the site. That might make the page cachable. |
The login check shouldn't cause an issue... if the user is not logged in, the page will be cacheable, unless you are creating/setting a session. Logged in users will never be served cached pages by wagtail-cache. The CRX search form in the navbar should not be creating a CSRF. It does not need it since it is using a GET request. |
Closing this due to inactivity. Feel free to re-open if you are still experiencing the issue or have any new information. Thanks! |
I've followed the instructions regarding wagtail-cache, and added the middleware (adding "wagtailcache.cache.UpdateCacheMiddleware" first and "wagtailcache.cache.FetchFromCacheMiddleware" last) as instructed, but none of my URLs are cached in production, and the response of my site is terrible. I see on the network monitoring in the developer panel in Chrome that the Django-part is to blame, taking up all of the loading time. My static and media content is served by CDN and is cached ok.
The text was updated successfully, but these errors were encountered: