3

I am using a free Cloudflare account with a WordPress site and have seen consistently poor cache hit rates. After several weeks using Cloudflare, only about 22% of requests and 50% of traffic by bandwidth are being served from the Cloudflare cache. Why is this?

Some background information:

  • My page rules in Cloudflare are:

    • *example.com/wp-admin/* Apps: On, Performance: Off, Security: On, Cache level: Bypass cache
    • *example.com/*preview=true* Always online: On, Cache level: Bypass cache
    • *example.com/* Cache expiration: 4 hours, Cache level: Cache everything
  • The site currently gets a total of about 4,000 hits/day (counting pages, images, etc.) from 200+ unique visitors/day. I'm using this domain as a test case for moving much heavier/busier sites to Cloudflare.

  • I am using the "standard" caching level in Cloudflare
  • I am using WP Super Cache and can provide those settings if requested. I installed WPSC only after starting to use Cloudflare, however, and the Cloudflare hit rates were poor even before that.

So, what can I do to get the cache hit rates up? Or is this about what I should expect with a Wordpress site?

2

CloudFlare caches differently in each region depending on the volume of traffic in that region. Using a TTL of 4 hours means that your content will expire in 4 hours and the origin server is triggered by the first visitor after this time has lapsed, this will result in a miss, as far as I know... its not automated and must have a visitor to trigger the cache, so only pages that are regularly visited will be cached most of the time, pages with lower traffic will receive higher miss rates.

Also you must note that a trigger in one country doesn't trigger the cache in other countries, also, it doesn't trigger all resources, only the ones that person needs.

SOURCE

Note: CloudFlare's static content caching is dependent on both (a) where most of your visitors are coming from and which CloudFlare datacenter they are hitting, and (b) how may times those resources are requested at the specific datacenter. As such, CloudFlare does not cache the same resources for your site globally at every datacenter location.

Its not unsual that CloudFlare refuses to cache content that is supported but because a query string has been appended to the file it can cause issues, for example versioning, and some plugins that combine all JS/CSS and don't use a file extension. CloudFlare only the following static files will be cached: .css, .js, .jpg, .jpeg, .gif, .ico, .png, .bmp, .pict, .csv, .doc, .pdf, .pls, .ppt, .tif, .tiff, .eps, .ejs, .swf, .midi, .mid, .ttf, .eot, .woff, .otf, .svg, .svgz, .webp, .docx, .xlsx, .xls, .ptx, .ps, .class and .jar

So ensure that your file extensions are clean, also... 3rd party resources such as Google Analyics, jQuery etc etc, if hosted externally will result in a lower % of traffic served by CloudFlare.

  • Well, that pretty much nailed it. This is the information I have been looking for, and I'm confident it's why my particular site is seeing bad hit rates. Thanks! – elixenide Oct 28 '15 at 17:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.