Epic WordPress Setup

Towards the end of last month, John from TentBlogger unveiled his “Ultimate WordPress Blog Hosting Setup“. I liked the idea, and accepted it as a challenge to be faster, so I figured I’d share mine. My setup usually stays constant, but I’m constantly trying to make things faster so this could all change at any moment. I have a test environment in place, but I usually test on the live site.

The majority of my properties run on Amazon EC2. I do have a DreamHost account though, and I’d recommend them for anyone looking for a hosting company. I’ve been nothing but satisfied since signing up two years ago.

My EC2 instances are all Micro instances running a mix of Ubuntu 10.10 and 11.04 with LighttpdPercona/MySQLPHPAPC, and Memcached with PHP-Memcache (LLPP instead of LAMP or anything else).

Content Delivery is done with CloudFront using an S3 bucket as the origin. In the previous post, I talk about why I chose to do this versus using a custom origin.

DNS is managed through Amazon Route 53 for the EC2 sites, and DreamHost for the DreamHost sites. DNS is a big deal to me.I’m super impatient, so I hate waiting for changes to propagate. With Route53, my propagation time is usually no more than 5 minutes…and if it’s more, I just edit my HOST file to keep working.

Lighttpd, my web server of choice, is a super light weight web server. It’s used on some of the web’s largest websites such as Youtube, Wikipedia, and at one time, Twitter. It’s simple to configure and super easy to maintain. I chose it based on its efficient use of CPU/RAM as well as its built in modules. It’s open source, too!

Percona is the most carefully maintained, independent fork of MySQL, and its benchmark tests show it significantly faster (those here). It’s a drop in replacement, meaning it appears to be MySQL (you access it the same way, login the same way, and yes, tools like PHPMyAdmin work with it). You have to uninstall MySQL before using it, then install Percona after. You can compare Percona vs. MySQL feature sets here (HINT: Percona is better!). I’m currently running version 5.1. As soon as 5.5 comes out of RC stage, I’ll be upgrading as it’s even faster. Database speed is important – WordPress relies heavily on it.

PHP, APC, and Memcached aren’t special. PHP is running as CGI. APC is standard. I keep Memcached installed in case I want to use it (usually for DB/Object caching). When I do, it uses a second EC2 instance for load balance/fault tolerance. I prefer APC as I’ve seen better performance over time (I think most people have).

I do have some level of redundancy built in. I have a second EC2 instance in a different region. The databases are setup as Master/Slave with near instant replication when the master makes a change. In case I log into the secondary server (because of Round-Robin DNS), I’m leveraging HyperDB to tell WordPress to read from the local copy (slave), but to write to the master. That keeps load times down on the front end.

Global Site Load Balancing = EPIC

I’d love to use a global load balancer to route traffic to the closest server. Right now, it doesn’t make sense since Amazon only has an east and west region with no central region to balance it out.

Eventually I’d love to see Amazon allow you to use their load balancer across multiple regions (they currently allows cross-Availability-Zone load balancing), assign it an IP address to use with Route 53, and provide the ability to load balance based on location and load rather than just load.

In all, I think it’s a pretty awesome setup. It’s definitely not typical, but it’s a heck of a lot faster than LAMP. My load times are between 2 – 3.5 seconds (3.5 being almost too slow in my opinion). You can see a recent load test here.

To recap:

Servers: EC2

Hosting Company: DreamHost (only for some projects – An Altered Reality is powered by EC2)

OS: Ubuntu Linux 10.10/11.04 Server (CLI Only)

DNS: Route 53/DreamHost

Software: Lighttpd, Percona, MySQLPHP, APC, and Memcached with PHP-Memcache

Content Delivery: Amazon CloudFront via Amazon S3

All of this used to be free…but now it’s costing around $5-$10 a month.

If you have any questions or comments, let me know below!

2 Responses to “Epic WordPress Setup”

  1. Joshua Chase May 6, 2011 at 7:29 am #

    Do you leverage a CDN and W3 with your wordpress sites or do you just use memcache?

    I’ve been doing some testing between MAXcdn / W3, and just using WP SUper cache, as well as browser and mem caching. Cost / Time differences seems about same. I don’t know though, jury is still out. Was curious if you have an opinion and which CDN you prefer?

    Cheers,
    Josh

    • Kev May 8, 2011 at 12:56 am #

      Yes…Definitely. I’m using W3TC (WP Super Cache works best with Apache…and I don’t like/use Apache) and CloudFront…I had better results at one time with RackSpace though (even though I don’t like their user console). I just used CloudFront because the S3 storage is free…

      I think that combining a CDN and W3 definitely effects performance and it can go both ways, but at times it’s measuring fractions of seconds…I’ve never seen massive leaps (either way) in load time though…

      Eventually I think everything loops back to hardware…you gotta have good stuff under the hood to make any of the caching/CDN usage worth it.

Leave a Reply:

Gravatar Image