Today I was surfing on the net while I was running some loong SELECT statemens on MySQL server. On the linuxquestions forum I found a thread about new web server called Cherokee. People said Cherokee's supposed to be quite fast (double as fast as Apache!) so I had to try it out myself!
I compiled Cherokee with basic settings and used default configuration files to run the tests - all I wanted to do was to test how fast Cherokee really is.
On the first test I used Cherokees default index page (sized 1700 ~bytes). I used Apache Benchmark to test the capacity of the web servers: 20 concurrent connections and 100k requests.
Here's the results:
Server Software: Apache/2.2.6
Server Hostname: localhost
Server Port: 80
Document Path: /index.html
Document Length: 1795 bytes
Concurrency Level: 20
Time taken for tests: 43.383405 seconds
Complete requests: 100000
Failed requests: 0
Write errors: 0
Total transferred: 206406192 bytes
HTML transferred: 179505385 bytes
Requests per second: 2305.03 [#/sec] (mean)
Time per request: 8.677 [ms] (mean)
Time per request: 0.434 [ms] (mean, across all concurrent requests)
Transfer rate: 4646.20 [Kbytes/sec] received
Server Software: Cherokee/0.9.3
Server Hostname: localhost
Server Port: 80
Document Path: /index.html
Document Length: 1795 bytes
Concurrency Level: 20
Time taken for tests: 24.177908 seconds
Complete requests: 100000
Failed requests: 0
Write errors: 0
Total transferred: 199401994 bytes
HTML transferred: 179501795 bytes
Requests per second: 4136.01 [#/sec] (mean)
Time per request: 4.836 [ms] (mean)
Time per request: 0.242 [ms] (mean, across all concurrent requests)
Transfer rate: 8053.96 [Kbytes/sec] received
As you can see, Cherokee is almost double as fast serving single small file. The developers at http://www.cherokee-project.com say that they have developed some über-cool I/O gadget that makes this possible.
I also wanted to test the results with a little bigger file: This time we're using 1.7 megabytes jpg image:
Server Software: Apache/2.2.6
Server Hostname: localhost
Server Port: 80
Document Path: /playboy/1.jpg
Document Length: 1791791 bytes
Concurrency Level: 20
Time taken for tests: 52.58448 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 740870816 bytes
HTML transferred: 738040816 bytes
Requests per second: 192.09 [#/sec] (mean)
Time per request: 104.117 [ms] (mean)
Time per request: 5.206 [ms] (mean, across all concurrent requests)
Transfer rate: 13897.96 [Kbytes/sec] received
And Cherokee:
Server Software: Cherokee/0.9.3
Server Hostname: localhost
Server Port: 80
Document Path: /playboy/1.jpg
Document Length: 1791791 bytes
Concurrency Level: 20
Time taken for tests: 47.941745 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 740070816 bytes
HTML transferred: 738040816 bytes
Requests per second: 208.59 [#/sec] (mean)
Time per request: 95.883 [ms] (mean)
Time per request: 4.794 [ms] (mean, across all concurrent requests)
Transfer rate: 15075.07 [Kbytes/sec] received
As you can see, this time the difference is allmost next to nothing.
So, which of the web servers is really faster? Can't say. The Apache was default installation that comes with Fedora Core. Cherokee was compiled. We were testing only one static file. In few days I'm going to make a test including Apache, Lighty, Nginx and Cherokee, testing static files (multifiles!), php scripts and all other kewl stuff. Then we'll see which of 'em is really faster!
Showing posts with label lighttpd. Show all posts
Showing posts with label lighttpd. Show all posts
Tuesday, October 7, 2008
Sunday, October 5, 2008
Benchmarking Apache 2 vs. Lighttpd
Have you ever wondered which is faster, Apache 2 or Lighttpd? Everyone says that Lighttpd (or lighty) is a much faster, but is it really so?
I found this curious article I'd like to share with you. It can be originally be found here but I'm also going to write a short version about the article below:
The benchmark shows how Apache 2.2.3 compares to Lighttpd 1.4.13 when delivering static HTML file approx 50 kilobytes. Test was made with Apache benchmark.
The test was made on a Debian Etch running inside VMware. The box was quite old but it shouldn't affect on the tendency.
Versions were:
*Apache 2.2.3 mpm-prefork with default Debian configuration.
*Lighttpd 1.4.13 with default Debian configuration.
The HTML file was approx 50 kilobytes in size and it was saved as test.html.
I've run the following commands ten times each and calculated the average requests per second that the web server could handle:
*ab -n 100 -c 5 http://localhost/test.html
*ab -n 1000 -c 5 http://localhost/test.html
*ab -n 10000 -c 5 http://localhost/test.html
*ab -n 100 -c 50 http://localhost/test.html
*ab -n 1000 -c 50 http://localhost/test.html
*ab -n 10000 -c 50 http://localhost/test.html
*ab -n 100 -c 100 http://localhost/test.html
*ab -n 1000 -c 100 http://localhost/test.html
*ab -n 10000 -c 100 http://localhost/test.html
-n is the number of requests to perform for the benchmarking session; -c is the number of multiple requests to perform at a time.
Here's result of the test:

As you can see, lighty is almost one third faster on static pages! Knowin this one has to consider if it is worth using lighty instead of Apache. Personally I choose Apache? Why? More modules and knowledge. Maybe some day I'll start using Lighty. Or Nginx. Woudln't that be kewl?
I found this curious article I'd like to share with you. It can be originally be found here but I'm also going to write a short version about the article below:
The benchmark shows how Apache 2.2.3 compares to Lighttpd 1.4.13 when delivering static HTML file approx 50 kilobytes. Test was made with Apache benchmark.
The test was made on a Debian Etch running inside VMware. The box was quite old but it shouldn't affect on the tendency.
Versions were:
*Apache 2.2.3 mpm-prefork with default Debian configuration.
*Lighttpd 1.4.13 with default Debian configuration.
The HTML file was approx 50 kilobytes in size and it was saved as test.html.
I've run the following commands ten times each and calculated the average requests per second that the web server could handle:
*ab -n 100 -c 5 http://localhost/test.html
*ab -n 1000 -c 5 http://localhost/test.html
*ab -n 10000 -c 5 http://localhost/test.html
*ab -n 100 -c 50 http://localhost/test.html
*ab -n 1000 -c 50 http://localhost/test.html
*ab -n 10000 -c 50 http://localhost/test.html
*ab -n 100 -c 100 http://localhost/test.html
*ab -n 1000 -c 100 http://localhost/test.html
*ab -n 10000 -c 100 http://localhost/test.html
-n is the number of requests to perform for the benchmarking session; -c is the number of multiple requests to perform at a time.
Here's result of the test:
As you can see, lighty is almost one third faster on static pages! Knowin this one has to consider if it is worth using lighty instead of Apache. Personally I choose Apache? Why? More modules and knowledge. Maybe some day I'll start using Lighty. Or Nginx. Woudln't that be kewl?
Sunday, September 14, 2008
How to install Lighttpd with PHP and MySQL to Fedora Core
Lighttpd, or light, is a fast, light and secure webserver which is designed and optimized for speed-critical environments. Many huge websites (Youtube, Wikipedia for example) use lighttpd to serve static content. Also many sites that get more than thousand hits / second use lighty.
Compared to Apache HTTPD or nginx, Lighttpd is not as fust as nginx but it is easier to configure and implement. Compared to Apache, it is faster but has less options. You have to consider which httpd server to use. I personally love to use Apache because of its modules, but I wouldn't hesitate to change to lighty!
1) Install MySQL
First thing you need to do - if you don't allready have MySQL installed - is to install MySQL.
You can do this any way you want, but the easiest way is to use YUM:
yum install mysql mysql-server
Make sure you start mysqld. You should also make sure your mysqld starts when your linux starts up:
chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start
I personally install mysql server from binaries but this is the easiest and fastest way to get your mysql server up and running.
When you install your mysql server, there is no password set for mysql root user. Unless you're using some virtual linux running on your personal laptop used only for developing things, change this immediatelly!
mysqladmin -u root password newpassword
Installing Lighttpd
Since we're using Fedora and we're able to use Yum to install applications, we install lighty this way:
yum install lighttpd
Next, start up your lighty and make sure it starts up when restarting your linux server:
chkconfig --levels 235 lighttpd on
/etc/init.d/lighttpd start
You can now test your ligty. Go to http://127.0.0.1 and you should get a page like this:

3) Install PHP
Lighttpd can use FastCGI to render PHP pages. This can be also installed with YUM:
yum install lighttpd-fastcgi php-cli
That's it! Restart your lighty and you're all good to go!
Compared to Apache HTTPD or nginx, Lighttpd is not as fust as nginx but it is easier to configure and implement. Compared to Apache, it is faster but has less options. You have to consider which httpd server to use. I personally love to use Apache because of its modules, but I wouldn't hesitate to change to lighty!
1) Install MySQL
First thing you need to do - if you don't allready have MySQL installed - is to install MySQL.
You can do this any way you want, but the easiest way is to use YUM:
yum install mysql mysql-server
Make sure you start mysqld. You should also make sure your mysqld starts when your linux starts up:
chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start
I personally install mysql server from binaries but this is the easiest and fastest way to get your mysql server up and running.
When you install your mysql server, there is no password set for mysql root user. Unless you're using some virtual linux running on your personal laptop used only for developing things, change this immediatelly!
mysqladmin -u root password newpassword
Installing Lighttpd
Since we're using Fedora and we're able to use Yum to install applications, we install lighty this way:
yum install lighttpd
Next, start up your lighty and make sure it starts up when restarting your linux server:
chkconfig --levels 235 lighttpd on
/etc/init.d/lighttpd start
You can now test your ligty. Go to http://127.0.0.1 and you should get a page like this:

3) Install PHP
Lighttpd can use FastCGI to render PHP pages. This can be also installed with YUM:
yum install lighttpd-fastcgi php-cli
That's it! Restart your lighty and you're all good to go!
Subscribe to:
Posts (Atom)