Skip to content


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: 20% [?]

Posted in SysAdmin.


One Response

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Continuing the Discussion

  1. damonparker.org - Lighttpd Update linked to this post on 10/6/2005

    [...] I have written several times about this Lighttpd install. I had to check something on the server last night so I popped over to the server-stats page to see what kind of throughput it was pushing. [...]



Some HTML is OK

or, reply to this post via trackback.