Ensuring your website load faster is one of the critical metrics to online business success.

Nobody likes a slow loading site.

There are various techniques to speed-up your website, but one of the quickest ways is to implement the right CDN (Content Delivery Network).

If you are new to CDN, you may refer to the essential guide to CDN for better understanding.

In one line, CDN accelerates your content and serves the requested resources to the audience from the nearest location. It’s essential to choose the low latency CDN, which has worldwide POP (point of presence) or edge location.

Let’s look at some of the CDN providers and their number of POP.

CDN POP/Edge Network/Cache location
Google Cloud CDN 130+
Cloudflare 200+
Amazon Cloudfront 200+
StackPath 45+

In this post, I will talk about how to enable Google Cloud CDN for your website and set up one WordPress URL to show how fast it is.

Google Cloud CDN is available to anyone using Google HTTP(S) Load Balancer and provides many other features along with low latency content distribution.

  • Anycast – all content distribution from single IP worldwide
  • HTTP/2 – new HTTP 2 protocol is support.
  • HTTPS – setup your SSL/TLS certificate at Load Balancer
  • Logging – Capture cache hits/miss in Stackdriver logging
  • Cache Purge – Purge the cache instantly

Enabling Google Cloud CDN

You can enable CDN on either existing Google Load Balancer or New one.

To enable on existing LB:

  • Log in to Google Cloud Platform to list the Load Balancer.
  • Click Edit
  • Go to the Backend configuration and select the existing backend.
  • Tick the “Enable Cloud CDN” under backend configuration of HTTP(S) load balancer

  • Click Update to save the configuration.

To create new LB and enable

As an LB pre-requisite, you need to create an instance group. Once the instance group created, you can do the following to create HTTP(S) LB and enable Cloud CDN.

  • Log in to Google Cloud Platform
  • Go to Networking >> Load balancing >> Create a load balancer
  • Select “Start Configuration” for HTTP(S) Load Balancing
  • Create a backend configuration with the existing instance group and select “Enable Cloud CDN.”

Most probably, you don’t have to do any configuration for (Host and path rules & Front configuration) if you are just doing basic LB setup.

You can leave the default configuration and click Create

It will take a few seconds, and you will get a confirmation that LB is created. LB will be associated with a public IP which you will use to update A record of your domain.

Note: Google will, by default, give you an ephemeral IP, and it’s strongly recommended to get one static public IP for the LB.

Testing Google Cloud CDN

So here is what I did to test.

I provisioned f1-micro instance with 10 GB SSD disk on Google Cloud. BTW, this configuration would cost around $6.

I installed WordPress with the help of EasyEngine without any cache plugin and point my domain (Chandan.io) to VM external IP address.

Note: DNS propagation may take some time, so you got to ensure your domain is resolving to Google Cloud VM before starting the test.

I installed the BLOGGING theme, so it has some content.

Testing WordPress without Google Cloud CDN

I ran a speed test against Chandan.io through BlazeMeter with 50 concurrent users for two minutes, and results are:

  • Average response time is 13.46 seconds
  • 90% response time is 26.73 seconds

So now, I know my WordPress performance from VM, and it’s time to enable the cloud CDN and run the test again to compare the results.

You may also consider some other tools to perform a load test.

Testing WordPress with Google Cloud CDN

I created LB with Cloud CDN and updated my domain A record to point to LB public IP.

The backend VM remain the same, and I ran the test with 50 users for two minutes, and here are the results.

Do you see a huge difference?

  • Average response time 3.82s compare to 13.46s without CDN.
  • 90% response time 9.6s compare to 26.73s without CDN.
  • Average throughput 10.28 hits per second compared to 3.24 without CDN.

Google Cloud CDN made my website load faster for and increased the throughput. The performance looks promising, and if you’re already on GCP, then you may want to take advantage of their low-latency CDN.

If you are interested in learning GCP then I would suggest checking out this Udemy course.