Ensuring your website load faster is one of the critical metrics to online business success. Nobody likes slow loading site.
There are various techniques to speed-up your website, but one of quickest way 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 serve the requested resources to audience from the nearest location.
It’s essential to choose the low latency CDN which has worldwide POP (point or presence) or edge location.
Let’s look at some of the CDN provider and its number of POP.
|CDN||POP/Edge Network/Cache location|
|Google Cloud CDN||100+|
In this post, I will talk about how to enable Google Cloud CDN for your website and setup 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:
- Login to Google Cloud Platform to list Load Balancer
- Click Edit
- Go to 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 instance group created, you can do the following to create HTTP(S) LB and enable Cloud CDN.
- Login to Google Cloud Platform
- Go to Networking >> Load balancing >> Create 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 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.
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 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 tool 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 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 compare to 3.24 without CDN.
Google Cloud CDN made my website load faster for and increased the throughput. This test was on test instance of WordPress without any caching plugin.
Have you tried Google Cloud CDN yet?