How I Optimized My LAMP Server

I recently switched servers for this site. I moved from Media Temple to Digital Ocean. Think of Digital Ocean as AWS but faster, cheaper, and with great UX. I’ve been meaning to move there for a while, ever since I figured out how to manage my own LAMP stack.

One benefit of Digital Ocean is their fantastic documentation. So there isn’t much to figure out… But for someone who came from Front-end Development, it’s a bit intimidating to manage your own server. To tell you the truth, I’ve tried this move a few times, but the last time I set up a stack for this site I used SUSE Linux (I don’t know what I was thinking), and the site kept crashing.

Since then I’ve played with VMWare and got comfortable with setting up my own development server, and moved to CentOS.

The missing link was optimizing Apache.

I’m a big fan of This Week in Startups and one of their sponsors is New Relic. If they say something is worth trying, I try it.

After switching to Digital Ocean I set up New Relic on the new site. Even though I had installed W3 Total Cache on my install, New Relic was still giving me error warnings every 10-15 minutes. Frustrating! True, I AM running a WordPress multisite on the lowest tier, but none of the sites are high traffic. I should be able to do that.

Well, after digging into New Relics errors I saw that I was using 100% of my my physical memory and 200% of my swap memory. BAD.

Then I found Jean-Sebastien Morisset’s check_httpd_limits.pl. WOW.

I updated my httpd.conf with his recommendations and look at the results:

Physical Memory - New Relic Dashboard You can clearly see when the new settings took effect.

Here’s the site’s load average:

Load Average - New Relic Dashboard

Best part is, since these settings took effect, NO MORE ERROR WARNINGS FROM NEW RELIC!!!

So, if you read this Jean-Sebastien, thanks for your wonderful tool! And New Relic, thank YOU for your excellent monitoring that pushed me to do this!