My wordpress blog keeps getting killed
I'm running Ubuntu 8 LTS, apache2, mysql, and wordpress. What should I do to improve my site?
7 Replies
Coral cache
Of course, using this without any work on your part means convincing people to use the Coralized URL when submitting your pages to Digg or whatever. As an alternative, see the section "Coralizing certain referrer sites" at
1.) Install wp-super-cache: this caches full pages and it's ideal for situations where you're getting a ton of visits to only a small number of pages. When you serve a page, most of the time php code won't even be executed meaning you don't have to worry about php object caches or tweaking mysql.
2.) Serve all your static content (images, css, js) from a lightweight web server like nginx. This isn't really "faster" than apache, but it does use a whole lot less memory so you can serve way more visitors.
Implement those two changes and you should be able to handle reddit level traffic on even a linode 360.
@Vance:
Another option is to use the
. Coral cache
A small advisory: Coral Cache is filtered by default by a lot of Web censorship gear. I know WebSense does for a fact.
(They had to work around kids typing myspace.com.nyud.net.)
My very first suggestion is to install munin so you have trending on load and resource usage during good times and bad.
My next suggestion is to install the php-apc package. This saves PHP the problem of reparsing all the wordpress code files for each new request. In my testing, this easily cuts the per-page response time in half on an unloaded Wordpress site with a handful of plugins, and, as I recall roughly doubled throughput under load. The cost is some memory for the cached code, but for Wordpress, I think that is only 10-15MB, and it is shared across all the apache processes.
Once you have some data in munin you'll be better able to figure out where you should focus next. I'd guess though that under high load you end up with more apache processes than are really useful given the amount of memory you have on hand. Evidence of this would be less than full CPU utilization during traffic spikes, little or no "free" memory allocated to file cache or buffers, and a big jump in the use of swap space.
Next, I'd turn of HTTP keep-alives in apache, or reduce them a few 10s of miliseconds, otherwise, apache processes end up sitting around wasting memory waiting to see if a client is going to make another request.
Something like wp-super-cache can help, but I found that it resulted in odd behavior. The quirks would be acceptable during periods of high load, but I think you'd have to turn it on and off manually. I wouldn't mess with Coral cache, unless it was for a big file or something. Its a cool idea, but if you use it, you loose SEO benefits of being linked to, data about your users, etc.
As others have suggested, its worth using nginx or something similarly efficient to serve static content. I'd go even further and say its useful to have it reverse proxy dynamic content. Doing so means apache can move quickly on to serving the next dynamic request, rather than wasting memory for ~100-300ms waiting to return the output of the php script to the client. Nginx can also take care of the http keep-alives efficiently. I posted information about configuring nginx to front-end for apache+php+wordpress in this thread:
2) If you're not using InnoDB tables turn in skip-innodb for MySQL. That saves about 5%-10% of memory on a Linode 360.
-James