NETLANTIS NEWS/BLOG

Tuesday, April 15, 2008

[SYSCTL] Testing Lighttpd

In need for a server that would serve only static content (small files), but at the highest rate possible, I've tested Nginx, Lighty and Apache.

While Apache is clearly out of the game, Nginx wasn't that bad, however lighty 1.4.19 clearly achieved the best performance (even better than 1.5.0 with sendfile-aio) and was much better documented.

Since I thought I was really wasting my time testing different parameters (which many other probably already did) to achieve the best performance, I'm posting my config file here in hope it will be useful.

server.document-root = "/your_noatime_mounted_partition/static"
server.errorlog = "/your_noatime_.../logs/lighttpd.error.log"
server.event-handler = "linux-sysepoll"
server.network-backend = "linux-sendfile"
server.max-fds = 8192
server.max-connections = 4096
server.stat-cache-engine = "simple"
server.max-worker = 4 # (= number of CPU)
server.max-read-idle = 60
server.max-write-idle = 360
server.max-keep-alive-requests = 1024
server.max-keep-alive-idle = 16
server.bind = "127.0.0.1"
server.port = 80
dir-listing.activate = "disable"
etag.use-inode = "enable"
etag.use-mtime = "enable"
static-file.etags = "enable"
server.username = "your_favorite_anonymous_user"
server.groupname = "your_favorite_anonymous_group"
mimetype.assign = (
".swf" => "application/x-shockwave-flash",
".gif" => "image/gif",
".jpg" => "image/jpeg",
".jpeg" => "image/jpeg",
".png" => "image/png"
)

You can then use mod_mem_cache if you want even better performance...

No comments: