WordPress, being built with PHP and using a database, comes with some inherent overhead. Requesting data from the database takes time, plugin code adds a bit more time, and so does your theme. Before you know it, a site can be taking 5-10 seconds before it can even return a response (this is the plain HTML code), not to mention all the CSS, JS, images and fonts your page might need AFTER the browser gets the initial HTML from the page. In addition to that, if you can't afford quality hosting, your server might be overloaded from sharing resources with 200-300 other sites, and the overhead from all the PHP and database queries gets even worse!
Clearing the Cache
- The server gets a request for https://my-awesome-site.com/my-awesomer-image.jpg
- It checks to see if the visitor is using a browser that supports WebP (most do) AND if there is a WebP version of my-awesomer-image.jpg.
- If #2, bam, it's delivered, no URLs changed, no HTML broken, hurrah!
We have some other WebP delivery options in the EWWW Image Optimizer, but they all have one fatal flaw: they change the HTML structure of your page to deliver WebP images.
So this is my second favorite WebP delivery option, and it's a great one! When SWIS caches your pages, it can build 2 copies (or variants): one for WebP browsers, and one for the poor saps on old browsers. These variants are completely identical in structure. The only difference is the image URLs themselves.
When someone visits your site, SWIS does a quick check for WebP support, and delivers the appropriate variant to the visitor. Double hurrah!
Most sites aren't static, they change from time to time. And so the cache gets cleared, and now your visitors are getting slow page loads because the cache needs to be rebuilt. Never fear, just let cache preloading take care of that, and say goodbye to slow first page loads!
But how does it work?!?! Alright, I'll tell you, ease up already! First, it checks for site maps in known locations (sitemap_index.xml, sitemap.xml, and wp-sitemap.xml). If your sitemap is somewhere else, just holler and we'll add it to the list. But those covers all the common SEO plugins and stock WP behavior.
If SWIS absolutely can't find a sitemap, it'll grab the 1,000 most recently published posts/pages/content. From there, it uses "async" requests in the background to fetch each one of the URLs that have been found. By default, it pauses for 5 seconds in between requests, but you can change that with the swis_cache_preload_delay filter if you like. If a page is cached already, SWIS is clever enough to skip ahead and go to the next URL, so there's no double-dipping (gross, who does that!).
Oh, you betcha! The Page Cache has even more options available via Overrides.