Compression of dynamic content 11

Posted by jan Thu, 28 Dec 2006 23:49:00 GMT

It looks like a few changes won’t make it into trunk/ before I leave for vacation. But you should know what is in the pipeline and what you want to wait for:

  • HTTP Response filtering is implemented
  • HTTP/1.1 chunking becomes a module
  • compression of dynamic content

This will add compression not only for mod_proxy_core and its backends (FastCGI, SCGI, HTTP, AJP13) but also to internally generated content like the directory listings.

With these changes we will become more and more stream based. Or like JDD called it: The Web is a Pipe

Lighttpd powers 6 Alexa Top 250 sites 14

Posted by jan Thu, 28 Dec 2006 23:03:00 GMT

Reading the last statistics from netcraft’s Webserver Survey lighttpd is #12 of the most used webserver software packages.

But who is running lighttpd and for what purpose ?

The Ranking

The Alexa Global Top 500 lists a few sites which are already known from PoweredByLighttpd in our wiki

#6 is youtube who is using lighttpd for sending out the static content (the images, the videos, ...). They use a patched version which handles their load better.

#12 is wikipedia. If you open en.wikipedia.org with firebug and check the “All->Net” tab, you will see upload.wikimedia.org. All the images-work is handed here: thumbnail generation, delivery.

#49 is imageshack.us

SourceForge.net is at #80. The whole site runs on lighttpd. Dynamic content via PHP and the usual static content.

#132 is sendspace.com a huge file-sharing site. They care a lot about concurrent access to a large set of large files. You don’t want to hear their disk-backends seeking. :)

On #221 we have our first brother from the family of torrent sites: mininova.org They are a long running lighttpd user and are leading the group:

... and those were just the ones I could find right away. :)

The Numbers

The December Survey from Netcraft talks about 178,619 detected servers. I know that quite a few of them are domain-hosters which are using a single IP to park a few thousand domain-names.

The Others

But who is behind those numbers ? I have contact to a some of owners of the sites mentioned above and want to write an article about the different users of lighttpd. How they are using it, what they would like to see, what they love, ... If you are interested and are listed in Alexa before my personal site drop me a mail at jan@kneschke.de or just add a comment with your mail-address below.

And who is on place #15,276 ?

Voy a Buenos Aires 8

Posted by jan Wed, 27 Dec 2006 23:01:00 GMT

... with only a few words of Spanish learnt so far I’ll be on my way to Buenos Aires on Dec 30th, celebrating New Years Eve their with some friends.

If you want to get patches into trunk/ ping darix or jakabosky on IRC. They can will decide if the patch can go in or has to wait for me.

If you would like to get a session on lighty or just want to meet me and invite me to a asado somewhere in Argentina between Dec 31st and Jan 20th drop me a mail at jan.kneschke@gmail.com. :)

Can someone tell me if the topic was correct Spanish ?

1.5.0 goes cmake 5

Posted by jan Mon, 25 Dec 2006 20:37:00 GMT

It is a tradition now to change the build-system from lighttpd on each major release For now we have the autotools as the user-visible build-system and scons as the system for the developers.

Currently we are testing cmake as a replacement for the scons part.

Build Systems

Before you can build a C-program you first have to find out which functions the system you compile on supports. Not only that UNIX has various flavours, no, there is also Windows.

The natural way on UNIX is using autotools (autoconf, automake, ...) which creates a shell script (configure) which generates the Makefiles which are process by make to build the application.

Using automake reduced the pain of autoconf when it was released, but it none the less is still enough pain to look for something else. Not to forget that win32 and shell-scripts aren’t real friends.

scons

SCons going another route. It replaces make and the autotools by a python based build-system. You can do everything with just a few lines of python code. Very neat.

The bad side: its development is more or less sleeping. The unstable 0.96.9x branch which fixes various nasty bugs is unstable since 2004-08-22, the release of 0.96.1.

cmake

cmake is more relaxed and doesn’t want to solve the whole problem. It does the configure checks and leaves the building to the native build-system. On Unix it is either make or kdevelop3, on MacOSX it is XCode and on windows it is nmake.

As extra cmake supports basic packaging and has very nice integration with test-tools like Dart.

Cross-Compiling

As a proof-of-concept I’ve added cmake support to trunk used the openwrt SDK to build lighttpd with openwrt.
$ cmake .
$ rm CMakeCache.txt
$ OPENWRT=.../OpenWrt-SDK-Linux-x86_64-1/staging_dir_mipsel/ \
CC=$OPENWRT/bin/mipsel-linux-gcc \
LD=$OPENWRT/bin/mipsel-linux-uclibc-ld make

Command Line Options

$ cmake -L .
...
CMAKE_INSTALL_PREFIX:PATH=
...
WITH_BZIP:BOOL=OFF
WITH_MYSQL:BOOL=OFF
WITH_OPENSSL:BOOL=OFF
WITH_PCRE:BOOL=ON
WITH_SQLITE3:BOOL=OFF
WITH_WEBPAV_PROPS:BOOL=OFF
WITH_XATTR:BOOL=OFF
WITH_ZLIB:BOOL=ON
$ cmake -DWITH_BZIP:BOOL=ON \
-DCMAKE_INSTALL_PREFIX:PATH=/home/jan/l-1.5.0-cmake/

Static Linking

To make it easier for embedded systems which don’t have support for dlopen() I added the option:

$ cmake -DBUILD_STATIC:BOOL=ON .

It will build all the modules as static libraries which are linked into the server at build-time. server.modules is used to initialized the modules as before.

1.5.0 works on win32 natively - again 15

Posted by jan Tue, 19 Dec 2006 16:45:00 GMT

Half a year ago I was traveling a bit and tried to get lighty to compile natively on win32

Some time has passed and I concentrated on the other stuff in the 1.5.0 tree, leaving the nasty win32 code in place for someone to pick up. Ben Harper aka rogojin has picked it up and released a win32 installer for the latest pre-release

A simple tests shows that staticfiles are working nicely and that http-proxying with mod-proxy-core works too. Nice work, Ben.

Faster Web 2.0 3

Posted by jan Tue, 19 Dec 2006 06:47:00 GMT

In Faster FastCGI I talked about using temp-files in /dev/shm to reduce the overhead of large FastCGI requests. Robert implemented it right away and it is available in the latest pre-release

Woken up far too early and having the first coffee I shared some ideas on how this could be useful to accelerate AJAX based applications.

Large Response content

Robert already did some benchmarking and it looks like you the X-LIGHTTPD-send-temp-file helps if you have to send more than 16kbyte of content. Otherwise it fits into one FastCGI packet and into the TCP recv-buffers. Boring, right ? Let’s take the next step and move the idea a bit further.

Pre-generating content

At the railsconf in June Zed Shaw and I discussed on some ways to accelerate rails apps and funky Web2.0 apps in particular.

Usually you have dependencies between components. Let’s say you are writing a mail app and you are pooling the “you got mail” service and want to show a fade-in showing it and in the same way refresh the folder-list to show the new mail-count.

We want to play nice and only load the components which really have changed, so you have 1 to 3 XMLHTTPRequests:
  1. the “you got mail” fade-in
  2. if their is new mail, the the folder list gets updated
  3. if the new mail is in the the current folder, the folder view gets updated too

In the AJAX world you have smaller requests, but all of them have to load the session first, before they can generate their content. What if you turn it around move the above logic back into the server and the “you got mail” loads the session once and generates the content for all 3 parts as it knows that app will ask for it anyway in the next 1-2 seconds ?

It would make the folder-list and the folder-view requests instant, as they just have to check if the content-file exists and can stream it out with X-LIGHTTPD-send-temp-file right away.

Now you just have to mix in some cleanup on mtime in case the temp-file is not fetched [perhaps memcached ?], have to find a way how to guess the filename without reading the session first [that’s the expensive part we want to get rid off], ...

Read Ahead

In a way this is like read-ahead on Hard Disks or prefetch in CPUs or even browsers

Hot or not ?

Ok, what do you think about this idea ? Do you have problems that could be solved this way ?

PRE-RELEASE: lighttpd-1.5.0-r1477.tar.gz 10

Posted by jan Mon, 18 Dec 2006 18:11:00 GMT

mod-proxy-core

Robert Jakabosky fixed and improved mod-proxy-core alot since the last pre-release:

POSIX Async IO

I added native support for POSIX AIO which might bring async io for more platforms. While Linux AIO is pretty stable the POSIX aio support is pretty experimental. Perhaps it compiles for you.

I tried to compile it on Linux and FreeBSD.

server.network-backend = "posix-aio" 

Try it

Check if it compiles and works for you.

http://www.lighttpd.net/download/lighttpd-1.5.0-r1477.tar.gz