Our system honors all the cache control headers sent from the origin server, so a low cache hit percentage (CHP) means that while the static files are being served via your CDN, not all of them are being cached. The CHP starts every day from 0% and builds up during the day until it reaches its maximum. With perfect CDN integration, the CHP will reach 100% every day, but there are some things that will cause the CHP to not increase:

  1. Purging the cache:
    When a Pull Zone’s cache is purged, the CHP will reset to 0%.
  2. Not all files are cache-able:
    Some files might have a cache-control-header which will prevent our NginX servers from caching them. Some headers would be a “no-cache”, or a very low TTL.
  3. New files:
    When new files are added to the CDN, this will affect the CHP and prevent it from reaching 100%.
  4. Query String:
    A query string is a variable that appends to a file, usually used to to identify a new version of the file for the browser to recognize (for example, style.css?qstring=2). Because of this, even if the main file is cached, the query string generates a new file URL, preventing the man cached file from being served. You can correct this by disabling the query string option in Pull ZoneAdvanced Features in the control panel.
  5. Local Caching Mechanisms:
    When running a caching server like Varnish, the cache control headers set by Varnish will prevent the CDN from caching the files.

Identifying 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.

Resolving the low CHP problem

The simplest way to avoid low CHP, is to avoid all the contributing factors previously mentioned. If you already have, and you are still getting a low CHP, contact our Support Team for assistance.

  • What would you consider to be a low cache hit rate %?

    • Ivan Dabic

      Hey Brian! It depends on use case and particular scenario. Some users are pushing content through CDN that tends to change a lot, therefore, cache HIT % can be low as 20%. On the other hand common use case with static content that shouldn’t be changed too frequent, HIT % would vary between 80% and 99%.

      Basically, based on use case, HIT/MISS percentage can vary. You can send us an email to support@maxcdn.com so we can examine your usage and suggest the change in settings if needed.