Quixote and Lighttpd
Lighttpd is a another Web Server with very promising features: Security, speed, compliance, and flexibility.
As of version 1.3.14 scgi is supported ;-).
Where to download and how to install?
Please refer to the Lighttpd web site: http://www.lighttpd.net/download/
Specific configuration modifications will be explained here after.
SCGI performance: Lighttpd vs Apache
Equipment
- AMD Athlon XP2000+ (1659 MHz)
- 256 MB Ram
- Linux 2.4.26
Apache Bench
Version 2.0.41-dev <$Revision: 1.121.2.12 $>
lighttpd
- version 1.3.15
- installed via: "emerge lighttpd-1.3.15-m1"
- Indeed, I've changed the ebuild script to have the -with-lua and with-memcache. But this would not impact our scgi tests.
- added in /etc/lighttpd:
scgi.server = ( "/scgi-test" => ( "localhost" => ( "host" => "127.0.0.1", "port" => 3000, # "socket" => "/tmp/scgi.socket", "check-local" => "disable" ) ) )
You must comment (host + port) or (socket).
in gentoo all programs linked to apache-2.x have a 2 at the end. Thus we have ab2, apxs2, apache2, ...
apache
- version 2.0.54-r5
- install via "emerge apache2"
- with scgi enbabled (/etc/conf.d/apache2): APACHE2_OPTS="-D SCGI "
- apache config is like this:
<Location "/scgi-test"> SetHandler scgi-handler SCGIServer localhost:3000 SCGIHandler On SCGIServerTimeout 10 Options -Multiviews </Location>
scgi
- version 1.4
- install manually:
tar -xzvd ... cd scgi-1.4 python setup.py install cd apache2 apxs2 -i -c mod_scgi.c
: scgi developers have forgoten to update "version" string. You still will see 1.2 displayed. Thus if you upgrade, takes care.
Quixote 2.0
- Install via standard "tar -xzvf ...; python setup.py install"
Benchmark
I will use the 2 following tests (with root user):
nice -n 20 ab2 -n1000 -c5 http:/localhost/...
nice -n 20 ab2 -n1000 -c50 http:/localhost/...
scripts used:
To be able to test socketfile, I'm using an updated version of scgi_server.py.
The script used can be downloaded: runscgi.py.
Because I will not specify any factory, this one will be used: quixote.demo.create_publisher
Results summary
I will run each commands 3x, and I will present the results of the third run.
|
Apache |
Lighttpd |
Lighttpd Socket File |
|||||||
Concurrency |
5 |
50 |
5 |
% |
50 |
% |
5 |
% |
50 |
% |
Req. per sec |
372.67 |
358.62 |
462.66 |
24.15 % |
439.29 |
22.49 % |
496.11 |
33.12 % |
449.04 |
25.21 % |
KB/sec |
580.62 |
566.98 |
709.72 |
22.23 % |
678.7 |
19.70 % |
762.52 |
31.33 % |
710.83 |
25.37 % |
Time per Req (mean) |
13.417 |
139.424 |
10.807 |
19.45 % |
113.821 |
18.36 % |
10.078 |
24.89 % |
111.349 |
20.14 % |
Conclusions
With a normal sockect connection, Lighttpd is +- 25% quicker than Apache.
With Unix Socket file, Lighttpd is +- 30% quicker than Apache (still with normal socket)
Outputs detail
Normal socket:
command:
gentoo # python runscgi.py --script-name=/scgi-test factory:quixote.demo.create_publisher,host:localhost,port:3000,script-name:/scgi-test,max_childeren:5
Apache
nice -n 20 ab2 -n1000 -c5 http:/localhost/scgi-test/
Server Software: Apache/2.0.54 Server Hostname: localhost Server Port: 80 Document Path: /scgi-test/ Document Length: 1372 bytes Concurrency Level: 5 Time taken for tests: 2.683324 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 1595594 bytes HTML transferred: 1373372 bytes Requests per second: 372.67 [#/sec] (mean) Time per request: 13.417 [ms] (mean) Time per request: 2.683 [ms] (mean, across all concurrent requests) Transfer rate: 580.62 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 4 3.6 4 22 Processing: 2 8 12.1 7 321 Waiting: 0 4 12.1 4 320 Total: 4 12 12.3 12 338 Percentage of the requests served within a certain time (ms) 50% 12 66% 12 75% 12 80% 13 90% 14 95% 22 98% 24 99% 25 100% 338 (longest request)
nice -n 20 ab2 -n1000 -c50 http:/localhost/scgi-test/
Server Software: Apache/2.0.54 Server Hostname: localhost Server Port: 80 Document Path: /scgi-test/ Document Length: 1372 bytes Concurrency Level: 50 Time taken for tests: 2.788471 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 1619504 bytes HTML transferred: 1393952 bytes Requests per second: 358.62 [#/sec] (mean) Time per request: 139.424 [ms] (mean) Time per request: 2.788 [ms] (mean, across all concurrent requests) Transfer rate: 566.98 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 26 15.1 26 72 Processing: 39 105 19.7 106 254 Waiting: 0 84 22.6 89 246 Total: 56 131 13.1 132 255 Percentage of the requests served within a certain time (ms) 50% 132 66% 135 75% 137 80% 138 90% 146 95% 151 98% 152 99% 159 100% 255 (longest request)
Lighttpd
nice -n 20 ab2 -n1000 -c5 http:/localhost/scgi-test/
Server Software: lighttpd/1.3.15 Server Hostname: localhost Server Port: 80 Document Path: /scgi-test/ Document Length: 1372 bytes Concurrency Level: 5 Time taken for tests: 2.161415 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 1571136 bytes HTML transferred: 1374744 bytes Requests per second: 462.66 [#/sec] (mean) Time per request: 10.807 [ms] (mean) Time per request: 2.161 [ms] (mean, across all concurrent requests) Transfer rate: 709.72 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 3 3.2 3 21 Processing: 2 6 5.9 6 158 Waiting: 0 3 5.9 3 157 Total: 2 10 5.6 10 164 Percentage of the requests served within a certain time (ms) 50% 10 66% 10 75% 10 80% 10 90% 11 95% 19 98% 21 99% 23 100% 164 (longest request)
nice -n 20 ab2 -n1000 -c50 http:/localhost/scgi-test/
Server Software: lighttpd/1.3.15 Server Hostname: localhost Server Port: 80 Document Path: /scgi-test/ Document Length: 1372 bytes Concurrency Level: 50 Time taken for tests: 2.276419 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 1582112 bytes HTML transferred: 1384348 bytes Requests per second: 439.29 [#/sec] (mean) Time per request: 113.821 [ms] (mean) Time per request: 2.276 [ms] (mean, across all concurrent requests) Transfer rate: 678.70 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 47 31.2 48 119 Processing: 6 57 32.6 58 315 Waiting: 0 52 33.7 53 313 Total: 80 105 21.3 101 401 Percentage of the requests served within a certain time (ms) 50% 101 66% 107 75% 109 80% 110 90% 124 95% 127 98% 127 99% 183 100% 401 (longest request)
SocketFile
command: gentoo # python runscgi.py --script-name=/scgi-test --socketfile=/tmp/scgi.socket factory:quixote.demo.create_publisher,socketfile:/tmp/scgi.socket,script-name:/scgi-test,max_childeren:5
: becareful that the socket file created have read/write permission for your 2 processes's owner.
nice -n 20 ab2 -n1000 -c5 http:/localhost/scgi-test/
Server Software: lighttpd/1.3.15 Server Hostname: localhost Server Port: 80 Document Path: /scgi-test/ Document Length: 1372 bytes Concurrency Level: 5 Time taken for tests: 2.15672 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 1574272 bytes HTML transferred: 1377488 bytes Requests per second: 496.11 [#/sec] (mean) Time per request: 10.078 [ms] (mean) Time per request: 2.016 [ms] (mean, across all concurrent requests) Transfer rate: 762.52 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 3 2.9 3 21 Processing: 1 6 18.5 5 482 Waiting: 0 3 18.6 3 481 Total: 3 9 18.4 9 482 Percentage of the requests served within a certain time (ms) 50% 9 66% 9 75% 9 80% 9 90% 10 95% 11 98% 21 99% 24 100% 482 (longest request)
nice -n 20 ab2 -n1000 -c50 http:/localhost/scgi-test/
Server Software: lighttpd/1.3.15 Server Hostname: localhost Server Port: 80 Document Path: /scgi-test/ Document Length: 1372 bytes Concurrency Level: 50 Time taken for tests: 2.226973 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 1621312 bytes HTML transferred: 1418648 bytes Requests per second: 449.04 [#/sec] (mean) Time per request: 111.349 [ms] (mean) Time per request: 2.227 [ms] (mean, across all concurrent requests) Transfer rate: 710.83 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 45 31.0 47 111 Processing: 4 61 32.9 60 169 Waiting: 0 56 33.9 56 168 Total: 50 107 21.5 106 256 Percentage of the requests served within a certain time (ms) 50% 106 66% 112 75% 114 80% 114 90% 118 95% 157 98% 175 99% 176 100% 256 (longest request)
You can contact me at: vincent_delft (at) yahoo.com.