CartMetrix - Do you know yours?

4/14/2005

Lighttpd vs thttpd Part: 2

This is Part 2 of my tests with setting up a barebones image server.
http://www.damonparker.org/blog/2005/04/10/lighttpd-vs-thttpd/

thttpd

thttpd was a snap to install but a little finicky to figure out how to setup. It’s a really ‘down and dirty’ app that does what it does and nothing more. Virtual hosting (more than one domain or IP address) is tricky (I never quite got it figured out). Granted I am trying to bind only one virtual IP address of a server to one subdomain, and on the same machine the top-level domain is running on.

All said and done, about 2hrs to install, read the docs, setup, read the docs, setup, read the docs once more and test. Performance jumped dramatically from having the images running through the full-blown Apache/PHP setup. Server load dropped from a sustained 60%-70% on both webservers, to below 30% on the server that was no longer hosting any images, and to about 40% on the server hosting the forums and the images (remember there are serveral web servers fronting a single database server for the forums). Apache throughput dropped from ~2Mb/s on each server to ~300Kb/s. All the ‘heavy’ web payloads are going through thttpd.

Whoa! Why did I spend so much time tweaking Apache itself?

Intersting to note that this serves to alleviate another major problem with multi-web server solutions — file/data consistency.

When UserA, using www1, uploads FileX, how does UserB, browsing the forums via www2, see the same FileX?

I had setup a cron job to take care of the website files themselves via rsync (phpBB and misc PHP/HTML), but maintaining a growing directory of 2Gb+of images across multiple servers is a pain. An NFS I setup was passable at medium loads, but it was becoming the bottleneck as our loads spiked (several NYT mentions can do that to anyone ;).

lighttpd

Compared, lighttpd is a breeze to install and setup. Working with the configuration feels like a lightweight version of Apache, albeit with many, many improvements. The configuration file is uses a clean OO styled notation which keeps the config file clean:

## where to send error-messages to
server.errorlog             = “/var/log/lighttpd/error.log”

#### accesslog module
#accesslog.filename          = "/var/log/lighttpd/access.log"

# files to check for if …/ is requested
server.indexfiles           = ( “index.html” )

From unzipping to starting lighttpd with a similar setup as the thttpd server- 20 minutes.

In my limited testing, the server load on the image server dropped another 7%-10% with the same throughput as the thttpd setup. Several ApacheBench tests later I ended up with a pretty clear winner.

http://damonparker.org/html/thttpd-vs-lighttpd.html

lighttpd was able to average 4277.07 Kb/s, while thttpd did 3135.37 Kb/s (302 seconds vs 409 seconds total time to serve 1 million pages with a concurrency value of 500). A whole Mb/s better. My testing was specific to our needs, namely a large payload (a 110Kb photo).

lighttpd’s site features some more detailed benchmarks that I can concur with:
http://lighttpd.net/benchmark/

Popularity: 32%

4/10/2005

Lighttpd vs thttpd

I manage a forums site that utitlizes RRDNS to load balance several webservers to a single db server. The site serves a lot of images, so to tweak performance even further I wanted to try to move the images off on to a lightning fast file-only server (no PHP on minimal file transfer services). Its amazing how much faster a small footprint server can be. An optimized Apache2 process with only PHP and a handful of other modules compiled in is still 6-8MB. Running 300 of those at a time is a hog.

After some searching, I came of with these potentials:

After a quick look at both packages, thttpd seems to be more lightweight, which is just what I am after. lighttpd is definitely more full featured, it even supports a dozen or so Apache-style modules like vhosts, httpd authentication, Ruby and even PHP. On this project I don’t see the need for the majority of these so hopefully thttpd will be my baby. I’m going to try it out first and see.

More later…

Popularity: 31%


damonparker.org is proudly powered by WordPress
Entries (RSS) and Comments (RSS).

copyright © 2002-2008 damonparker.org. all rights reserved.

Close
E-mail It