Apache vs Lighttpd for static objects

Objective: Determine which web server(out of apache and lighttpd is better for serving static content(static HTML and images) for higher concurrency of requests.

Method: Compare the performance (in terms of transfer rate and requests served per second) of both web-servers under identical conditions for the same static files with the help of ab (the apache HTTP server benchmarking tool).

Setup 1

Test Object: 100Bytes static HTML file (small html file, 100B)

Testing conditions:

Hardware – P4, 512MB RAM IBM laptop, OS – Fedora Core 4, Processes Running: XWindow, OpenOffice, Lighttpd Server & Apache HTTP Server(but only once server at a time is active)

Total Requests: 50000

Results: (depicted in the charts)

setup1-requests-per-second-vs-concurrency-300x159 Apache vs Lighttpd for static objects

setup1-time-taken-vs-concurrency-300x157 Apache vs Lighttpd for static objects

setup1-transfer-rate-vs-concurrency-300x149 Apache vs Lighttpd for static objects

Observations:

1. Performance of lighttpd degrades for > ~300 concurrent requests on this setup for HTML file.

2. Apache continues to perform consistently for higher concurrencies)

Setup 2

Test Object: 100Bytes static HTML file (small html file, 100B)

Testing conditions:

Hardware – Single CPU, 4GB RAM, OS – RHEL, Applications- One webserver at a time.

Total Requests: 50000

Results:

Observations:

1. Lighttpd performs remarkably better than Apache for conc <~600 reqs

2. Apache performs consistently throughout till concurrency of 1020 reqs

3. Performance of Lighttpd degrades for concurrences of >600 reqs, but still remains comparable with Apache.

Setup 3

Test Object: 100Bytes static HTML file (small html file, 100B)

Testing conditions:

Hardware – Two CPU (HT) Intel Xeon, 4GB RAM, OS – RHEL, Applications- One webserver at a time.

Total Requests: 50000

Results:

setup3-requests-per-second-vs-concurrency

setup3-time-taken-vs-concurrency

setup3-transfer-rate-vs-concurrency

Observations:

1. Lighttpd performs way better on better hardware.

2. Though the performance of Lighttpd degarads for higher concurrencies of requests, it still remains better than Apache.

3. Apache remains consistent.

Setup 4

Test Object: 5KB static JPG image file

Testing conditions:

Hardware – Two CPU (HT) Intel Xeon, 4GB RAM, OS – RHEL, Applications- One webserver at a time.

Total Requests: 50000

Results:

setup4-requests-per-second-vs-concurrency

setup4-time-taken-vs-concurrency

setup4-time-taken-vs-concurrency

Observations:

1. Total time taken by Lighttpd is almost half compared to Apache

2. Performance is alomst 2x better for Lighttpd

Conclusions:

For lowend or not-so-highend hardware:

1. If you have the right estimate of the concurrency of requests on your server and if it is less than 300, go for Lighttpd for your static objects.

2. If you have the right estimate of the concurrency of requests on your server and if it is more than 300-400 most of the time, go for Apache for your static objects.

3. If you do not have the right estimate of the concurrency of requests on your server choose Apache for its consistency.

For highend hardware

1. Use Lighttpd for static content. Its fast, stable and uses less CPU.

You may download the complete report in XLS format: apache-vs-lighttpd


About this entry