StackPath Support

Primary Causes of a Low Cache Hit Percentage

A low cache hit percentage occurs when files from an origin server are not being cached on the StackPath edge servers. In a perfect world, each site would have a cache hit percentage of 100%, but there are key factors that make the cache hit percentage less than perfect:

  • Full cache purges: 
    When you completely purge a site's cache, the cache hit percentage resets at 0%. The first few requests after a purge are sent to your origin - not StackPath - those requests will count as a cache miss.
  • Un-cacheable content: 
    Some files might have a cache-control-header that prevent our Nginx servers from caching them. The no-cache header causes this. 
  • New files: 
    Similar to the full cache purge, the first few requests for new files are sent to your origin.
  • Query strings: 
    A query string is a variable appended to a file. It's used to help browsers identify a new version of the file. Even if the original file without the query string is cached, the query string generates a new file URL. This can be corrected by disabling the query string option in your control panel.
  • Local caching mechanisms: 
    When running a caching server like Varnish, cache control headers set by Varnish prevent the CDN from caching the files.

The easiest way to avoid a low cache hit percentage is to avoid the scenarios listed above.

How to identify non-cache-able files

By using the “curl” command that on Linux and Unix/OS X the results would look as follows:

curl -I static.examplesite.net/css/style.css
HTTP/1.1 200 OK
Date: Mon, 27 Aug 2012 00:06:33 GMT
Content-Type: text/css
Connection: keep-alive
Last-Modified: Fri, 24 Aug 2012 10:45:17 GMT
ETag: "1f37e38-89f0-4c800abf294a8"
Vary: User-Agent
Expires: Tue, 28 Aug 2012 00:06:33 GMT
Cache-Control: max-age=86400
Server: NetDNA-cache/2.2
X-Cache: MISS

​The X-Cache: MISS indicates that the file is being pulled from the origin when requested. The same result can be achieved by using the file path in the Cache Inspector.

If you still have a low cache hit percentage, please contact our support team through a ticket or live chat 24/7/365!

Return to top
Powered by Zendesk