All of my discussion forums, including Rise Forums, are powered by the forum software XenForo. I was one of the first people to jump over from the bloated vBulletin to the new Xenforo forum platform that was developed by the original vBulletin developers (i.e. when vBulletin was good).
When I launched Rise Forums, I made sure that the forum loaded quickly. XenForo is a fast piece of software, however I also removed advertisements and made other little tweaks to ensure pages loaded as fast as they could.
One thing I had yet to take advantage of was a content delivery network. It was something I was keen to look at closer.
Speeding Up Your Websites Using a CDN
A content delivery network (CDN) will store a static copy of every page of your website and distribute it to data centres around the world. This greatly reduces the time required to download a page from your website as the CDN data centre is usually much closer to the visitor’s location than the data centre of your hosting company.
Since visitors are viewing a static copy of your website, your hosting bandwidth is greatly reduced. Having so many copies of your website stored around the world also means that in the event of your website going offline, visitors can still view your website through the content delivery network.
I had never taken advantage of a content delivery network with my Xenforo powered forums. This was something I used in the past with vBulletin powered forums, but I experienced some common usability problems associated with turning something dynamic such as a forum into a static website. For example, if someone edited a post or updated their profile avatar, it would not be displayed on older pages until the cache was flushed.
I decided to revisit the idea of using a CDN recently when my friend Brian Jackson joined KeyCDN. He explained the benefits of using a CDN and noted on Rise Forums that I could speed up Rise Forums for less than a dollar a month.
It sounded too good to be true, however the pricing page of KeyCDN states that one GB of bandwidth costs only $0.04 and the price per GB of data goes down as your total bandwidth increases. For example, after using 10 TB of data the price up to 50 TB drops to $0.036 per GB in North America and Europe.
The price of $0.04 per GB of data is the same for North America, Europe, Asia, and Australia and New Zealand. Compare that with the pricing of a service such as MaxCDN, which charges $0.06 per GB up to 50 TB in North America and Europe and $0.095 in Asia and Australasia.
All prices are pay as you go. You are not required to sign up to any monthly plans and pay for data you are not ever going to use.
KeyCDN currently have nine data centres in North America, nine in Europe, three in Asia, and one in Australia. Another two are planned in North America, one in Poland, India, Brazil, and South Africa.
KeyCDN boosts delivers your website quickly using a number of techniques.
Below is a list of features of general zone features (stolen from their features page):
- Create several zones
- Use your CNAMEs
- GZip compression
- Live tail on your logs
- Raw log forwarding in real time
- Custom expire headers
- Cross-Origin Resource Sharing (CORS)
- Force downloads
- Hotlink protection (restriction of HTTP referrer)
- Custom rules
- OCSP stapling
- SPDY 3.1
Content delivery networks use a combination of pull and push zone.
A pull zone will retrieve content from your website and create a static version of it. A push zone can be used to upload files directly. This is particularly useful if you want to host large files such as zip files, videos, etc, as it means that you can speed the delivery of these assets around the world.
KeyCDN pull zones boast the following features:
- Instantly purge zone caches or single URLs
- Cache query strings
- Override origin cache-control headers
- Override origin expire headers
- Strip cookies
- Enable canonical headers
- Custom request HTTP header field (X-Pull)
- Custom robots.txt
- Origin shield
Here are some features of a KeyCDN push zone:
- Upload content to your FTP account
- FTP subusers
- Synchronize content with rsync
- Enabled directory listing
- Enabled directory index
- No limit on file size
- HLS and HTTP streaming support
Do not be concerned if a lot of the features of a CDN goes over your head. It is very easy to set up a content delivery network and once you are familiar with the interface, most of the features listed above will make more sense.
How to Speed Up XenForo Forum
My original idea for this article was to write a tutorial that showed you the steps I took to speed up my Xenforo discussion forums using KeyCDN.
However, Brian Jackson recently published a fantastic tutorial entitled “How to Speed Up XenForo Forum” that explained the steps required in great detail.
The tutorial was so good that I used it myself in order to integrate KeyCDN with Rise Forums.
The first thing I did was sign up to KeyCDN. All you need to do is enter your email address and choose a username and password.
Once you have signed up you will be taken to the account overview page that shows that you have 25 GB of traffic remaining.
A confirmation email will also be sent. Click on the link in that email in order to activate your account.
At this stage, I referred back to the tutorial “How to Speed Up XenForo Forum” and followed all of the steps Brian advised.
The only step I had to complete in my KeyCDN account was to create a pull zone.
KeyCDN will then start pulling data from your website into the pull zone.
Next I had to add the following code to my next library/config.php file (using my own pull zone URLs):
$config['externalDataUrl'] = 'http://yourzone-ab12.kxcdn.com/data';
Finally, I had to navigate to the general settings area of my style’s properties under appearance and update the “Path to Images” location.
That is all I had to do. Brian does, however, offer several other optimisation tips to speed up an XenForo even more. I recommend implementing his suggestions.
Once you are up and running, you can check reports about your website. There are five reports available: Analytics, Geo Stats, Top Files, Real-time Logs, and Real-time Stats.
The analytics page is useful for seeing how traffic is going up and down over time. Geo stats will help you see where people are accessing your website and top files will show you the exact files people are downloading from your website e.g. a particular sprite or image file.
The real-time reports are also handy for seeing what is happening on your website at the current time.
Xenforo is an admittedly a hard piece of software to optimise due to the number of 3rd party http requests. Yet I have still seen a small improvement in speed from using KeyCDN. I would see a bigger leap in performance if I used KeyCDN with a WordPress website as more of the load can be transferred.
All in all, I am happy with how KeyCDN has performed over the last few days, however I am going to look into the issue more and try and tweak my forum further.
Please visit KeyCDN for more information about using their service. They offer 25 GB of data free of charge to help you trial their service so you have nothing to lose by trying them out. You will also be glad to hear that you do not need to enter your credit card details to get this free trial. All you have to do is create an account 🙂
I recommend checking them out.