Rework caching, no longer cache html but cache expensive queries#548
Rework caching, no longer cache html but cache expensive queries#548
Conversation
|
As discussed, this needs a bit more testing and profiling to see if this is a beneficial change (quick testing shows some benefits). |
|
Really too bad this died on the vine, considering the bug it tries to fix is absolutely devastating to the trustworthiness of the calendar, and remains to this day. Long shot but @cojennin, do you remember how bad the actual hit was of turning off caching v. leaving it on? Does it break the calendar? Because the bug currently caused by the per-user cache breaks the calendar. |
Old out of date PR: Automattic#548 This adapts the core elements while integrating changes made to calendar.php since the patch was created. The important thing it does is shift what we cache in `generate_post_li_html()` from being the final HTML to being the "information fields". This avoids having user-specific nonces get cached, allowing us to have the cache function without the user IDs, and thus allowing us to correctly purge the cache. The issues with these changes is that they don't move the needle. On my local site, the old caching brought generation time from 3s to 1s. With this caching, there's no noticeable difference at all, on or off the results were between 3.09 and 3.11 seconds.
|
Closing this PR as the underlying issue has been resolved differently. BackgroundThis PR attempted to fix #505 by reworking the caching strategy - caching expensive queries instead of the full HTML output. While this was a reasonable approach, further investigation (documented in #756) revealed that:
Resolution
The ideas in this PR (like deferring post details until click) are captured in #829 for future consideration. Thank you @cojennin for the original investigation and approach - it helped inform the eventual solution! |
First pass at improving #505
Instead of caching the entirety of the html, cache some of the queries that go into building the post details screen (and aren't user dependent). I added about 300 posts to the calendar to check, and there are some small improvements. Have not seen any major performance degradation, though this function now goes uncached.
I'd prefer not to remove the cache in it's entirety without some further investigation, but this PR starts to untangle some of it from the calendar. I've also tried to improve some of the calls being made to other functions to eke out some small performance improvements, and consolidate some calls to functions that didn't seem necessary
Eventually, we could consider doing some things in future PR's like: