• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Startup Hero

The Official Blog Of Name Hero

Learn To Fly Above The Competition Get Started
  • HomeWelcome
  • CoursesVideo Training Center
  • About UsWhat is StartupHero?
  • BlogGet the latest
  • Start HereStartup 101
  • SpeakingPodcast & Media
  • ResourcesTools to help You
    • Reselling WordPress Hosting
    • Resell Hero
    • How To Start A Blog
  • NameHeroCloud Web Hosting

How To Achieve ~90% Cache Hit Ratio On Cloudflare

By Bhagwad Park on March 31, 2021 0

How To Achieve ~90% Cache Hit Ratio On Cloudflare

Let me start this with a screenshot of my Cloudflare dashboard showing the cache hit ratio:

Cache Hit Ratio on Cloudflare
Cache Hit Ratio on Cloudflare

I’m caching 85% of all the requests to my site WP-Tweaks. Keep in mind this includes not just legitimate traffic, but also bot traffic, spam, and even hacking attempts. The good news is that you can achieve this too. And not just with Cloudflare. NameHero allows free integration with QUIC.cloud, which can get you close to the percentage displayed above. However, QUIC.cloud is still technically in beta and doesn’t have nearly as many features as Cloudflare. So for this article, I’ll be talking about how to achieve a high cache hit ratio with Cloudflare only.

What is a Cache Hit Ratio?

The cache hit ratio is the percentage of requests that are served by the EDGE server instead of your origin. The higher this number is, the less strain on your site, and the faster your visitors see your content. This is made most clear by the reduction in the TTFB (Time To First Byte) metric. And this metric directly impacts the Core Web Vital metrics like LCP (Largest Contentful Paint).

The EDGE servers are almost always located closer to your visitors than your origin server. And the content is cached, which means it doesn’t have to be generated from scratch. Both of these combine to give blazing fast page download speeds.

This Includes Dynamic Content like HTML!

For years, CDNs only cached static content like JavaScript and CSS. Even today, Cloudflare will only cache static content by default. But thanks to the techniques I show below, you can get it to cache dynamic HTML content as well. This dramatically improves your cache hit ratio – particularly for bots, which don’t need to download static content.

So how do we reach this super high hit percentage?

Step 1. Configuring Dynamic Content Caching

With Cloudflare, I’ve written a tutorial on how to cache dynamic content. There’s also a Cloudflare free feature for “Pro” plans and above that uses the Cloudflare plugin on your WordPress installation for HTML caching. It’s called “APO”.

For NameHero users, you can check out our knowledgebase on how to enable QUIC.cloud (Step 6). Once you have this going, you’ll immediately see a big spike in your cache hit ratio. All the bots (good and bad) will be served static HTML pages instead of getting responses from your origin. It works great!

Step 2: Enable a Good Cloud Firewall

I routinely block hundreds or even thousands of bad hits on my site using the Cloudflare WAF (Web Application Firewall). Bots probing for weaknesses should never even receive a response from your site – let alone make it through to your origin server. For Cloudflare, the WAF comes with the “Pro” plan. I prefer a cloud-based firewall to something like WordPress that runs on your server because it reduces the load on your server.

Step 3: Use Page Rules for Popular Redirects

If you’re an affiliate site, you probably have some really popular URLs that are redirected to your real affiliate link. I suggest you use Cloudflare’s Page Rules for these redirects. Not only do they keep the workload off your server, but your paying customers will also get to the destination landing page much faster. Win-win for everyone!

Step 4: Implement Sensible Rate Limiting Rules

Rate limiting is very difficult to set up correctly. But one area where you can use them safely is on your login page, where there aren’t expected to be dozens of requests every minute. I also use them on my affiliate URLs where I don’t expect an IP to be clicking many URLs in a spammy way.

Rate limiting rules have the potential to really save your site one day if it comes under heavy attack. So use them wisely!

Summary

Implementing all these techniques should easily get you in the range of 90% for your cache hit ratio. Once that happens, you’ll see all kinds of good things happen for your site. Visitors will be happier, and you’ll have fewer people accessing your site maliciously. What’s not to like?

Bhagwad Park Profile Picture
Bhagwad Park

I’m a NameHero team member, and an expert on WordPress and web hosting. I’ve been in this industry since 2008. I’ve also developed apps on Android and have written extensive tutorials on managing Linux servers. You can contact me on my website WP-Tweaks.com!

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Connect With Us!

Superhero Resources

Fix Common Issues

  • How To Setup Free And Automatic SSL Certificates
  • How To Setup Cloudflare With Railgun
  • How To Fix Memory Exhausted Errors In WordPress
  • How To Edit PHP Version/Upload Limit/Add Extensions
  • How To Move/Migrate Your Business To Name Hero

Free Guides

  • How To Setup NameHero Hosting
  • How To Create A Web Hosting Business With WordPress
  • How To Start A WordPress Blog
  • How To Migrate WordPress To A VPS
  • How To Speed Test And Optimize Your WordPress Website
  • Magento 2.X Installation Guide
  • How To Clean Up A WordPress Hack

Training

Recent Posts

  • Will Google FLOC Affect Website Owners?
  • Good Riddance To Contact Forms – Hello Google Forms!
  • How To Identify CLS Issues Using Google Chrome
  • How To Achieve ~90% Cache Hit Ratio On Cloudflare
  • How Does Google Judge EAT? Probably Links!
  • Inlined CSS – When To Use vs Stylesheets
Subscribe in a reader
  • Web Hosting
  • WordPress Hosting
  • Reseller Hosting
  • VPS Hosting
  • Twitter
  • Facebook
  • LinkedIn
  • YouTube
  • FTC Disclosure
  • Earnings Disclosure
  • Privacy Policy

Copyright © 2021 · Smart Passive Income Pro on Genesis Framework · WordPress · Log in