wordpress-logo

How To Scale WordPress

Today I have an interesting post I would like to share with all our readers, those especially running their own sites running WordPress. Many blogs out there use the most common Content Management Software (CMS) WordPress as their platform. I remember my first time using WordPress instead of creating static files in Dream Weaver, it was like magic. And while the magic has subsided and currently we use WordPress for this very site, there are tricks that you should know about if you have plans to scale your blog.

While I’ll admit, Leviathyn does not run an out of the box install of WordPress (it has been somewhat modified to scale), there are some simple steps we took to help scale WordPress without custom coding and installing services on our severs.  I’m not here to talk about our special service, that’s for another day, today, I want to go over some external services and providers to speed up your WordPress blog.

 

Security

First on my list is using an extra layer for DNS and caching called CloudFlare. CloudFlare caches content on our network and helps a visitor download this content before accessing the site. This will usually help out in some javascripts and CSS files. I really like CloudFlare though for its security measures. CloudFlare has a few tools that will stop malicious visitors and bots before they can even land on your site. If you don’t feel like using CloudFlare for its caching skill, I would recommend using it for this.

One thing we here do not use is the Rocket Loader and for a few reasons. This will cache everything on your site, which will  make WordPress not work, especially if you have comments, widgets that update, the WP-Cron task that runs in the background, and the most important, ads. It will cache external javascripts, which is a no no for serving ads. But besides disabling Rocket Loader, the rest should be enabled. One of the best things about CloudFlare is it’s free. You can try it out today at no cost.

Caching

And while I said you can use CloudFlare for caching files from your site, I seriously recommend using a more stable, although not free CDN (Content Delivery Service) like MaxCDN. So the entire job of a CDN is like an external hard drive, it downloads all your images and CSS/JS files into its network, which can be up to 100s of servers through the world. Then, when you visit a site that uses a CDN, only the website page (html) is downloaded from the webserver, the rest (images, videos, CSS, JS) will be downloaded from the closest CDN server in your area.

Example, I live near Philadelphia, our Leviathyn HQ is in the same building, but when I access the site, only the html page comes from the servers here, the images and CSS files will download from NY. This does a few things, speeds up the site for foreign visitors and reduces the load on your server. This is especially a great idea if you’re using a shared hosting plan, because you are limited on your resources and bandwidth (don’t be fooled by unlimited plans).

Let’s say were located in the UK and visiting this site, again, the html page will download from our server but the images and CSS/JS files will download from London, speeding up the wait time for the site to load. Pretty cool huh? This is a huge saver on your shared server, because if you didn’t know, every image on a page you load, every JS and CSS file called in the HTML has to be loaded independently. So you’re not visiting a server once, you may ask for 40 items every time you visit a webpage. And that is 40 sessions a web server has to hand out, not one per visitor.

But by using a CDN, you limit those requests down from say 40 to 2. Now your site can handle an additional 38 requests it couldn’t before! I seriously recommend using MaxCDN, it was basically built for WordPress and you can have it up and running in about 5 minutes. It runs about 39 bucks for the first year and comes with 1TB of bandwidth. They have plenty of locations around the world so your visitors will get the quickest response when visiting your blog. We use to have 3 dedicated servers running Leviathyn, when we started using MaxCDN, it dropped to 1.

Comments

oh boy, another spammer. If you run a WordPress blog, it becomes normal to see spam and pingbacks to places you rather not visit. Comments are one of the best feedback loops you can have when running a blog, but it can quickly become a nightmare to maintain. If you run the comments from WordPress right out of the box, you’ll probably end up spending more time monitoring comments then writing. But there are some good tools and service to help you curb that. The following services can help you cut down on the spam and also speed up your site:

Disqus – We used Disqus first, there are a few options different than Livefyre. They allow visitors to either create a Disqus account or use an array of other services like Facebook and Google to login and post. They host your comments, which means no hosting on your behalf, freeing up your MySQL tables (and CPU/Memory limits on shared plans).

Livefyre – Our second service we used after Disqus. Again, they offer pretty much the same services as Disqus, although here they do not host your comments, so you’ll see them in your Comments section in WordPress. We switched to Livefyre because most gaming sites were switching, which would help our audience be familiar with the service.

FaceBook Comments – You can really weed out the spam comments by using Facebook’s Comment service. We never used it because it does have its draw backs, the biggest being all visitors would have to use their FaceBook account to leave comments, leaving many visitors silent. It can work for certain sites where privacy isn’t an issue but make sure you know your audience.

Next part I’ll dive into internal plugins and code that can shed seconds off your response time. Until then, cheers.