Why am I getting a cache MISS?

Headers returning x-cdn-cache-status MISS indicate the request was served by the origin D2M Hosting server. This means that the response was not found in the cache and so was fetched from the origin server, resulting in a longer TTFB and a longer total load time. On pages you want to be cached you'd expect to see x-cdn-cache-status HIT.

A cache 'MISS' status is usually caused under three main conditions:

  1. Browser cookies being set
  2. Conflicting caching plugins
  3. Preventative .htaccess file directives

 

Browser cookies

When a cookie is in use on a webpage the CDN edge cache will automatically avoid caching the content. When present, cookies work with PHP as the page is loaded in order to perform a unique action. When a page is served from cache, it’s already been generated previously by the server. If the page is cached, the cookie cannot be generated and perform its action with the page load as expected.

Some applications also use a PHPSESSID cookie which busts cache as the page will automatically receive a cache, MISS, for example, WooCommerce set's a PHPSESSID. In a lot of cases this cookie doesn't alter behaviour, so disabling the cookie is one way to correctly optimise and configure your site to work best with the cache. You may wish to try adding  into a php.in file session.use_cookies = 0, if this doesn't work the following code in your .htaccces file should also achieve the same result in disabling the PHPSESSID SetEnv session.use_cookies='0';

Let's take a real-world example. If you have a WordPress website with a shopping cart, you'll almost certainly have a cookie storing data about what product Customer A has in their basket. If this data was cached at a CDN node and served to Customer B, they too would see the same product in their own basket.

Cache Hit Rate: This is the percentage of requests to a site that has been served from cache. Generally, you'll want this to be as high as possible. Please note, this rate includes traffic from bots as well as genuine website visitors so if you're seeing an unexpected figure you should check if you've scheduled any crawls to your site which may reduce the accuracy of this figure.

 

Conflicting Caching Plugins

Our platform comes with various layers of caching built-in. One of the most effective of these caching layers, especially at scale, is our edge cache system.

Unfortunately, most cache plugins will interfere with this and as a result, we don't recommend running any caching plugins on your WordPress site.

This includes, but is not limited-to: W3TC, Super Cache, WP Rocket and Hummingbird.

Don't panic! You won't need them - all caching plugins are built for speed, and you can rest assured our StackCache plugin will do that hard work for you. 

 

.htaccess File Directives

Cache-Control and Expires headers can be set in the .htaccess file within the root directory for the site. These let you control various elements of how your site is cached, including preventing caching altogether.

If you were to add Cache-Control: no-store into a .htaccess file then the HTTP headers would serve as a directive to prevent the site from caching and a cache MISS would be received via the HTTP headers. 

If you receive a cache MISS then you should review your .htaccess file for any conflicting directives.

  • CDN, MISS, cache, Caching Plugins
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How long is website data cached for at a CDN node?

The CDN itself is used to cache static content. By default, the following file types are cached...

Pages that receive a cache BYPASS

There'll always be some pages that you'll rarely ever want to cache. On some of these pages, we...

What is the Website Acceleration Suite?

  Overview D2M Hosting's CDN powers-up your websites further by feeding them through our...

CDN Statistics

With the free D2M Hosting CDN, you can get an understanding about the traffic and requests...

Do I need caching plugins in addition to the D2M Hosting CDN?

The short answer is no, the D2M Hosting Content Delivery Network takes care of caching for you....

Powered by WHMCompleteSolution