Do red ones go faster?
December 11, 2008 11:03 AM   Subscribe

What is the best way to split up my Wordpress installation to make it lightning fast?

I have a wordpress installation that I want to make as fast as possible. I am already using the WP Super Cache plugin, and it's working well enough; I just want to see how far I can push things.

I have the basic Slicehost slice and an account with Dathorn to divy things (the php, the mysql database, and the site's images) between. What's the optimal distribution? Also, I would be willing to ditch Dathorn for another host if, for example, a basic A Small Orange or Media Temple account is super fast for loading images or whatever.
posted by Number Used Once to Computers & Internet (11 answers total) 5 users marked this as a favorite
 
Best answer: You want to look into a host that offers CDN specifically for your images (or flash or etc.).
posted by shownomercy at 12:07 PM on December 11, 2008


Response by poster: Could you provide some specific examples of hosts that do this for prices a regular ol' person could afford?
posted by Number Used Once at 3:55 PM on December 11, 2008


Response by poster: And that's not really what the question was about. Surely there is someone with load balancing experience/information/anecdotes who can weigh in on what I've asked?
posted by Number Used Once at 3:57 PM on December 11, 2008


You didn't ask about load balancing, you asked about splitting up your installation to make it as fast as possible. A CDN is splitting up the images from your installation to make it as fast as possible.

What is it exactly you would like to know? Your post is pretty vague and generalized.
posted by Jairus at 4:20 PM on December 11, 2008


Best answer: Putting images (and other static files, CSS and javascript for example) on a separate server has 2 advantages: 1st, there will be less load on the main server, meaning that if you're in the position of needing to serve multiple visitors simultaneously, there will be fewer HTTP requests to deal with. 2nd, web browsers (by default) will only request 2 things from the same domain at the same time (in parallel), by hosting things on a separate domain (which a separate server would have to be) the browser will be fetching more things simultaneously and (providing the user has sufficient bandwidth) the site will load faster. You could also set up a separate domain pointing at the same server, but that wouldn't lessen the load. The difference to a low traffic site though will be pretty small.

If you're looking for other optimisation techniques, then installing APC and setting up apache to serve gzipped JS and CSS (mod_gzip/mod_deflate) will probably be the best effort->improvement things you can do.

Amazon have recently started offering CDN services (Cloudfront) to go with S3, that basically mean visitors to your site will be served static assets (images/css/js/whatever) from a server that's close to them, making things faster, and with S3 you only pay for what you use, so can work out really cheap.

Your next step should be to find out where your bottlenecks actually are (CPU/IO/Network) and then optimise accordingly. Upgrading hardware will almost certainly be the easiest fix, multiple servers is what you do when they don't make computers with more resources than you have.
posted by gregjones at 4:42 PM on December 11, 2008


Best answer: Serve your images and other static assets (css, etc) on a different IP. Most browsers only open a couple of connections to the same IP, so the browser may end up waiting to load images until your whole page and CSS files have loaded. You could probably do this on your slice. If you do, consider running an entirely separate webserver (preferably something lightweight like nginx) so that the memory Apache allocates for PHP isn't tied up for no reason while serving static files.

Actually serving up static files is a really easy task, unless the server is totally overloaded, it is more a matter of network speed and latency. Any decent webhost should be able to do a good job at this, but CDN can go even further. They have geographically dispersed servers, so people tend to access servers that are physically close to them, which helps a lot with network latency. Plus, they have nice fat connections to the internet.

I haven't tried it, but Amazon just announced CloudFront, a CDN to compliment their other web services offerings. The really nice thing about it is that its pay as you go, with, no minimums (well, they bill by the gigabyte, so you might end up paying $1/month even if your traffic is a trickle).

You can try breaking your webserver and your db server onto separate machines. It makes absolutely no sense to split those functions between different hosting companies. You are going to want them in the same data center with a fast connection between them.

Before you go down that route though, you should make sure you are making the most of your existing slice. To do so, you can take a copy of a couple of days of log files and feed them into a tool like seige or jmeter to really hammer your site, then get in their and run top. What's using your CPU, what's using your memory? What is the ratio between the CPU going to Apache (or whatever you are using to run the PHP) and all of the mySQL worker processes? Do you have free memory? How much cache is available? Is the machine spending a significant amount of CPU time waiting for I/O?

You may not be able to saturate your server over the internet from your home connection, but it should be enough to get you a baseline.

Once you have that, you can start figuring out what you can tweak. Maybe you can tell mySQL to use more memory to cut on disk access. Maybe you can tell apache to use more workers to make better use of the available CPU. Maybe you have to cut down the number of apache workers to free memory for mySQL and avoid swapping.

Once you have a handle on how to balance things, you can decide what's next. It might be enough just to upgrade your slice to get more memory and CPU time, or you might want to break things out so you have multiple webserver slice and a database server slice.
posted by Good Brain at 4:52 PM on December 11, 2008


Response by poster:
You didn't ask about load balancing, you asked about splitting up your installation to make it as fast as possible. A CDN is splitting up the images from your installation to make it as fast as possible.

What is it exactly you would like to know? Your post is pretty vague and generalized.


Fair enough. I apologize for the tone of my response. That said, specifying an affordable CDN or two would have been a huge step in being helpful. When I initially googled CDNs, I got results like Akamai which were clearly inappropriate for a guy messing around with a website. I've since come across others, including CloudFront which the other posters mentioned. Your information was correct, but I needed a little more handholding for it to be useful.

This was very helpful:

You can try breaking your webserver and your db server onto separate machines. It makes absolutely no sense to split those functions between different hosting companies. You are going to want them in the same data center with a fast connection between them.

I had thought something different.

also this:

If you're looking for other optimisation techniques, then installing APC and setting up apache to serve gzipped JS and CSS (mod_gzip/mod_deflate) will probably be the best effort->improvement things you can do.
posted by Number Used Once at 5:43 PM on December 11, 2008


OP, consider changing your username

definition
posted by Not Supplied at 1:47 AM on December 12, 2008


Response by poster: silly UKians.
posted by Number Used Once at 9:38 AM on December 12, 2008


Best answer: Tune MySQL properly.
Install a PHP accelerator like APC.
Keep using WP Super Cache.
Tune your webserver properly.
Stick a reverse proxy like Varnish in front of your webserver.

Varnish is a necessity if you're using prefork apache with mod_php. By itself that's just wasteful. I imagine it will make a smaller difference with a webserver like lighttpd or nginx and php via fastcgi.
posted by PueExMachina at 4:47 PM on December 12, 2008


Response by poster: PueExMachina, do you have know of any tutorials on tuning a MySQL install that are online you could link to? Something at a much lower level of technical detail than that particular book? Again, I'm just a guy messing around with a site, and don't have an urge to become an expert. I'm after the low hanging fruit, not all the fruit.

Thanks for linking to Varnish, btw. It's been engaging reading up about it. ESI is cool.
posted by Number Used Once at 9:28 PM on December 13, 2008


« Older Is our money system broken?   |   Yuletide Christmas bagels Newer »
This thread is closed to new comments.