← Back to Blog Home

  •  Tuesday, October 9, 2012   
  •   Comments

WordPress has fast become the goto open source Blogging/CMS platform on the web. It brings simplicity & functionality to the end user, but still needs a fair amount of tweaking to perform fast. Chances are if you’re reading this guide then you’re semi-interested in finding out how you can improve the performance of your WordPress install.

In this guide we’re going to take you step by step through setting up a brand new server with a WordPress install from scratch, this includes all the server optimization & WordPress plugins. We’ve split the guide up into parts that you can see in the tabs below.


We are not recommending WordPress hosts in this post, however we are giving you the smarts you need to make a calculated decision on your own. Be wary of websites that flat out recommend hosts (most likely they are getting paid for it).

Getting Used to the Command Line

In this guide everything we do will be on the Linux command line, if you’re used to control panels (like CPanel or DirectAdmin) then this may seem a little daunting at first. But trust me, ditching the control panel will do wonders for your performance & also your general knowledge of the Linux operating system.

You will need to SSH into your server, if you’re using Windows then you can use PuttY or fire up Terminal in OSX.

ssh root@ipaddress

When you SSH to the server you’ll be asked for the password, this is normally supplied upon signup. We’ll be doing some things in the next part of the guide to secure your install a bit better.

WordPress Server Selection – A Vital Component

The server that you host your WordPress install on will primarily determine the performance you can expect. Since we specialise in performance testing web hosting plans ServerBear is well positioned to ensure you choose the right plan for your needs.

Shared Hosting

If you know nothing about servers then it’s quite possible that you’ve signed up for shared hosting with a popular provider. Sometimes they will give you automated scripts to setup WordPress. If this is you, then I suggest you skip directly to the WordPress Optimisation section of the guide.

Shared hosting is not the ideal environment for WordPress installs, you are theoretically sharing a server with hundreds of other users & your performance could be impacted by users abusing resources. You also end up paying more per month simply because you’re using a control panel like CPanel.

WordPress Specific Hosts

There’s a number of WordPress specific web hosts out there that take the server management side away & purely host your WordPress installation. If you know nothing about servers, Linux or perhaps don’t want to learn then this can help reduce a lot of headaches. It will also be more expensive.

A few hosts worth taking a look at: WPEngine, Page.ly & Zippykid plus many more.


You will get much more bang for buck installing WordPress on a VPS, you get more access to dedicated resources, there will be less users on the node (therefore less chance your performance might suffer) plus you’ll also get access to the command shell via SSH.

You will need to determine a few things when choosing a VPS:

  • Location: Location is important, regardless of how tuned your server or WordPress install is there’s always latency to the server location. If your target audience is Europe then having a VPS on the west coast of the USA isn’t a great idea.

Most hosts have test IP addresses that you can use to test the latency:

