Improve Server Performance with Cloudflare Page Rules

Must read:

Ferdian Alfianto

Ferdian Alfianto

Ferdian Alfianto is an Internet enthusiast, Mac Lover; likes using Wordpress, experimenting with Linux (especially Debian and Ubuntu), tinkering with pfSense routers, happy experimenting with LEMP (Linux, Nginx, MariaDB, PHP) and Redis. You can contact me here.

Cloudflare Page Rules is a Cloudflare feature that is not widely used by users, even though this feature is quite powerful. Cloudflare Page Rules allow us to control how Cloudflare treats our site URLs.

By default Cloudflare does not cache web pages, either static or dynamic. Only static files are cached by Cloudflare, such as image files, css, javascript, etc. So if a visitor accesses your site, Cloudflare will immediately be forwarded to your site's server, except for the static files that I mentioned above.

For sites that are not too many visitors it may not be a problem, but if your site is busy with lots of visitors; it will be a problem on the server side. CPU load will increase, so will bandwidth, disk I / O, etc.

With Page Rules, we can instruct Cloudflare to cache the pages of our site, whether all pages or part of it. With web pages served by Cloudflare servers, server performance will automatically be light. And because server resources are not used much, the server can automatically serve more site visitors, save bandwidth, and you can install more WordPress sites to the server.

Configure Cloudflare Page Rules

I assume your site is configured using Cloudflare, and we just need to go to the Page Rules menu.

Configure the Page Rules as below:

Configure Cloudflare Page Rules

Configuration details can be seen below.

Configure Cloudflare Page Rules
In this configuration, we instruct Cloudflare NOT to cache the WordPress login page, because if we cache it it will cause problems, such as looping. If you use another CMS, customize it with the CMS login page.
Configure Cloudflare Page Rules
In this configuration, the function is the same as the first configuration, which instructs Cloudflare NOT to cache the pages that are used for login.
Configure Cloudflare Page Rules
In this last configuration, we instruct Cloudflare to cache all the pages of our WordPress site.
NOTE: The first and second configuration positions must be above this last configuration.

Do a test, whether Cloudflare has cached our WordPress site pages, do it by running a command prompt (CMD) or Windows PowerShell, and run the command:

curl -I https://yourdomainname.com

Check the output of the command, and if there is a sentence CF-Cache-Status: HIT, means that your webpage has been cached by Cloudflare.

Cloudflare Cache Hit

Benchmark Test

Just like in my previous writing, EasyEngine v4 Install Tutorial & Benchmark Results, we will benchmark our server and site performance with LoadImpact; with 100 users and a duration of 15 minutes. And the results are as follows:

Cloudflare Page Rules Benchmark Test Results

The mean response time was 12.52 ms, and 238370 requests were successfully created with an average of 265 requests per second. And the highest recorded CPU load was only 0.16!

Maybe the results of the request wouldn't be as high if we didn't use Cloudflare, like in this test. However, the bottom line is, the response time is much smaller and the CPU load is very low, this is an impressive value. It's almost as if the server isn't performing at all. All requests are served by Cloudflare servers.

Facebook
Twitter
WhatsApp
Telegram
E-mail

Latest articles:

MongoDB logo
Linux

Easy to Install MongoDB on Ubuntu 20.04

This tutorial explains how to install and configure MongoDB Community Edition on Ubuntu 20.04. MongoDB is a free, open-source document database. Belongs to the so-called database family

Related article:

MongoDB logo

Easy to Install MongoDB on Ubuntu 20.04

This tutorial explains how to install and configure MongoDB Community Edition on Ubuntu 20.04. MongoDB is a free, open-source document database. Belongs to the so-called database family

rocket nginx

Rocket-Nginx + WP-Rocket: What are the Benefits?

What is Rocket-Nginx? Rocket-Nginx is a configuration add-on to Nginx for the WordPress cache plugin, WP-Rocket. The developer claims that by injecting the Rocket-Nginx configuration, the

domain

The World's Cheapest Domain Hunt!

The cheapest domain, who doesn't love getting it? Yes, even the author of this blog loves to hunt for cheap domains :). Frequently questions are asked to the author,