Benchmark Comparison on Serving Small Static Files: LiteSpeed vs Apache vs Nginx

December 29th, 2009 by Benchmarks , LiteSpeed Web Server , Performance Comments Off on Benchmark Comparison on Serving Small Static Files: LiteSpeed vs Apache vs Nginx

To see all of our latest results, visit the benchmarks page on our site.

To perform a fair benchmark requiring a lot of preparation, as you need to know the detail of each product and set appropriate configuration. Recently, we got chance to do some internal testing. It’s experimental, however the result is good enough to make some points and may be useful to our users, so we would like to share it in a series of blog posts first. Feel free to provide any feedback, so we can improve on our formal benchmark tests later on.

This time we will compare web server performance on serving small static files. Comparing small files is standard practice for benchmark, as this can reveal web server performance instead of network being saturated by large files first. We will compare LiteSpeed, Apache and Nginx with different configurations on serving small static files.

Software version: LiteSpeed 4.1RC2, Apache 2.2.14, Nginx 0.7.61.

Test Result

RoundApache
(worker)
Apache
(event)
Apache
(prefork)
Nginx
(1 worker)
LiteSpeed
(1 CPU)
Non-Keep-Alive
12570.633192.563342.656616.529217.25
22555.73150.343275.967098.369474.72
32562.293159.373309.699609.469526.48
42534.733181.723392.236525.979550.62
Average2555.843171.003330.137462.589442.27
Rating100124130292369
Keep-Alive
14957.556571.356668.3313862.7327487.78
24609.486482.426595.7113729.0528333.26
34321.936709.536655.8812319.2227872.33
44384.766323.046633.413123.3328788.51
Average4568.436521.586638.3313258.5828120.47
Rating100143145290616

Conclusion

LiteSpeed is apparently a big winner in this test. Apache worker and event model does not perform better than prefork model in serving small files. We are also surprised with LiteSpeed performance over Nginx, especially on keep-alive test.

Details

Server Softwareapache/2.2.14 (mpm prefork, worker, event), default setting + disable access log
nginx/0.7.61 (1 worker) default setting + disable access log
litespeed/4.1RC2 (1cpu license), default setting + disable access log
Server HardwareDual Athlon MP 2000+/266FSB/256KB L2 Cache
Memory: 1GB PC2100
Motherboard: MSI K7D
Hard Drive: 36GB 1000RPM SCSI drive
Server OSLinux CentOS 5.4
Client SoftwareApacheBench (ab) 2.3
Client Host Hardware2 XEON E5410 2.33GHz with 8GB memory
Motherboard: ASUS DSEB-DG with 4Gpbs LAN ports
Hard Drive: 4 SCSI 10Krpm RAID0
Network SwitchDell PowerConnect 2624 24-Port Gigabit Ethernet Switch
Client VMLinux 2.6.24-ovz-1.9-default #1 SMP
openvz VM with 1GB memory, bridged Network connection over 1Gbps NIC

Build apache with different model:

$ ./configure –prefix=/usr/local/apache-event –enable-mods-shared=all –with-mpm=event
$ ./configure –prefix=/usr/local/apache-event –enable-mods-shared=all –with-mpm=worker
$ ./configure –prefix=/usr/local/apache-event –enable-mods-shared=all –with-mpm=prefork

Test small html page

#cat test.html
<html>
<head>
<title>Test page</title>
</head>
<body>
<h1>This is a test page</h1>
</body>
</html>

Document Path: /test.html
Document Length: 101 bytes
Estimation target: Requests per second:[#/sec] (mean) from ab

Test Parameters

non-keep-alive:
nginx: ab -n 200000 -c 200 192.168.0.40:48130/test.html
litespeed: ab -n 200000 -c 200 192.168.0.40:48088/test.html
mpm prefork: ab -n 200000 -c 200 192.168.0.40:48124/test.html
mpm worker: ab -n 200000 -c 200 192.168.0.40:48120/test.html
mpm event: ab -n 200000 -c 200 192.168.0.40:48122/test.html

keep-alive:
nginx: ab -k -n 200000 -c 200 192.168.0.40:48130/test.html
litespeed: ab -k -n 200000 -c 200 192.168.0.40:48088/test.html
mpm prefork: ab -k -n 200000 -c 200 192.168.0.40:48124/test.html
mpm worker: ab -k -n 200000 -c 200 192.168.0.40:48120/test.html
mpm event: ab -k -n 200000 -c 200 192.168.0.40:48122/test.html

Note: aio is not used in this test. For a small benchmark file like this, aio will actually introduce extra function call / cpu cycle which does not help, as the file is already in memory (kernel i/o buffer).



Related Posts


Comments