ping speedtest.fremont.linode.com
PING speedtest.fremont.linode.com ( 56 data bytes
64 bytes from icmp_seq=0 ttl=50 time=191.177 ms
64 bytes from icmp_seq=1 ttl=50 time=190.511 ms
64 bytes from icmp_seq=2 ttl=50 time=190.260 ms
64 bytes from icmp_seq=3 ttl=50 time=189.566 ms
64 bytes from icmp_seq=4 ttl=50 time=191.432 ms
64 bytes from icmp_seq=5 ttl=50 time=191.743 ms

We’re in Australia so under 200ms is a reasonable ping to serve users here but also in the USA.

ping speedtest.london.linode.com
PING speedtest.london.linode.com ( 56 data bytes
64 bytes from icmp_seq=0 ttl=42 time=497.736 ms
64 bytes from icmp_seq=1 ttl=42 time=419.629 ms
64 bytes from icmp_seq=2 ttl=42 time=338.987 ms
64 bytes from icmp_seq=3 ttl=42 time=566.453 ms
64 bytes from icmp_seq=4 ttl=42 time=487.351 ms
64 bytes from icmp_seq=5 ttl=42 time=317.471 ms

The ping to London however is almost half a second, which really makes the website feel unresponsive (it would be fast if our target market was Europe though).

  • RAM: You’ll want 256MB or more for WordPress, preferably 512MB if you can afford it. Control Panels & other unnecessary services (like SpamAssassin) use up unnecessary memory so we can actually get away with using a lot less than normal.

A good way to check how much RAM is being used on your server is using the command free -m

             total       used       free     shared    buffers     cached
Mem:           491        177        313          0         35         77
-/+ buffers/cache:         65        426
Swap:          511          3        508

One thing to remember is that Linux borrows unused memory for disk caching, so sometimes looking at the output of free -m can make it seem like you have no RAM left. Just make sure you look at the free RAM on the -/+ buffers/cache line (as I’ve bolded above).

  • Disk Space: WordPress doesn’t use a particularly large amount of disk space, but depending on what you’re using it for the amount you need will vary accordingly (i.e. if you’re hosting an Image Blog then you may need more HDD).

If you want to check your Disk Space then a good command to use is df -h

Filesystem                Size  Used Avail Use% Mounted on
/dev/mapper/scout14-root  9.3G  1.3G  7.5G  15% /
udev                      237M  4.0K  237M   1% /dev
tmpfs                      99M  260K   99M   1% /run
none                      5.0M     0  5.0M   0% /run/lock
none                      246M     0  246M   0% /run/shm
/dev/vda1                 228M   25M  192M  12% /boot

Above we can see that the basic Ubuntu 12.04LTS install is using about 15% of the total disk space on the VPS (about 1.3GB).

  • Bandwidth: Bandwidth used will depend on the popularity of your site & also the type of content (hosting MP3 files for download will result in higher bandwidth needs. Most hosts have a generous allocation of bandwidth (100GB+ per month).

The rate at which you might use your bandwidth will be determined by the network performance & port speed of the host you’ve selected. If you want a quick indication of speed you can run wget http://cachefly.cachefly.net/100mb.test

Resolving cachefly.cachefly.net (cachefly.cachefly.net)...
Connecting to cachefly.cachefly.net (cachefly.cachefly.net)||:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 104857600 (100M) [application/octet-stream]
Saving to: `100mb.test'

100%[======================================================================>] 104,857,600 12.7M/s   in 8.0s    

2012-10-06 06:40:48 (12.4 MB/s) - `100mb.test' saved [104857600/104857600]

If you’re seeing speeds of ~10 MB/s then your host has a 100Mbit port speed, speeds of 100 MB/s then the host has a 1Gbit port. Naturally one can saturate your bandwidth 10x faster than the other :)

  • Server Performance (UnixBench): UnixBench is the system performance metric we use when benchmarking servers. This is a general indication of overall system performance. A typical VPS will score anywhere from 300 – 3,000 depending on virtualization, number of allocated CPU cores or Disk IO.

If you want to see how your own VPS performs then you can use ServerBear to run a quick benchmark on your system. If your host doesn’t exist you can click “add” when you type in the name or the plan name.

Benchmark Your Server

  • Server Performance (Disk IO): Disk IO is another important server performance factor. Better disk IO will help in a number of ways but for WordPress specifically you’ll notice that your pages cache & serve much faster. A low Disk IO also indicates that perhaps your hosting node is overloaded & you’ll feel the performance hit when this happens.

We can do a quick test on Disk IO using the dd command, this tests sequential writes which isn’t the absolute best way to test Disk IO but it’s a good way to get an early indication of performance. We’re going to test with two commands, firstly we’ll do 1.1GB of sequential writes, then 4.3GB (just to make sure it’s not getting served from RAM).

dd if=/dev/zero of=sb-io-test bs=64k count=16k conv=fdatasync;rm sb-io-test

root@serverbear:~# dd if=/dev/zero of=sb-io-test bs=64k count=16k conv=fdatasync
16384+0 records in
16384+0 records out
1073741824 bytes (1.1 GB) copied, 1.123 s, 956 MB/s

dd if=/dev/zero of=sb-io-test bs=64k count=64k conv=fdatasync;rm sb-io-test

root@serverbear:~# dd if=/dev/zero of=sb-io-test bs=64k count=64k conv=fdatasync
65536+0 records in
65536+0 records out
4294967296 bytes (4.3 GB) copied, 4.35743 s, 986 MB/s

You’ll notice fairly high scores for these tests, the particular server we’re using for this tutorial is the WSWD SSD VPS 1 which achieves extremely high Disk IO scores & also maintains them with larger file sizes.

For WordPress in particular anything over 70 MB/s should be enough (and anything less should be a worry), but it’s up to you if you want to make the trade off with HDD space to go for an SSD based VPS.

  • Server Performance (Network Performance): Network performance is often overlooked & we touched on it already at the beginning of this post. Obviously if you can get a host with 1Gbit port speeds then that’s ideal but you also want an indication of what speeds you’ll get around the globe. We cover this element off in our benchmarking test by showing you downloads from the following locations:
Cachefly	                 27.4 MB/s
Linode, Atlanta, GA, USA         5.40 MB/s
Linode, Dallas, TX, USA	         13.5 MB/s
Linode, Tokyo, JP	         8.24 MB/s
Linode, London, UK	         1.64 MB/s
OVH, Paris, France	         5.19 MB/s
SmartDC, Rotterdam, Netherlands	 6.59 MB/s
Hetzner, Nuremberg, Germany	 8.82 MB/s
iiNet, Perth, WA, Australia	 5.05 MB/s
Leaseweb, Haarlem, NL, USA	 9.06 MB/s
Softlayer, Singapore	         5.75 MB/s
Softlayer, Seattle, WA, USA	 34.6 MB/s
Softlayer, San Jose, CA, USA	 17.2 MB/s
Softlayer, Washington, DC, USA	 12.2 MB/s

This post should have given you a good idea on how to run some tests on your current host & use that data to find a host that improves performance & meets your requirements more adequately.

Remember that ServerBear has over 1,300+ benchmarks of web hosts for you to compare your performance against. A few good places to start for WordPress are: VPS Benchmarks, SSD VPS Benchmarks & Cheap VPS Plans (Under $12).

WordPress Server Setup