0

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

0

1 Answer 1

3

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.

1
  • 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. Jan 30, 2013 at 17:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .