Recent comments

In Benchmarking requestAction
David wrote: Why you are not counting database connection impact? Is it really so unimportant?
In Nate Abele - PHP is dying
Victor wrote: When you say the following: "[PHP] is just too simple. It requires only a few lines to generate...
In Felix Geisendörfer - Git and CakePHP
Josh wrote: I'd really like to figure out a way to clone the official git repo and merge it with my own in a...
In Martin Radosta - Record level security based on SQL
markstory wrote: Well the article was about a talk that Martin Radosta gave. I have not written this behavior. ...
In Martin Radosta - Record level security based on SQL
skitle wrote: Was curious if the files for this are available? I have searched through the SF site, and have...
RSS Feed for comments

Martín Sarsale - Death of Apache Long Live Lighttpd

Written on Wed, Dec 3rd 2008, 13:40 in ,

Lighttpd runs as one thread there are no forks, and only one thread. Lighttp is not good for large virtualhosts. It also bottlenecks on the disk speed. It is however good, when you have a single large application or need to total control.

Lighttpd has several modules that are analogous to Apache such as Rewrite, Auth, Expires etc.

Configuration files in lighttpd are very dynamic and allow for variables, regular expressions and if blocks.

By using caching well you can reduce the number of requests made. By using Asset.timestamp = force you will get query strings that contain a querystring with the last modified datetime. You can use a configuration script to set the expiry time for these requests.

Lighttpd and PHP.

Lighttpd doesn't use a PHP module like Apache. Instead it connects to PHP via a socket or TCP/IP. Often this is done with FastCGI. This decoupling of PHP processor and webserver allows you to scale horizontally easily by adding more PHP servers. You can implement this with static resources as well. Static files can be easily routed to alternate machines based on regular expressions done in the config files. Unlike apache which handles and processes each request Lighttpd works more like a pipe connecting inputs to outputs, or between the client and the servers.

LUA scripting is a simple scripting language that is built into lightttp. For example sending a random image. This can be done with raw PHP, PHP and X-Sendfile, or by using a LUA script. The LUA script is ~400% faster when compared to PHP. This demonstrates one of the many advantages that Lighttpd can offer over Apace

There are similar performance gains to be made when using LUA scripts with full page caching. Lighttpd gives you a lot more control on how you configure your severs. You can easily fix problems with CPU use or HDD disk by adding more resources to the appropriate area. And since you can have multiple file servers attached to one Lighttpd process. Swapping out or adding extra disk server is not a difficult thing to do.

Lighttpd seems like a viable and exciting alternative to Apache that I would consider using in the future.

Back to Mark's articles

openID

What is OpenID?

OpenID is a new open standard that lets you sign in to web sites with a single URL that you own. This URL can be your homepage or blog, or it can be provided to you by a web site you use. In either case, you only have to sign in once to your OpenID provider and so you only need to maintain a single password.Learn more.

How is CakeDC using OpenID?

You can use your OpenID identity when posting comments on the site. When you see a form field with OpenID logo entering your OpenID identity is sufficient to allow your post. We also accept Google or Yahoo! identities. Simply use either "google.com" or "yahoo.com" and our OpenID library will locate your information from the appropriate source.