Nov 9, 2011

Optimizing a high traffic and image heavy WordPress site

INAP

With over 1.4 million visitors (and 3.2 million page views each month), chinaSMACK aims to give Western netizens an often neglected and overlooked view of modern Chinese society by translating Chinese-language internet articles, posts and content into English.  Despite having only a handful of contributors all working part-time, chinaSMACK has garnered mentions from major mainstream media including the New York Times, China Daily, Washington Post, Economist, New Yorker, BBC and CNN – just to name a few.

A few months ago, chinaSMACK came to Voxel looking for a backend infrastructure upgrade so they could keep up with their growing traffic.  Find below a Q&A with Thomas, chinaSMACK’s Sys Admin, on what he’s done with chinaSMACK’s WordPress site to keep it up and running at peak performance – without significant resource drain.

1) Can you describe the original hosting setup and why you were looking for a new provider?
We used to be hosted at a tiny VPS provider.  They didn’t cap our bandwidth, which was great.  They also couldn’t keep their SAN working, which was less great.
2) And what does your hosting setup look like now?
We’re running the site on a single VoxCLOUD VPS and all our static hosting [images, CSS, etc.] has been off-loaded onto VoxCAST CDN, Voxel’s Content Delivery Network.

Our backups are handled by Voxel’s built-in backup agent which continuously backups our MySQL database, something we can’t afford to lose.

On top of that, an open source monitoring package called Munin handles our performance metrics on the VPS,   generating pretty graphs and ensuring that we know if our tweaks are actually improving things!

3) Can you share some of the pretty graphs you’re using to give us a snapshot of what you’re monitoring?

Optimizing a High Traffic and Image Heavy WordPress Site

Optimizing a High Traffic and Image Heavy WordPress Site

4) So what have you done to make WordPress scale so efficiently?
The only way to scale WordPress efficiently is not to scale WordPress 🙂

Almost all our page views are cached so WordPress never has to worry about processing them.  We run a pool of PHP workers using PHP-FPM.  Our webserver, nginx, sits in front of that pool and has its own built-in page cache.

Rather than cache each page for a few minutes at a time, we use a WordPress module to invalidate the cached pages when they change.  This keeps the WordPress processing to a minimum.
5) Can you dig a little deeper into your caching set-up?
Sure.  We’re using a custom build of nginx that includes a page cache invalidating module.

Every content page is cached for up to 36 hours or until an action [a comment or an amendment] invalidates it.  Nginx Manager pushes all invalidations into nginx from WordPress.

I’ve experimented with more “sophisticated” mid-tier caching tools using the APC object cache, but I found that they sucked up a lot of memory with only a minuscule performance gain.  The cache invalidation wasn’t always reliable either.

I found that relying on a decent sized MySQL query cache (which is essential for running WordPress anyway) was just as fast and much more reliable.

If we were a forum site or a Facebook game, page caching probably wouldn’t be enough but it works for what we are.  As with everything in tech, Y.M.M.V, K.I.S.S. (Your Mileage May Vary, Keep it Simple Stupid) 🙂
6) What other optimizations and tuning have you done to the chinaSMACK website?
Besides investing heavily in server-side page caching, most of our efforts after the initial push have been focused on the client-side.  Removing JavaScript libraries and minifying CSS has had a big impact on load times and bandwidth requirements.

Most of the future changes will also focus on the client-side.  However, since a lot of our readers have high network latency, we’re also considering tuning our TCP/IP settings.
7)  What WordPress plugins are you using?
We use a lot of plugins for everything from image handling to spam filtering.  Other areas we depend on plugins for include: spam filtering, web optimization, comment and content management, redirection, mobile, mail and syndication.

8) How are you using the VoxCAST CDN to handle traffic from a world-wide audience?
We found VoxCAST CDN to be incredibly easy to set up using the CDN Rewrites module, so currently all of our static content [CSS, JavaScript & images] is hosted on VoxCAST.

Since we have a global readership, utilizing a content delivery network is very important to us.  It means that 90%+ of each page load is handled by a server on the same landmass as the reader – which really reduces load times.  Anyone who’s browsed a Japanese website from Europe knows how big a difference this can makes!

Nginx can serve tens of thousands of cached page hits per second.  With VoxCAST CDN (whose capacity is essentially infinite) hosting all our content except the HTML, the chinaSMACK website can easily handle being featured on CNN or the BBC (and the huge spike of traffic that would entail).  That wasn’t a possibility before.

9) What is the greatest change you’ve seen since signing up with Voxel?
The most important change we’ve seen is reliability.  Voxel simply hasn’t gone down.  Our old provider was a constant worry, but now I don’t even think about downtime.  Everything just works.

Explore HorizonIQ
Bare Metal

LEARN MORE

About Author

INAP

Read More