978
978
fixed hanging process if cgi-crash terminates to fast (before we read its
981
981
- extented attributes
983
983
added xattr support, submitted by Ari
988
988
moved the rrdtool support from mod_status into its own module mod_rrdtool
990
990
rrdtool.binary = "/usr/bin/rrdtool"
991
991
rrdtool.db-name = "/var/www/lighttpd.rrd"
993
993
29.08.2004 11:00 - pre-release
996
server.max-keep-alive-requests = 0 replaces
997
server.use-keep-alive = "disable"
996
server.max-keep-alive-requests = 0 replaces
997
server.use-keep-alive = "disable"
1000
1000
server.max-keep-alive-idle
1001
1001
server.max-read-idle
1002
server.max-write-idle
1002
server.max-write-idle
1006
1006
added a entry for each config-value into configuration.txt
1007
added simple docs for
1007
added simple docs for
1188
1188
in that adds and deletes are sent to the notification mechanism im-
1189
1189
mediately, which should cut down on phantom events. Use
1190
1190
ev->kq_results as a sliding window.
1192
1192
* Change F_SETFD calls to use the preferred FD_CLOEXEC instead of 1.
1194
1194
* Remove unnecessary fdevent fcntl handlers. It appears that the only
1195
1195
driver that needs one is Linux RT signals.
1197
1197
* Quiet compiler warning about unused parameter.
1199
1199
* Set the close-on-exec flag for the /dev/poll and epoll_create() file
1202
1202
* Return failure if /dev/poll could not be opened instead of logging
1203
1203
and continuing.
1205
1205
* Detect EAGAIN after writev() failures. FreeBSD sendfile() doesn't need
1206
1206
protection, as the man page says:
1208
1208
When using a socket marked for non-blocking I/O, sendfile() may send
1209
1209
fewer bytes than requested. In this case, the number of bytes success-
1210
1210
fully written is returned in *sbytes (if specified), and the error
1211
1211
EAGAIN is returned.
1213
1213
(adam, georg, matt)
1601
1601
* sizeof(int) -> sizeof(<variable>)
1602
1602
* assign fd_set instead of memcpy()
1603
1603
* init fd -> connection fd pointers to -1
1605
1605
16.04.2004 08:48 - 1.1.8
1608
1608
don't reuse buffer > 64k (see settings.h)
1610
added server.max-request-size to limit the maximum request-body size
1610
added server.max-request-size to limit the maximum request-body size
1613
1613
don't accept HTTP-request headers larger then 32kBytes (see settings.h)
1615
1615
minor speed improvements in the request-parser
1617
1617
More cleanup patches from adam:
1619
1619
* change pre-ANSI C/valid C++ syntax for function declarations/definitions
1620
1620
from using () to (void). Ex: int foo(); --> int foo(void);
1621
1621
* use static linkage as much as possible, to limit possible symbol
1623
1623
* whack more unneeded variables
1624
1624
* try and prevent any errno clobbering by storing the old errno value before
1625
any subsequent system calls, and restoring before function exit.
1625
any subsequent system calls, and restoring before function exit.
1626
1626
* change printf syntax for unsigned variables from %d to %u
1628
1628
15.04.2004 18:41
1631
1631
handle all int != size_t cases in fcgi.c correctly
1633
1633
check headerfields to have a value
1635
1635
handle both EINVAL cases of writev() before the can occur
1637
limit content-length to SSIZE_MAX
1637
limit content-length to SSIZE_MAX
1638
1638
disallow negative content-length
1640
the usage of ltostr() has been reduced to the minimum in favour of
1640
the usage of ltostr() has been reduced to the minimum in favour of
1641
1641
buffer_/append|copy)_(long|off_t)
1643
1643
dropped ultostr() and ultohex() in favour of buffer_*
1645
1645
15.04.2004 16:35
1648
1648
more patches from adam:
1650
1650
* remove warnings for unused parameters and variables
1651
1651
* remove warnings for mismatched pointer assignments
1652
1652
* change "gtime_r" to "gmtime_r"
1654
1654
13.04.2004 20:48
1657
1657
made the 'make check' target self-contained
1659
1659
In our case we have to call the targets in the following order:
1661
1661
$ ./configure ...
1666
1666
because the path to the plugins is hardcoded in the binary itself
1670
1670
$ ./configure --prefix=/tmp/lighttpd-1.1.x/
1673
1673
will help if you don't really want to install before testing.
1675
1675
13.04.2004 00:05
1678
1678
adam sent another patchset:
1680
1680
* Wrap PCRE-specific data member access with an #ifdef
1681
1681
* Add const to pointer using return value from dlerror()
1682
1682
* Explicitly initialize pointer in the lemon parser to 0,
1758
1758
the hand-written configfile parser has been replaced by a LALR(1) one.
1759
1759
'lemon' from the sqlite guys has been used to generate the parser.
1761
- by-host, by-url, by-file, by ...
1761
- by-host, by-url, by-file, by ...
1763
1763
$HTTP["url"] =~ "~$" {
1764
1764
access.deny = "all"
1767
1767
$HTTP["host"] =~ "." {
1768
1768
simple-vhost.server-root = "/home/weigon/wwwroot/servers/"
1769
1769
simple-vhost.default-host = "grisu.home.kneschke.de"
1770
1770
simple-vhost.document-root = "pages"
1773
1773
$HTTP["host"] == "incremental.home.kneschke.de" {
1774
1774
server.docroot = "/hasdasd"
1777
1777
at least the parser can handle it now. Currently there is no real support
1778
1778
for this context-based config-option. But the syntax and the parser are
1781
1781
09.04.2004 10:58
1784
1784
enable ssl support again
1788
enabled mmap+write again
1788
enabled mmap+write again
1790
1790
08.04.2004 12:34
1791
1791
- stricter http-parser
1793
based on a thread at
1793
based on a thread at
1795
1795
http://lists.w3.org/Archives/Public/ietf-http-wg/2004JanMar/0050.html
1797
the HTTP-parser has been adjusted to be more correct when it comes to
1797
the HTTP-parser has been adjusted to be more correct when it comes to
1798
1798
request-header fieldnames
1800
1800
the whitespace handling around the ':' has been relaxed as requested
1802
1802
07.04.2004 17:06
1921
1921
* STD{IN,OUT,ERR}_FILENO preferred instead of {0,1,2}
1922
1922
* dieing --> dying
1923
1923
* SEGFAULT calls abort directly, instead of derefencing a NULL pointer
1925
1925
- mod_accesslog
1927
1927
modified the accesslog format to be CLF compatible
1928
1928
set locale for LC_TIME to C
1933
1933
enabled the pathinfo code again
1936
1936
25.03.2004 13:30 - 1.1.3
1939
1939
compiles fine now without any patches on IRIX
1941
1941
- hostname detection
1943
1943
reworked "get the hostname for HTTP/1.0 requests which don't specify a
1944
1944
Host: ..." to only query the name in this single case for the server side
1945
1945
of the connection
1947
1947
- errorlog handling
1949
1949
stderr is only used until the errorlog is init'ed
1950
1950
if no error-log is specified, syslog() is used
1951
1951
if cycling error-log fails, syslog() is used
1953
1953
- accesslog cycling
1955
1955
don't fall back to stdout anymore
2035
2035
19.03.2004 05:11
2036
2036
- optimizations
2038
implemented special versions of
2038
implemented special versions of
2039
2039
- strcasecmp (array_strcasecmp)
2040
2040
- isdigit, isalpha, isalnum (light_*)
2042
2042
added a faster check for a finished header
2044
2044
after disabling all modules it is still possible to get 20 kreq/s.
2046
2046
15.03.2004 19:45 - 1.1.1
2047
2047
- localizer server
2049
added the localizer-server module to the code
2049
added the localizer-server module to the code
2051
2051
- chunked-encoding
2053
Apple's Safari or HTTP-Handler doesn't handle chunked-extensions defined by
2053
Apple's Safari or HTTP-Handler doesn't handle chunked-extensions defined by
2054
2054
RFC 2616 correctly and doesn't ignore them. Disabled the chunked-extension
2055
2055
which were just used for debugging purposes.
2060
2060
moved the checks if a plugins support a given function from the dispatcher
2061
2061
(plugins_call) to plugins_call_init() to do the check only once.
2063
2063
equalized the plugins functions to only two types:
2065
2065
CONNECTION_FUNC()
2067
2067
replaced all handwritten plugin_call-handlers with macros
2069
2069
made all plugin-functions 'static'
2071
2071
with all plugins loaded we are at 15kreq/s gain
2072
2072
without any plugin loaded at 16kreq/s
2074
2074
before the change we were at 13kreq/s
2077
2077
- compilation fixes
2079
2079
fixed some warnings on FreeBSD and NetBSD by adding
2080
#include <netinet/in.h>
2080
#include <netinet/in.h>
2082
2082
ifdef'ed a pcre-entry in base.h
2084
2084
remove #define _XOPEN_SOURCE from http_auth.c for IRIX
2085
2085
crypt() on Linux needs _XOPEN_SOURCE
2137
2137
got a patch for enhanced virtualhosting from christian kruse -> mod_evhost
2139
2139
moved the virtual hosting config (server.virtual-*) to it's own module
2140
2140
called mod_simple_vhost
2142
2142
23.02.2004 10:06
2145
2145
rearragned the config-file structure again to be able to add settings for
2146
a given URL, Host, Filename, ...
2146
a given URL, Host, Filename, ...
2147
2147
This change affects some config-options directly (access.deny,
2148
2148
url.rewrite, url.redirect, virtual-hosting, ...)
2150
added 'specific-for.url' for url specific config settings
2150
added 'specific-for.url' for url specific config settings
2154
2154
FIX: md5-sess type
2156
2156
seperate the auth-backend stuff
2158
2158
13.02.2004 22:23 - lighttpd 1.0.3
2172
2172
FIX: the search for header fields was up to now case-sensitive. Now it is
2173
2173
like required by the standard case-in-sensitive.
2177
2177
w3m 0.2.5 adds an additional \r\n at the end of the POST requests which is
2180
2180
10.02.2004 10:12
2183
2183
took the suse rc-skeleton which states to be LSB compliant and modified it
2184
2184
for lighttpd needs
2187
2187
- HEAD requests
2189
2189
FIX: HEAD requests for static files delived the content from the GET
2190
2190
request. (test case is added)
2193
2193
- directory listings
2195
FIX: the pathname has not encoded at all before it was transfered to the
2195
FIX: the pathname has not encoded at all before it was transfered to the
2196
2196
browser. a proper url and html-encoding has been added.
2198
added modification-time and filesize to the output
2198
added modification-time and filesize to the output
2200
2200
added a basic css for the virtual listings
2202
2202
07.02.2004 22:15 - lighttpd 1.0.2
2203
2203
- sample configfile
2205
2205
rearranged the config-file to have all the important options at the top
2209
2209
added a mod-rewrite options
2211
2211
- mod_accesslog
2213
2213
stdout is no longer used a default for the accesslog
2215
2215
- error-messages
2217
2217
the 404 is now reported in the error-log
2220
2220
- configfile handling
2222
2222
if a key is used twice like
2224
url.rewrite = ( "url1" => "url")
2225
url.rewrite = ( "url2" => "url")
2224
url.rewrite = ( "url1" => "url")
2225
url.rewrite = ( "url2" => "url")
2227
2227
you get an error now. You have to write:
2229
url.rewrite = ( "url1" => "url",
2229
url.rewrite = ( "url1" => "url",
2232
2232
31.01.2004 12:22 - lighttpd 1.0.1
2235
2235
added a sighup-handler to the plugin interface and fixed the log-cycling
2236
2236
for access-logs
2240
2240
disabled the interval-time optimization on IRIX
2242
2242
- documentation
2244
2244
added a lot of new documentation to README
2246
2246
31.01.2004 10:59
2247
2247
- status module
2249
2249
added two new options rrd-dir and rrd-reports:
2251
2251
rrd-reports = (boolean) # enables RRD-reports
2252
2252
rrd-dir = (string) # path for the daily status-files
2254
2254
fixed the "status-files in /"-bug this way
2257
2257
22.01.2004 13:38 - lighttpd 1.0.0
2258
2258
- simple docroot
2338
2338
a new config-file format is ready for the final release of lighttpd.
2342
2342
server.docroot = "string"
2343
2343
server.host = integer
2344
2344
server.modules = ( "string", "string" )
2345
2345
server.mimetypes = ( "key" => "value" )
2346
server.complex = ( "key" => ( "string", integer ),
2346
server.complex = ( "key" => ( "string", integer ),
2350
2350
the syntax should look familar to all who worked with Perl or PHP.
2352
2352
config-file handling has been seperated into a parser and a lexer. Both
2353
2353
are currently written by hand and will propably be rewritten into bison +
2354
2354
flex if time permits. But that would be a cosmetical change.
2374
2374
how-to: using chroot
2376
2376
- chroot to /home/www/
2377
2377
- docroot at /servers/<hostname>/pages/
2378
2378
- defaulthost www.example.org
2380
2380
e.g. (external view)
2381
2381
/home/www/servers/www.example.org/pages/index.html
2384
2384
/servers/www.example.org/pages/index.html
2388
2388
chroot /home/www/
2390
2390
groupid nogroup
2392
2392
virtual-server-root /servers/
2393
2393
virtual-server-default-host www.example.org
2394
2394
virtual-server-docroot /pages/
2396
The FastCGI process is living outside this chroot definition as it is
2396
The FastCGI process is living outside this chroot definition as it is
2397
2397
started seperatly.
2399
2399
01.12.2003 02:06
2402
2402
in preparation for the first stable release some internals had to be
2403
cleaned up. Basicly it was a cleanup of workflow of the creation of the
2404
response-header. All modules can use a clean interface for this purpose
2403
cleaned up. Basicly it was a cleanup of workflow of the creation of the
2404
response-header. All modules can use a clean interface for this purpose
2405
2405
now. This is espacially usefull for all modules which have to pass some
2406
2406
HTTP-headers to the client.
2521
2521
added a special set of array-functions which are optimised for the "insert
2524
2524
this provides access to the headers which are now forwarded to the external
2525
2525
interfaces. Before this change only a limited set of request-headers were
2528
2528
21.10.2003 11:58
2531
2531
added a new module-hook after the basic-init of the module for handling
2532
2532
config-settings and prepare the overall operartion (like building
2533
2533
db-connections, compiling regexes, ...)
2537
2537
use turckmm-cache 2.4.3 to get some numbers for the php-latency:
2539
2539
/usr/sbin/ab -n 10000 -c 10 http://alba.home.kneschke.de:1025/index.php
2541
2541
handling the cache-decision and the cache-hit in php:
2543
2543
cache-miss: 100% (-> $version = 0)
2545
2545
plain : 108.13 req/s
2546
2546
turckmm-cache: 218.39 req/s
2548
2548
cache-hit: 100% (-> $version = 1)
2550
2550
plain : 164.45 req/s
2551
2551
turckmm-cache: 653.98 req/s
2553
2553
handling the cache-decision and the cache-hit in the server:
2555
2555
cache-hit: 100%, but using index.cml
2557
2557
cml: 4918.84 req/s (no keep-alive)
2558
2558
cml: 6901.31 req/s (keep-alive)
2560
2560
cache-miss: 100%, but using index.cml
2562
2562
plain : 108.39 req/s
2563
2563
turckmm-cache: 217.84 req/s
2566
2566
- there is no loss in the cache-miss case through the cml-handling
2567
2567
- the cache-hit case can be improved dramaticly with lighttpd-cache
2568
2568
- turckmm-cache improves the cache-miss case alot
2570
2570
20.10.2003 00:40
2573
2573
the first 'real-life' test showed dramatic improvements in the req/s
2576
2576
The basic idea was to move the decision if a php-page can be taken from
2577
the cache from the php-code to the webserver.
2577
the cache from the php-code to the webserver.
2579
2579
See here why this is a good thing:
2581
2581
the quite common code which works for http://jan.kneschke.de/ is using
2582
2582
templates and is quite static, but depends on 4 external files (the
2583
2583
menu-structure, the template, the current content, the class-file).
2585
2585
the index-file is always:
2587
2587
include_once "jk.inc";
2589
2589
$v = new view();
2590
2590
print $v->get(array(array ("file" => "content.html")));
2592
2592
It is more or less the same for all pages.
2594
This basic setup can deliver 100 requests/s.
2594
This basic setup can deliver 100 requests/s.
2597
2597
- application bases caching
2599
2599
as we know that each pages depends on those 4 files, you can check if they
2600
2600
have been modified since the last request and deliver the content from the
2601
2601
cache otherwise.
2603
2603
this increased the throughput to 150 req/s. (cache-hit ratio 100%)
2605
2605
The next logic step is to move the decision-making process out of the PHP
2606
2606
code as PHP is to slow for the cache-hit path:
2608
2608
a CML (Cache-Markup-Language) has been written which describes the whole
2609
2609
decision process which has been written in PHP-code before:
2612
2612
output.content-type text/html
2614
2614
output.include _cache.html
2616
2616
trigger.handler index.php
2618
2618
trigger.if file.mtime("../lib/php/menu.csv") > file.mtime("_cache.html")
2619
2619
trigger.if file.mtime("templates/jk.tmpl") > file.mtime("_cache.html")
2620
2620
trigger.if file.mtime("content.html") > file.mtime("_cache.html")
2622
2622
if one of the 'trigger.if' statements is true the 'trigger.handler' is
2623
2623
called to generate the pages.
2625
2625
if none of the them is trigger the files from 'output.include' are sent to
2626
2626
the browser with content-type specified in the first line:
2628
The result was very 'promissing':
2628
The result was very 'promissing':
2630
2630
5900 req/s with keep-alive
2631
2631
3800 req/s without keep-alive
2633
2633
(both for a cache-hit ratio of 100%)
2635
2635
for keep-alive this is factor <b>59</b> against the plain un-cached
2636
2636
version and still <b>39</b> againt the php-cache-version which is doing
2637
2637
exactly the same.
2639
2639
Time for party. :)
2641
2641
19.10.2003 - 18:55
2644
2644
the handling of functions has been improved. they are now 'plugable'. just
2645
2645
the dlopen() stuff is missing.
2647
2647
a new datatype has been added: the string
2649
2649
this makes it possible to evaluate something like:
2651
2651
trigger.if unix.time.now() - file.mtime("head.html") > 30
2652
2652
trigger.if mysql.query("SELECT count(*) " + \
2653
2653
" FROM structure AS struc, session AS sess " + \
2654
2654
" WHERE struct.user = sess.user" + \
2655
2655
" AND sess.id = \"" + mysql.escape("ab\"c") + "\"")
2658
2658
- string operations (concat)
2659
2659
- handing of escape-sequences
2687
2687
- e-tags and friends
2689
2689
in preparation for the php-conference at the begin of november in
2690
frankfurt/main the server has the support some more caching/proxy tags
2690
frankfurt/main the server has the support some more caching/proxy tags
2692
2692
- E-Tag (14.19) [done]
2693
2693
- If-Match (14.24)
2694
2694
- If-None-Match (14.26) [done]
2697
2697
Section (13.3.3) binds them together. [RFC 2616]
2699
2699
using lxr.kde.org and lxr.mozilla.org revealed that
2700
2700
- konqui only uses if-none-match
2701
2701
- mozilla uses if-none-match and if-range
2703
2703
it looks like it isn't that easy to trigger the if-range case.
2705
As ulf suggested the etag is a hash of file-size, inode-number and mtime.
2705
As ulf suggested the etag is a hash of file-size, inode-number and mtime.
2709
2709
ulf just phoned me ask proposed the free the cache more agressivly in case
2712
2712
17.10.2003 12:45
2715
2715
finished the mysql-support for storing the sessions
2717
2717
12.10.2003 20:56
2720
2720
used valgrind again to verify that the code a free of mem-leaks and found
2721
a 'leak generator' in the chunk-api.
2721
a 'leak generator' in the chunk-api.
2723
2723
the last few leaks were just some missing free()'s at the end of the
2724
2724
program run which would have been freed anyway.
2726
2726
at the end valgrind couldn't find any missing free()'s.
2728
2728
11.10.2003 12:09
2731
reduced the number of system calls for FastCGI to WebServer to 2 calls per
2731
reduced the number of system calls for FastCGI to WebServer to 2 calls per
2732
2732
fd-event. (ioctl() + read())
2734
2734
this has no direct effect of the performance of the server, but improves
2735
2735
the possible througput of the load-balancer.
2774
2774
Last week 3 RTL8169S gigE cards arrived and were installed in the
2775
2775
test-framework.
2777
2777
They are very cheap (20 Euros) and are a good start for a low-level
2780
2780
First result show us:
2782
2782
48 Mb/s with ab.
2784
2784
The webserver and the test-server are equipped with a 2000+ AMD CPU. The
2785
2785
system load 95%, user load is 3%, the rest is idle on both plattforms.
2787
2787
After some calculations at gets clear that there are various bottlenecks:
2789
1. The PCI-Bus (32bit/33Mhz) can only transfer 133Mb/s
2789
1. The PCI-Bus (32bit/33Mhz) can only transfer 133Mb/s
2790
2790
- 48 Mb/s TCP-Traffic results in 55Mb/s Ethernet-Traffic (verified with
2791
2791
slurm) [outgoing]
2792
2792
- there is about 10Mb/s incomming traffic at the PCI bus which the
2794
- the rest of the devices at the PCI bus are eating the last few mb/s
2794
- the rest of the devices at the PCI bus are eating the last few mb/s
2795
2795
2. IRQ-Handling
2796
2796
- There are reasons why the RTL8169S cards are so cheap
2797
2797
- they can't send jumbo-frames
2798
- only 8k/64k buffers which results in a interrupt every 3 packets
2798
- only 8k/64k buffers which results in a interrupt every 3 packets
2799
2799
- they are at least handling checksum offloading for ip, udp and tcp
2801
2801
In the end there is a need for new hardware to limit the throughput by the
2802
2802
Ethernet again.
2803
2803
- PCI-X, 64bit-PCI, ...
2804
2804
- 'real' gigE-Network cards
2808
2808
BTW: 2.4.22 + the r8139 driver are very flacky and resulted in 3 lock-ups
2811
2811
In another test the dual-PPro-FreeBSD 5.1-CURRENT machine has been used as
2812
2812
server with a gigE interface (re0) at has shown that the CPU is the limit
2813
2813
for this combination. The maximum thoughput was 7Mb/s.
2815
Another small benchmark:
2815
Another small benchmark:
2816
2816
$ ab -n 1000 -c 10 http://192.168.2.41:<port>/lighttpd-20030925.tar
2818
port | server | CPU Idle
2818
port | server | CPU Idle
2819
2819
------+-------�---------+-----------
2820
2820
1025 | lighttpd | 75%
2821
2821
1026 | thttpd 2.23b1 | 75%
2822
2822
1027 | boa-0.94.14rc17 | 69% *
2823
2823
1028 | apache 1.3.x | 77%
2826
2826
In all 4 cases the thoughput was 8600 kbytes/s.
2828
2828
* boa had 9 failed transfers.
2832
2832
The problems with FreeBSD 5.0-RELEASE vanished after updating to
2835
2835
26.09.2003 18:22
2838
2838
A SMP-machine has been added to the test-farm. It is running FreeBSD
2839
2839
5.1-RELEASE and will help to the improve the scalability.
2841
2841
fixed sendfile() handling.
2843
2843
- FreeBSD problems
2845
2845
FreeBSD-5.1-RELEASE-SMP
2846
2846
2 * Pentium Pro 200 MHz
2847
2847
192.168.2.38 (doubleheart)
2848
2848
(webserver [lighttpd at port 1025, thttpd at port 1027])
2852
2852
192.168.2.10 (grisu)
2856
2856
Connections are reset by the kernel without any application intervention.
2858
2858
Calling 'ab' (apachebench) at grisu with the following paramters:
2860
2860
/usr/sbin/ab -n 10000 -c 10 http://192.168.2.38:1025/index.html
2862
2862
results in the following output:
2865
2865
Time taken for tests: 40.610 seconds
2866
2866
Complete requests: 10000
2867
2867
Failed requests: 5980
2868
2868
(Connect: 0, Length: 5980, Exceptions: 0)
2872
This is reproducable and the number of failed requests is always
2872
This is reproducable and the number of failed requests is always
2873
2873
5980 +/- 50 requests. In other words: after 4000 requests tcpdump shows
2874
2874
the following output:
2878
2878
00:53:48.923029 192.168.2.10.39774 > 192.168.2.38.1025: S [tcp sum ok]
2879
2879
1013737315:1013737315(0) win 5840 <mss 1460,sackOK,timestamp 5208461
2880
2880
0,nop,wscale0> (DF) (ttl 64, id 7918, len 60)
2930
2930
write(2, "1064875136: (network.c.210) 235 "..., 33) = 33
2931
2931
syscall_393(0x6, 0x5, 0, 0, 0x10fc, 0, 0xbfbff2c0, 0) = 0
2934
2934
/* no futher waiting connections */
2936
2936
accept(3, 0xbfbff700, [1852702730]) = -1 EAGAIN (Resource temporarily unavailable)
2938
2938
/* enter the main-loop */
2940
2940
gettimeofday({1769235301, 1663069807}, NULL) = 0
2941
2941
poll([{fd=3, events=POLLIN}], 1, 1000) = 0
2942
2942
gettimeofday({4294967295, 65537}, NULL) = 0
2954
2954
After those 10-15 seconds the application gets a POLLIN event for the
2955
2955
server socket and the normal data-transfer taken place for the next 4000
2958
2958
This behaviour is reproducable with thttpd 2.20c and the current lighttpd.
2961
2961
26.09.2003 11:42
2964
ported the localizer-server application into a module for lighttpd. After
2965
30 minutes the code was ported and funtional. This modules provides access
2966
to the localizer-db by a HTTP-Interface and generates the response as
2964
ported the localizer-server application into a module for lighttpd. After
2965
30 minutes the code was ported and funtional. This modules provides access
2966
to the localizer-db by a HTTP-Interface and generates the response as
2967
2967
HTML, CSV and plain-text.
2969
2969
So far, the module-interface looks good and flexible enough.
2971
2971
7000 req/s is good enough too. Generating the HTML and querying the DB
2972
2972
needs some time.
2974
2974
22.09.2003 08:40
2979
2979
auth-sub-system and the cache out of the main-code. The module-interface
2980
2980
will be extended to allow the cgi and the fastcgi sub-processes to be
2981
2981
moved into a module.
2983
2983
15.09.2003 09:36
2984
2984
- error-handling
2986
2986
fastcgi and cgi connections are now closed correctly if the corresponding
2987
2987
client-connection has died.
2989
2989
14.09.2003 10:40
2992
2992
finally streaming works with CGI, too
2994
2994
this enable support for cgiirc.sf.net and friends which use streaming as
2995
2995
there transport mechanism.
2997
2997
streaming has been verified with cgiirc-0.5.2.
3001
3001
there where some reports that sigio didn't work as expected. It just
3002
reported no events at all. Looks like a known bug in the glibc on
3002
reported no events at all. Looks like a known bug in the glibc on
3003
3003
those platforms.
3005
3005
Using poll() instead solve the problems.
3007
3007
27.08.2003 22:12
3010
3010
a pcre based rewrite engine has been integrated
3014
3014
the file-based cgi interface has been replace by two pipes.
3053
3053
After some problems with other benchmarking tools for webservers the first
3054
3054
version of lighttpd-bench has been written.
3056
3056
It a revealed a nasty strange behaviour which was fixed by increasing the
3057
3057
listen-backlog from 5 to 1024.
3059
3059
30.06.2003 14:03
3060
3060
- fileinfo-cache
3062
3062
the fileinfo-cache has been relaxed a little bit and there are always 2
3063
3063
fstat()'s per file-request now. This isn't that dramatic:
3065
3065
21800.74 req/s is still a very good result (7-4k-k).
3067
3067
29.06.2003 03:29
3068
3068
- fileinfo-cache
3070
3070
a fileinfo cache has been added to reduce the number of system-calls to
3071
stat and open a file.
3071
stat and open a file.
3073
3073
in the releases before the same file was stat'ed at least 2 times plus a
3074
3074
stat on the docroot for each request. Now the stat()'s and the
3075
3075
corresponding open() + close() calls are cached and the number of system
3076
3076
calls has been reduced to the minimum:
3078
3078
$ strace -eopen,stat64,read,write,sendfile,accept,shutdown,close \
3079
3079
-p `pidof lighttpd`
3081
3081
/* first connection */
3082
accept(3, {sin_family=AF_INET6, sin6_port=htons(56211),
3083
inet_pton(AF_INET6, "::ffff:192.168.2.10", &sin6_addr), sin6_flowinfo=0,
3082
accept(3, {sin_family=AF_INET6, sin6_port=htons(56211),
3083
inet_pton(AF_INET6, "::ffff:192.168.2.10", &sin6_addr), sin6_flowinfo=0,
3084
3084
sin6_scope_id=0}, [28]) = 5
3085
3085
accept(3, 0xbffff470, [28]) = -1 EAGAIN
3086
3086
read(5, "GET /index.html HTTP/1.0\r\nUser-A"..., 4095) = 91
3130
3130
- caching framework
3132
3132
added output.include, output.content-type for a cache-hit and
3133
trigger.handler for a cache-miss.
3133
trigger.handler for a cache-miss.
3135
3135
the actual decision is made be trigger.if which will be added tomorrow.
3137
3137
15.06.2003 15:33
3140
3140
After several other smaller optimisations lighttpd performs better with
3141
3141
sig-io under high load:
3143
3143
sigio+poll poll
3144
3144
c1000-4k-nok : 2635.95 1643.39
3145
3145
c1000-4k-k : 7335.68 6788.87
3146
3146
c1000-100k-nok: 2353.49 1217.73
3147
3147
c1000-100k-k : 3097.89 2080.73
3150
3150
The user-space part has been optimized a lot. Now it is time to optimized
3151
3151
the number of context-switches between user and kernel-mode.
3156
3156
a fileinfo-cache is the way to go.
3160
3160
struct stat st;
3169
3169
- sig-io is back again
3171
3171
and it works fine.
3173
3173
sigio (Realtime-Signals under Linux 2.4.x) sends one signal per event and
3174
3174
buffers the rest of the events in a kernel queue. If the is full a SIGIO
3175
3175
is sent and poll() gets all events at once for further processing.
3178
3178
Currently the behaviour is a little bit strange:
3179
3179
- sig-io + poll() is good for non-keep-alive connections
3180
3180
- poll() for keep-alive connections
3182
3182
c1000-4k-nok: (1000 concurrent request, 4k filesize, no keepalive)
3184
3184
sigio+poll: 2124.00
3186
3186
c1000-4k-k: (1000 concurrent request, 4k filesize, keepalive)
3188
3188
sigio+poll: 1239.46
3190
Very strange for now.
3190
Very strange for now.
3192
3192
09.06.2003 23:59
3195
3195
the event-handling code has been rewritten to handle single events better
3196
3196
as they are expected from sig-io.
3198
3198
the fallback-mode of sig-io is broken now, but the normal poll() mode got
3199
a 10% increasement in speed. This means the we are back the speed level of
3200
20030308-0155 are as fast as zeus again.
3199
a 10% increasement in speed. This means the we are back the speed level of
3200
20030308-0155 are as fast as zeus again.
3202
3202
Especially under higher load the current lighttpd performes better.
3204
3204
09.06.2003 11:51
3205
3205
- sig-io benchmark
3207
20030609-1151 20030608-2110 20030308-0155
3207
20030609-1151 20030608-2110 20030308-0155
3208
3208
-c 10 sigio select() poll() poll()
3209
3209
4k : 7870.92 7937.77 8035.36 9443.76
3210
3210
4k (keep-alive) : 14098.41 14590.02 14275.52 17985.61
3332
3332
as Sascha required pipelining for his benchmarking tool it has been
3335
3335
pipelining allows sending a bunch of requests at once without waiting for
3336
3336
the actual responses. This reduces the network-overhead and the
3337
3337
round-trip-time.
3339
3339
- non-free()d memory
3341
3341
dmalloc helped to close some non-free()d memory. For the normal operation
3342
3342
this isn't important as only memory chunks which had to be free()d at the
3343
3343
end of the live-time of the lighttpd-process were not de-allocated.
3345
3345
- partly-initialized variables
3347
3347
lighttpd wasn't initializing the main-structure which resulted in strange
3348
3348
behaviour in rare circumstances.
3351
3351
25.05.2003 16:23
3354
3354
after removing some useless internal copies we are more or less at the old
3357
3357
after adding virtual-hosts 10% of the performance were lost. Using less
3358
3358
memcpy() operations might add several other boosts.
3360
3360
I've just checked how lighttpd compares to Zeus.
3362
3362
lighttpd (current) (old)
3363
3363
-c 10 20030525-1623 20030308-0155 Zeus 4_2
3364
3364
4k : 8166.60 9443.76 7278.55
3374
3374
23.05.2003 14:38
3375
3375
- cgi-variables
3377
3377
HTTP_HOST was missing for the cgi-module while the fcgi-module passed it
3378
3378
through to the handler. Fixed that.
3382
3382
the connection to the fcgi was dropped and poll() reported an error, the
3383
error wasn't reported to the client the right way.
3383
error wasn't reported to the client the right way.
3385
3385
22.05.2003 23:02
3386
3386
- authorization
3388
3388
the first password-storage has been added:
3392
3392
plain-userfile <filename>
3394
3394
require /download/ user=jan|user=anom
3395
3395
http-auth /download/ "download archiv" digest
3397
3397
groups are prepared but not implemented. basic and digest are working fine.
3399
3399
20.05.2003 17:53
3400
3400
- authentification
3402
The auth-methods from RFC 2617 have been added.
3402
The auth-methods from RFC 2617 have been added.
3406
3406
The only source for accounts is currently only the config-file.
3408
3408
auth-digest needs the plain-text passwort. Are there any source which
3409
3409
provide a plain-text password ?
3411
3411
12.05.2003 14:33
3412
3412
- virtual hosts
3414
3414
added very basic virtual-host support
3416
3416
virtual-server-root /home/weigon/projects/lighttpd/servers/
3417
3417
virtual-server-default-host grisu.home.kneschke.de:1025
3418
3418
virtual-server-docroot /pages/
3422
3422
- if http-host exists
3423
3423
<virtual-server-root> + <http-host> + <virtual-server-docroot>
3426
<virtual-server-root> + <virtual-server-default-host> +
3426
<virtual-server-root> + <virtual-server-default-host> +
3427
3427
<virtual-server-docroot>
3429
3429
- if even virtual-server-default-host does not exist, 500 is sent
3432
3432
12.05.2003 13:02
3435
3435
After two month of development it was time clean-up the internal
3436
3436
structures. It looks like every went fine as lighttpd works es expected
3440
the on-the-fly compression has been verified to work fine with opera,
3440
the on-the-fly compression has been verified to work fine with opera,
3441
3441
konqui, mozilla and the IE.
3443
3443
12.05.2003 02:10
3444
- on-the-fly compression: deflate
3444
- on-the-fly compression: deflate
3446
3446
Why the hell are the defining a "deflate" encoding in the form of
3448
_deflate_ The "zlib" format defined in RFC 1950 [31] in combination
3449
with the "deflate" compression mechanism described in RFC 1951 [29].
3448
_deflate_ The "zlib" format defined in RFC 1950 [31] in combination
3449
with the "deflate" compression mechanism described in RFC 1951 [29].
3452
3452
and noone implements it that way ? Konqui and Mozilla expect a plain
3453
deflate() package without the zlib-header.
3453
deflate() package without the zlib-header.
3455
3455
Konqui is using "inflate2(..., -MAX_WBITS); " which is noted in the zlib
3458
3458
/* handle undocumented nowrap option (no zlib header or check) */
3460
3460
Funny. Very, very funny.
3463
3463
Anyway. We have mimetype-depended compression support now.
3465
3465
11.05.2003 21:56
3467
3467
re-arranged the logfile structure to write CLF + useragent + referrer.
3469
3469
11.05.2003 10:23
3470
3470
- POST file-upload
3471
3471
added the missing functionality to send more than a single packet to the
3472
FCGI-Server (or Client ? ... the PHP).
3472
FCGI-Server (or Client ? ... the PHP).
3474
3474
This gives us the file-upload thing for eg. PHP and large user-forms
3477
3477
05.05.2003 15:21
3480
3480
added support for PATH_INFO. PHP is a little strange and doesn't trust the
3481
3481
passed PATH_INFO setting. Works fine now.
3483
3483
30.04.2003 15:25
3484
3484
- bug-fixing day
3486
3486
While testing the FastCGI interface with the MSIE Bj�rn Schotte discovered
3487
that sometimes the output repeats itself from the start in an endless loop.
3487
that sometimes the output repeats itself from the start in an endless loop.
3488
3488
This bug has been fixed.
3490
3490
The read-write-fallback for ancient systems seeked the wrong FDs.
3492
3492
The FastCGI handler is now separting the HTTP-Header from the
3493
3493
response-body what results in a cleaner interface. The "header too long
3494
3494
for caching" message is gone now.
3496
3496
28.04.2003 18:18
3497
3497
- chunked transfer-encoding
3560
3560
The CGI Interface wasn't tested for a longer time. It don't really
3561
3561
survived the introduction of the config-file handling and the internal
3562
3562
changes that were part of it.
3564
3564
A small test with
3566
3566
#! /usr/bin/perl
3567
3567
print "Content-Type: text/html\r\n\r\n";
3568
3568
print time()."\n";
3573
3573
Calling PHP via the CGI interface results in 100 req/s. Same script, same
3574
3574
parameters for 'ab' and same PHP result in 1400 req/s if we use the
3577
3577
<b>Don't forget</b>: these benchmarks only represent figures for scenarios which
3578
3578
are not very realistic. They are just usefull for comparisions of the
3579
3579
internals. We don't want to benchmark applications.
3581
3581
01.04.2003 23:04
3582
3582
- new benchmarks
3584
3584
This time we wanted to see if we can get the fastcgi-Interface a little bit
3585
faster. We use this small script for the testing the interface.
3585
faster. We use this small script for the testing the interface.
3654
3654
19.03.2003 03:05
3655
3655
- more on sendfile support
3656
added support for freebsd's version of sendfile().
3656
added support for freebsd's version of sendfile().
3659
3659
ssize_t sendfile(int out_fd, int in_fd, off_t *offset, size_t count);
3662
3662
int sendfile(int fd, int s, off_t offset, size_t nbytes,
3663
3663
struct sf_hdtr *hdtr, off_t *sbytes, int flags);
3665
3665
the first 2 params are swap, the next 2 are the same and the last 3 are
3666
3666
set to NULL or 0.
3668
3668
Solaris 9 is providing a direct interface to the chunk-API with the
3669
3669
sendfilev() system call:
3671
ssize_t sendfilev(int fildes,
3671
ssize_t sendfilev(int fildes,
3672
3672
const struct sendfilevec *vec, int sfvcnt, size_t *xferred);
3674
3674
recovering from a failure is a little bit more complex, but it should be
3675
3675
fast. I just need a system to test it. Anyone ?
3677
3677
18.03.2003 17:32
3679
what a surprise: lighttpd is announced in entwickler.com.
3679
what a surprise: lighttpd is announced in entwickler.com.
3681
3681
<a href="http://www.entwickler.com/itr/news/psecom,id,9483,nodeid,82.html">http://www.entwickler.com/itr/news/psecom,id,9483,nodeid,82.html</a>
3683
3683
this was not planned.
3686
3686
- implemented the chunked-API
3687
3687
rather writing the content of multi-range'd requests to a temp-file we
3688
just register the parts in a chunk-queue.
3688
just register the parts in a chunk-queue.
3690
3690
chunk 1 [mem] - part-header
3691
3691
chunk 2 [file] - source-file (offset, len)
3692
3692
chunk 3 [mem] - part-header
3693
3693
chunk 4 [file] - source-file (offset, len)
3694
3694
chunk 5 [mem] - part-footer
3696
3696
If everything is prepared, the content-length is calculated and the
3697
3697
http-header is generated and prepended to the chunk-queue.
3699
3699
the handle_write() function which handles the write-process just sends the
3700
3700
chunks to the network without only further modifications.
3702
3702
the chunk-api even simplifies the
3703
3703
'my-fastcgi-process-needs-some-time-to-create-the-response-
3704
3704
and-sends-the-data-in-chunks' case. Just add the chunk to the queue if it
3832
3832
- AMD athlon XP 2000+
3833
3833
- runs lighttpd + ab + a 'nice -15'ed FastCGI-PHP
3834
3834
- generates 153 req/s alone
3837
3837
- Intel PIII 850
3838
3838
- runs a FastCGI-PHP
3839
3839
- generates 88 req/s
3841
using the internal load-balancer of lighttpd which balances the
3841
using the internal load-balancer of lighttpd which balances the
3842
3842
php-requests over grisu and laptop generate:
3845
3845
An apache with mod_php running on grisu gives 117.04 req/s only.
3847
3847
09.03.2003 12:46
3848
3848
- building the connect connection to the fcgi-php is not non-blocking
3849
3849
socket() -> connect() -> fcntl(non-blocking) resulted in some problems as
3850
the connect() call blocked sometimes for 1 seconds.
3850
the connect() call blocked sometimes for 1 seconds.
3852
3852
socket() -> fcntl(non-blocking) -> connect() solves this problem, but
3853
addes more overhead. The first connect-attempt seems always to
3853
addes more overhead. The first connect-attempt seems always to
3854
3854
return EINPROGRESS.
3856
3856
08.03.2003 15:06
3857
- the first 'real-life' PHP test showed 2 bugs in the POST handling.
3857
- the first 'real-life' PHP test showed 2 bugs in the POST handling.
3858
3858
1. the Content-Type header was not forwarded via fastcgi
3859
3859
2. the internal content_length handler wasn't reset after the request
3861
3861
now lighttpd + php work with
3863
3863
http://framework.netuse.de/
3865
the basic application gives us 145 req/s
3865
the basic application gives us 145 req/s
3867
3867
08.03.2003 11:06
3868
3868
- use diet to 'test' your code
3869
3869
diet gives some use full warnings which should be followed. I took the
3870
3870
chance and removed the last few fprintf() and sprintf() from the code.
3871
3871
now, we don't need stdio.h anymore.
3873
a staticly linked, stripped lighttpd is 42884 bytes large.
3873
a staticly linked, stripped lighttpd is 42884 bytes large.
3875
3875
08.03.2003 01:55
3876
3876
- buffer_strcat() uses strlen() to get the length of the 'to-be-catted-string'
3877
3877
if the string is constant or has a known length you can pass that function
3878
3878
which gives use buffer_strcat_len() which passes the string length as a
3881
3881
- using a ramdisk as the base for the tempfiles generated mkstemp() is a
3883
3883
it reduces the io-load on the system and gives as more cpu-time for
3884
3884
load-balancing the php-requests.
3886
3886
- cache the output of strftime(), gmtime() and localtime
3887
3887
we generate more then 10.000 req/s which results in using the same
3888
3888
timestamp over and over again. It is sufficient to generate the timestamp
3894
3894
- don't try to overoptimize for code for the sake of clean code
3895
3895
the range support require some hack in the first versions like setting the
3896
write_offset to the start of the range and keeping the rest of the
3897
"code 200" send code as usual. Only a few lines added this first range
3898
feature. fast, but a hack. It made things more complicated then neccesary
3896
write_offset to the start of the range and keeping the rest of the
3897
"code 200" send code as usual. Only a few lines added this first range
3898
feature. fast, but a hack. It made things more complicated then neccesary
3899
3899
to add multi-range support in this scenario.
3901
3901
removing the hack doing small clean preprocessing helps to clean up the
3902
3902
whole 'write a chunk on the wire' code. At the end we use less code and
3903
have a cleaner design.
3905
Sascha proposed a chunked layer which just takes the chunks (http-header,
3903
have a cleaner design.
3905
Sascha proposed a chunked layer which just takes the chunks (http-header,
3906
3906
part-header, part-message, ... and the last boundary) and passes them to
3907
3907
the write-to-the-wire-code. This is far more elegant and will perhaps same
3908
3908
us from other problems, too. Currently I think that it is not necessary.
3909
3909
First we have to fix some protability issues.
3911
3911
Ok, today benches:
3957
3957
int buffer_strcpy_len(buffer *b, const char *s, int s_len);
3958
3958
int buffer_strcat(buffer *b, const char *s);
3959
3959
int buffer_strcat_len(buffer *b, const char *s, int s_len);
3961
3961
buffer_init() is only called once per buffer. If you don't need the
3962
buffer, set 'used' to zero and reused it afterward.
3962
buffer, set 'used' to zero and reused it afterward.
3963
3963
buffer_strcpy() + buffer_strcat() check if the 'used' + the new strlen()
3964
3964
fit in to the 'size' of the buffer. If not the realloc() the buffer.
3965
3965
buffer_strcat() uses memcpy(ptr + used - 1, s, s_len + 1); which should
3966
3966
be faster than the original strcat().
3968
3968
Using those buffers keep the memory usage at 2Mb. malloc() and free() are
3969
3969
only called at the beginnig of the programm and at the end.
3971
3971
- don't used sprintf() to convert a integer into a string as like
3972
3972
sprintf(buf, "%d", l);
3974
3974
write your own ltostr function. sprintf() is to general for the case and