Fly Light With Lighttpd Web Server
Lighttpd Web Server: Extremely fast, lightweight Web server.
Apache has long been the Big Kahuna in the server room. Not only is it the leading Web server in the world, powering more than 58 percent of Web servers according to the oft-quoted Netcraft Web Server Survey, it is also the most widely used free and open source software. Not that Apache is without its competitors and alternatives. From Microsoft IIS to Sun Java Web Server, a variety of secondary Web servers continue to crunch away in Apache's shadow.
Lighttpd, a fairly recent entrant to the open source Web server field, is attracting remarkable enthusiasm. Its April 2007 debut on the Netcraft Web server survey officially put lighttpd (pronounced "lighty") on the map. With 1.2 percent of the nearly 114 million Web servers out there powered by lighttpd, it's population is sizable, albeit not about to topple Apache for the crown just yet. But lighttpd is well on its way to overtaking Sun for third place, driven primarily by support from administrators looking for an Apache alternative.
Apache, in a nutshell, has grown feature-rich and resource-heavy. This is less a critique than a reflection of its evolution and broad power. Lighttpd grew out of a thesis project by German developer Jan Kneschke in a proof-of-concept attempt to deliver 10,000 concurrent connections from one server. Unlike Apache 1.x's forking model and Apache 2.x's multithreaded model, lighttpd is built around a single-thread, single-process core that uses native event handlers built into the underlying operating system. Its tagline is "fly light," and indeed it does. Rather than integrate modules like PHP into the server process, lighttpd passes dynamic requests to external modules through the retro FastCGI interface.
The performance benefits of lighttpd, particularly for static or PHP-based pages, are no longer just proof of concept. Lighttpd has been put into production use at high-traffic sites like isohunt.com and mininova.org, both of which serve more than 1,000 page requests per second. Lighttpd is even used to serve portions of major sites, including YouTube, Wikipedia and Meebo. YouTube, for example, delivers static content like Flash videos via lighttpd while still using Apache to handle dynamic pages. This hybrid architecture of pairing lighttpd with a full-featured but more resource-hungry server is becoming an increasingly popular way to scale resources.
For administrators, installing lighttpd is a manual undertaking. You can download the 700KB tar distribution and compile from source on most Unix-based platforms or locate a pre-packaged binary, such as an RPM or DEB, for particular Linux distributions. On Linux and Unix, lighttpd is administered entirely by command. Alternatively, the 2MB Windows distribution includes a simple graphical installer and server start/stop shortcuts.
Many lighttpd adopters will have previous experience with Apache. Like Apache, lighttpd is configured through a central configuration file. However, it uses a very different configuration syntax. Whereas Apache's syntax is XML-like, the syntax for lighttpd configuration resembles a scripting language. Although preference for either is a matter of taste, lighttpd enthusiasts believe its configuration language is more concise and yet more flexible (e.g., you can use conditionals) compared to Apache.
Developers converting sites from Apache to lighttpd take note: If you rely heavily on rewrite rules for Apache, they may need to be reformulated for the lighttpd rewrite engine.
A growing range of modules for lighttpd expand on its core functionality, including authentication, content compression, content caching and support for WebDAV. PHP is perhaps the most popular processing complement to lighttpd. At first, lighttpd's support for PHP processing seems downright old-fashioned: It passes requests through the FastCGI module to an external PHP processor. Unlike Apache installations with PHP integrated, this allows the weight of PHP to be invoked only when needed, saving memory and potentially supporting more simultaneous connections in available memory.
Lighttpd also leverages FastCGI to scale efficiently. You can install lighttpd on a public-facing server, and set up a farm of FastCGI servers behind it to process dynamic requests. A simple configuration line tells lighttpd the IPs for the array of FastCGI servers. Lighttpd will load-balance requests among the FastCGI servers, making it easy to add or remove servers, as needed, to handle changes in dynamic load.
Because lighttpd has been designed from the ground up to serve thousand of requests concurrently, it is fast becoming the resource friendly Web server du jour. However, the lighttpd community is significantly smaller and less mature than that of Apache. Consequently, development and support is a growing but still specialized endeavor.
Pros: Extremely fast, especially for static content; Low memory footprint; Proven for thousands of connections.
Cons: Some reports of stability issues, incompatibility with some Apache configurations; Small development and support community.
Reviewed by: Aaron Weiss
Original Review Date: 05/17/2007
Original Review Version: 1.4.15