So, one of the themes of 2020 for me (even before the virus) has been experimenting with the hosting of my blog. Back in January I moved my blog away from shared hosting on Reclaim to its own server on Digital Ocean (there were insinuations I was slowing down our infrastructure 🙂 ). That was fun and educational. In March I used the excuse of exploring the container-based WordPress hosting service Kinsta to move this blog away from Digital Ocean and onto that service. My site was definitely faster, but at close to $100 per month for my traffic tier it was more than double the cost of my own droplet, so back to Digital Ocean I went before my 30-day free trial were up.
Couple of things lingered from that experiment: I started using more robust caching on my server and I wanted to explore further the possibilities of Content Delivery Networks (a.k.a CDNs). So, trying to keep the always rewarding discovery time alive, I started playing with Cloudflare this weekend. How to explain what Cloudflare is? Well, it is similar to transactional email services like Mailgun or Sparkpost, but for DNS. So, if you have a cPanel account you can run your email, manage your DNS, and store your files all in the same place, it’s an all-in-one hosting solution. But as you start creating apps outside that environment, you have to manage not only the cloud-based hosting service you install your app on (such as a Digital Ocean droplet or an AWS EC-2 instance or a Linode node), but you also need to manage the DNS for the account as well as the email. So, you need various service to run that VPS, and many of them have APIs that allow the services to integrate behind the scenes. Cloudflare is a service that is by-and-large dedicated to manage your DNS in the cloud, and by extension has become one of the biggest CDNs on the planet.
Traditionally I have used cPanel’s Zone Editor to manage DNS (pictured above) for all my domains, but I figured it was high time I start exploring Cloudflare for myself given we’ve had more than a few questions about the service from folks using Reclaim.
So, what does this look like? Well, first thing is you can sign-up for a free account which will basically give you access to managing DNS for free, DDoS protection, and some basic CDN options. You can see the breakdown of their plans here, but the long and the short of it is that if you want to use the more extensive CDN options, more caching options, access to load balancing and failover, etc. you going to have to start paying anywhere from $20-$200 per month, ranging from a personal to business level of options. But first things first, first things is you need to sign-up for an account and then point your nameservers to Cloudflare for the domain you are hosting through them. They have a pretty solid tool that discovers all the DNS records for that domain, but keep in mind I have found it does not find subdomains, so those need to be re-created manually. This blog is on its own VPS (126.96.36.199), but all the subdomains and other services (save email which is through Mailgun) are reverting to my cPanel account where this domain used to be managed and where the subdomains still live, namely 188.8.131.52. So, DNS is essentially routing the domain names to various IP addresses, and that can be in the form of A records, CNAMEs, MX records, etc. So that is what the free version of Cloudflare offers, and if you need to route domain names and do not have DNS built into the application on your server this service would be a quick, cheap, and easy solution than trying to figure out DNS at the server level on your own.
While the free option will work for most, but I wanted to start drilling down into more options through the CDN. Particularly I wanted to see if they can compress my images and make the site run faster from where ever it’s loaded. The bava site is pretty inefficient to begin with given I never optimize images and I have way too many scripts running, so services like Cloudflare could help speed-up a site’s loading time for lazy people like me (a result of the year’s of online kipple that accumulate over time). The other thing I apprecaite about Cloudflare is insight to how much data is being service, what is cached, and how much of the traffic the site is getting is actually real. The numbers here are once again inflated as they were with Kinsta, but the ratio of requests to unique visitors seems more inline—and I am not paying per request or visit (or so I hope :). The other thing that is kind of nice is that they give you a shared SSL cert as part of the service, so that is taken care of by Cloudflare, and you can upgrade for a dedicated certificate or to upload your own, but that is not part of the $20 monthly Pro plan I have signed-up for.
But it is definitely increasing the site load time that made me interested in Cloudflare, and according the the Speed tab, it’s working:
So, if I am reading this right, what was usually taking anywhere from 3 seconds to a minute to load before Cloudflare is now taking anywhere from a second to 3 seconds for the user, which is definitely a good thing. One of the options you get in the Pro plan is the Polish option to increase image load time, and that is something I enabled, so we’ll see if that makes a sustained difference.
The other key element is caching, and the options seem pretty basic and simple, which I like, and I have to see if this caching interferes with caching already in place on WordPress through plugins.
So all this as a way to document where I am with Cloudflare thus far, there are a few things I still want to explore though. They enable you to setup load balancing and failover between two servers. This is absolute overkill for my blog, acknowledging that, I still want to play with this because I love the idea of the site going down and instantly traffic is directed to a stand-by bava so no viewer is ever at risk of not being able to read my drivel at all times 🙂 That is in the traffic section, so more to discover through a service they call Argo. The other thing I would be interested in exploring is Streaming, I wonder what that would look like and how it would work, so that might be the topic of another post.