Open MichelleBlanchette opened 3 years ago
Unassigning for now because we do use WP Rocket and the site is performant.
I really want to know what WP Rocket's impact is on performance before nixing it for a custom implementation. It's only $50/yr but I really don't use many of its features that I'm aware of.
Also, a very 🔑 point is that you need to ensure proper cache clearing and excluding for pages that use nonces like Completionist's download page. (Can you hook into the nonce expiration/tick to clear the cache??)
It'd probably be most efficient to implement caching via NGINX at the web server layer so that PHP doesn't even need to be executed. I don't know how difficult this is to implement and if PHP could communicate with NGINX to clear page-specific caches when posts are updated and such.
I wonder if the Cloudflare API could be used, because then caching is at the DNS/CDN layer which is even before my web server is hit.
Actually, I realize I don't maintain a publicly accessible staging environment to test DNS or NIGNX configurations and functionality. In that case, let's just implement HTML caching via PHP for now.
We likely don't even need WP Rocket to maintain our great speeds. Let's try using WordPress's built-in caching functions:
And then we should probably just add a button to clear the cache or something..? Actually, just clear the cache for a page/post when it is updated? That's no good for global settings, though, like an author's profile photo or the Recent Posts list in the footer, so we definitely need a manual Purge button.
Try outputting HTML comments to observe when the cache is being hit.
Recognize that this might interfere with WP Rocket. Also, certain templates should NOT be cached like the plugin-info page with the download link. Actually... just the header link shouldn't be cached. The post body can be cached. My point is, different templates will need different caching strategies.
Recommended Implementation (Mimics WP Rocket's Preloading)
GET
each WordPress page's resulting HTML content and write it to cache files (see contents of/wp-content/cache/wp-rocket/purpleturtlecreative.com
)save_post
to clear and preload the updated post's cached HTMLNGINX Rules
Since we have cached the HTML files on the server, you can likely configure NGINX to try those HTML files before serving the page via WordPress. WP Rocket has this article: https://docs.wp-rocket.me/article/37-nginx-configuration-for-wp-rocket
[2022-12-23] Update: I am successfully using https://github.com/SatelliteWP/rocket-nginx on production. It seems to have had a negligible impact, but this may be due to Cloudflare's edge cache..? I'm not sure. I think it should definitely reduce load on my server, though... as if that's ever been a concern. HA!