Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a client with a popular Wordpress blog that experiences occasional short-term traffic spikes (when the site is promoted on national TV). The blog is already hosted on an Amazon EC2 instance, and we're exploring using Amazon's load balancer to help with the spikes.

Two general "big picture" questions about this:

  1. To set this up, would I just create a machine image (AMI) from the existing server, and then duplicate it into a new instance, and tell the load balancer to split the traffic between the two instances? (Or more than two, I suppose...)

  2. When my client needs to edit the content on the blog, it seems like I would need a way to point them to one particular "master" instance so they could use the WordPress admin tool on that server, and then copy (rsync) the content from that instance to the other instances, so everyone has the same data. Is this the right approach?

Any other tips/suggestions would be much appreciated. I'm new to Amazon's load balancer so I'm just trying to wrap my head around the big picture before I dive into specifics.

UPDATE: some static content lives on Amazon CloudFront CDN. I wasn't familiar with APC but I'm looking into it now (thank you). WP-SuperCache is next on the list to implement. I believe the database is on a separate server instance.

Thank you, Eric

share|improve this question
1  
A few questions for you: What optimizations have you already performed? CDN for static content? APC (or another opcode cache)? WP-SuperCache plugin? Are you using RDS or a self-hosted db for this? Please edit your answer with answers to these questions. –  EEAA Jan 30 '13 at 4:03
    
Updated, thank you. –  Eric Jan 30 '13 at 4:08

1 Answer 1

up vote 3 down vote accepted

Since you have not yet installed WP Super Cache, that really ought to be your first step. It's quite simple to install, and can lend some drastic improvements when under load. This plugin is capable of generating static html versions of your pages automatically, and serving them to visitors instead of needing to spin up PHP with each hit to generate each page dynamically.

If that doesn't give you enough of a performance boost, then it may be time to think about load balancing. The basic architecture of a standard load balanced stack is something like:

    ---WP APP SERVER\
   /                 \
  /                   \
LB-----WP APP SERVER-----DB Server
  \                   /
   \                 /
    ---WP APP SERVER/

I'm not familiar enough with Wordpress to know how well it handles being load balanced, though. For things to work correctly, each app server must not store any state (sessions, etc.) locally, but rather, it must use the database server for everything. This way, clients can get directed to any one of the three backend servers without, say, getting kicked out of their logged-in wordpress session.

Before you get into implementing a load balanced infrastructure, though, you really need to profile your server and see what bottlenecks it's hitting. Perhaps the bottleneck is actually in the database server. Perhaps you're seeing exceptionally high iowait. Perhaps you're exhausting available RAM and forcing the kernel to dive into swap. Who knows. Any of these could degrade performance significantly, and any of them could be remedied fairly easily by resizing your EC2 instance.

share|improve this answer
    
Definitely look into caching on WordPress (WP Super Cache or W3TotalCache), as these are going to offer you the biggest bang for your buck. APC will speed up when you actually do hit PHP vs a cached page too. –  Jason Floyd Jan 30 '13 at 17:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.