Viewing Story

Speed Up your WordPress website

Posted by on 30/06/2011


The information highway has blown up in the past 5 years, and blogs are the new way to go with regards to information dissemination. Traditional news outlets have switched to a more blog style, while blogs themselves are becoming the new media outlets. With that combination, WordPress has come out on top because of its superbly flexible blogging platform for independent installations. However, WordPress doesn’t build their software to be super optimized since they target the average blogger who may get a wide range of traffic.

WordPress bloggers who are looking to enter the high traffic arena need to consider a number of things when setting up their entire configuration so they could deal with the sudden onslaught of traffic from sites such as Reddit, Slashdot, Facebook and Twitter. Staying online during that high traffic period is key because people will easily head to other sites if they can’t access your data due to slow load times. Here are a number of tips to help you survive those hundreds of hits per second.

A Proper Server

As I have experienced, using a silly $70 shared server really won’t help you, because even after the promised of unlimited bandwidth and data storage, those shared hosts severely limit simultaneous connections to each hosted website. They are also notorious for using the WORST possible set-up to juice as much bandwidth out of a user’s account. If a user’s bandwidth activity is too high per month, the host could either temporarily or permanently suspend hosting accounts. To avoid such problems, the first step is to upgrade to AT LEAST a semi-dedicated solution such as Cloud Hosting, or even go full out with a Dedicated Server. There are a number of reputable cloud hosting sites including VPS.NET, Rackspace, Amazon Web Services and more. Dedicated hosting is also a good option, but more and more users are preferring the cloud due to the ability to quickly upscale/downscale to suit the traffic needs. At the end of the day, you should look at the server’s speed and RAM and how much resources are dedicated to you. You should aim for a server that dedicates all resources towards your site.

Optimized Server and HTTP Software

WordPress is PHP/SQL based, so you’d be looking for a server operating system that could run Apache or NGINX HTTP software. Unfortunately users are limited to MySQL or MSSQL, even though there are better database solutions such as NOSQL (but it would mean an entire rewrite of WordPress and its plugins). Assuming you are the majority of users who run Apache, it would be a good idea to invest in a bit of optimization software called Litespeed which reads Apache commands but replaces the Apache module itself, allowing for significantly more simultaneous connections. A big point to always remember is: How much users can my server handle at the same time?

NGINX is another HTTP handler, which can either be used as a proxy to Apache to dish out static content or can be used entirely for all HTTP requests. Personally, a WordPress installation with a properly configured NGINX set up is actually a better choice. Since NGINX is geared to serving a lot of static content, it is a good solution for WordPress since most users come to read content rather than making comments or interacting with the website. NGINX is free and doesn’t require a pain module like Apache/Litespeed to operating efficiently.

Databases can also be optimized, but it really depends on the user’s preferences of delivering content.

PHP and Disk Cache Accelerators

Most PHP accelerators work by caching the compiled bytecode of PHP scripts to avoid the overhead of parsing and compiling source code on each request (some or all of which may never even be executed). To further improve performance, the cached code is stored in shared memory and directly executed from there, minimizing the amount of slow disk reads and memory copying at runtime. There are also disc caching accelerators, but it depends on what modules are enabled in PHP. For instance, suPHP is not compatible with APC (Alternative PHP Cache) and memcached. WordPress users using suPHP are recommended to use dsc caching versus using a form of opcode cache. If you don’t use suPHP or are using something like FastCGI with your PHP, then you should definitely look at using opcode cache instead of disc caching. There are other forms of higher end caching accelerators such as Varnish and memcached, but those solutions SHOULD be used for distributed solutions where have more than one physical server located across the world.

Content Delivery Networks (CDN)

A CDN is really a very optimized server (most of them also using NGINX) used solely to output static data to the users in their geographic area. Companies such as MaxCDN, Akamai and Cloudflare offer a series of CDN services. Depending on your setup, they usually have a solution to help you out. The point of a CDN is to duplicate the static data on your server, so when users access your site, they are then forwarded to the closest CDN edge or peer server in their area, thus reducing ping time between their machines and reducing the load off your servers, since the bandwidth is pushed via the CDN server rather than from your server.

There is a way to run a CDN of your very own server, but in my opinion, it is rather pointless since the load is still focused on your server and it eliminates the ping and bandwidth advantage experience with real CDNs. For instance MaxCDN has a multitude of servers across the United States and Europe, as well as a few in Asia and Oceania.

The Caching Plugin – W3 Total Cache

When I say THE cache plugin, I mean there is no other plugin which matches in terms of efficiency and competency like W3 Total Cache. This plugin makes handling server optimization VERY easy. Let’s go through the features of the program.

Page Caching can either by done via Disk or Opcode caching, which reduces the access time to the website, mainly because the processes are handled in memory rather than having commands pulled from the disk and executed. W3 has options for Disc, APC, XCache, eAccelerator, WinCache and memcached; but it depends on your server’s capabilities and setup. The Minify function compresses JavaScript and CSS files by reducing unnecessary breaks and white spaces, which makes it smaller in size and allowing for faster transfer to the PC. While the savings may be very small, milliseconds determine which sites people consider fast or slow. Database and Object caching also helps reduce server response time by caching static content, thus reducing overall load time. CDN support is also available for a number of services such as Amazon AWS, Rackspace Cloud and MaxCDN. It is possible though to set up any CDN once you get the required data (honestly not a hard process).

Other tips

Users should use YSlow to analyze their sites to see where further optimization may be needed. It shows you which images can be compress, which JS and CSS scripts could be minified and what other files could be hosted via a CDN. While it may not be the best tool to gain super speed, it helps optimize your site in many minor areas.


This article really is a scrape on the optimization surface, so if you are interested in optimizing your WordPress website, you should do more research into each area and see what could be done to improve your site. A lot of the recommendations here also apply to non-Wordpress sites, so just do a bit of reading and hopefully your site will load super fast like the big boys without much cost.

    More in Computing, Featured, Policies/Ethics (19 of 70 articles)