Lighttd: Put your webserver on a diet
October 13th, 2008

When you’re working with limited system resources, every bit that can be freed up counts. And if you have do your web development on machine with only 384mb of RAM, you start to be become a bit, um, mercenary about your resources. Running an Apache+PHP+MySQL stack alongside a GNOME desktop (xfce or fluxbox would be better but we all like our little luxuries) , Firefox and a text editor is not my idea of an efficient workspace. When you take the fact that I’ll be working on a wordpress install with about 19k entries, you start getting a sour taste in your mouth.

That’s where Lighttpd comes in. It’s ,according to its site,

�designed and optimized for high performance environments. With a small memory footprint compared to other web-servers, effective management of the cpu-load, and advanced feature set (FastCGI, SCGI, Auth, Output-Compression, URL-Rewriting and many more) lighttpd is the perfect solution for every server that is suffering load problems”

Anyways, what we’re interested in is the small memory footprint and the effective management of the cpu-load part.

Installation

We need to get and install lighttpd, PHP and MySQL:

Guides available from:
Instructions from Lighttpd Trac
Lighttpd installation instructions from *Nix Craft
Lighttpd+PHP+Perl+MySQL installation guide for Windows users
Lighttpd+PHP+MySQL Installation guide for Ubuntu
A few notes:

  • The settings for fastcgi suggested on the Lighttpd wiki will load a large number of php-cgi process that you probably will not be using. I’ll probably suggest you set
    "PHP_FCGI_CHILDREN" => "2"

    instead of

    "PHP_FCGI_CHILDREN" => "16"

    You can make adjustments later if you feel the need.

  • You need to modify the default my.cnf to make things a bit more effcient. You can follow this guide to get you started.

Does it help to use lighttpd instead of apache? Yeah, it does. I’ve been using it for the last couple of weeks and it’s been able to handle my requirements without problem. My final opinion? Well, it is not as full featured as apache but if you have a limited memory budget or are just looking for a lean mean web server, you really should take a good look at lighttpd. Now if you don’t mind, some of us have real work to do and can’t spend all day reading other people’s blogs ;-) .

Filed under: Networking, Reviews, Web — Tags: , , , — Kwame @ 7:19 pm

2 Comments »

  1. All fair and good when you’re running your own stuff for your own (or limited public) use. But when you’re doing shared hosting stuff, such “smart” solutions could at best be offered as an extra option for the few nerds onboard, while offering the “standard” solutions for everyone else.

    WordPress (and most other CMSes) will tell you that you’ll be ok with any webserver software (even IIS). And sure, you’ll be ok… till you’re not. Often all it needs is some basic conf changes, but don’t expect Aunt Becky to figure that out.

    That’s why successful (web)apps, which start lean, mean and clean, often become bloated in the long-run, as they strive to accommodate that cool ‘lil feature from everyone and their cats.

    Here I’m thinking WordPress, now almost hitting 2MB, from about 300kb just about 2 years ago when I came to love it.

    It’s a big “Success Trap” out there.

    Comment by George — October 15, 2008 @ 3:43 am

  2. True, true. For a production box, I’d probably stick to Apache. Right now though, I need something lightweight for development.

    Comment by Kwame — October 15, 2008 @ 9:35 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment