Benchmark: LiteSpeed vs Apache (PHP and Plain HTML)
Posted by Fred Wu
So I had a play with LiteSpeed just recently. Let’s have a look at what the benchmark says.
Tool used: ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Benchmark object: My WordPress blog (homepage), of course I made an exact copy of the current blog you’re seeing to my VPS box (which has both Apache and LiteSpeed installed).
Both Apache and LiteSpeed use default configuration parameters. Since the benchmark was done on the same server, hardware is the same, however there are some software differences.
Server hardware information: Intel(R) Core(TM)2 Quad CPU @ 2.40GHz, 256MB RAM (remember it’s a VPS, not a dedicated server).
Server software information: Apache 2.2.3 + PHP 5.2.1 (mod_php), LiteSpeed 3.3.5 + PHP 5.2.5 (LSAPI 4.5) + XCache 1.2.1 + Suhosin 0.9.23
Yes the comparison isn’t totally fair since the LiteSpeed installation has all the bells and whistles (XCache in particular), but it gives you an idea of how the two web servers perform.
Firstly, let’s take a look at dynamic content.
Benchmark command: ab -n50 http://url/to/my/vps/wordpress
Apache
Server Software: Apache/2.2.3 Server Hostname: Not tellin' ya! :P Server Port: 80 Document Path: /wordpress/ Document Length: 69626 bytes Concurrency Level: 1 Time taken for tests: 46.295309 seconds Complete requests: 50 Failed requests: 0 Write errors: 0 Total transferred: 3495800 bytes HTML transferred: 3481300 bytes Requests per second: 1.08 [#/sec] (mean) Time per request: 925.906 [ms] (mean) Time per request: 925.906 [ms] (mean, across all concurrent requests) Transfer rate: 73.72 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.0 0 0 Processing: 794 925 163.7 875 1474 Waiting: 765 910 160.9 869 1447 Total: 794 925 163.7 875 1474 Percentage of the requests served within a certain time (ms) 50% 875 66% 901 75% 919 80% 945 90% 1029 95% 1430 98% 1474 99% 1474 100% 1474 (longest request)
LiteSpeed
Server Software: LiteSpeed Server Hostname: Not tellin' ya! :P Server Port: 80 Document Path: /wordpress/ Document Length: 69626 bytes Concurrency Level: 1 Time taken for tests: 46.565238 seconds Complete requests: 50 Failed requests: 0 Write errors: 0 Total transferred: 3495500 bytes HTML transferred: 3481300 bytes Requests per second: 1.07 [#/sec] (mean) Time per request: 931.305 [ms] (mean) Time per request: 931.305 [ms] (mean, across all concurrent requests) Transfer rate: 73.30 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.0 0 0 Processing: 701 930 171.0 882 1598 Waiting: 407 639 120.7 597 1153 Total: 701 930 171.0 882 1598 Percentage of the requests served within a certain time (ms) 50% 882 66% 917 75% 962 80% 1052 90% 1158 95% 1264 98% 1598 99% 1598 100% 1598 (longest request)
Interestingly enough, the performances are on par! I am a little surprised actually, since LiteSpeed has XCache applied. It perhaps has something to do with the VPS (it’s a little slow), and of course the Standard version of LiteSpeed does not perform as well as the Enterprise version.
Take a look at the result of one of my other shared hosting accounts (just for reference):
Server hardware information: 8-core Intel(R) Xeon(R) CPU L5320 @ 1.86GHz, 12GB RAM
Server software information: Apache 2.2.6 + PHP 5.2.5 (mod_php) + eAccelerator 0.9.5.2 + Suhosin 0.9.23 + Zend Optimizer 3.3.3
Apache only (don’t have LiteSpeed on this server)
Server Software: Apache/2.2.6 Server Hostname: Not tellin' ya! :P Server Port: 80 Document Path: /wordpress/ Document Length: 60370 bytes Concurrency Level: 1 Time taken for tests: 10.540660 seconds Complete requests: 50 Failed requests: 0 Write errors: 0 Total transferred: 3038000 bytes HTML transferred: 3018500 bytes Requests per second: 4.74 [#/sec] (mean) Time per request: 210.813 [ms] (mean) Time per request: 210.813 [ms] (mean, across all concurrent requests) Transfer rate: 281.39 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.0 0 0 Processing: 191 210 46.4 203 514 Waiting: 124 140 6.7 141 160 Total: 191 210 46.4 203 514 Percentage of the requests served within a certain time (ms) 50% 203 66% 204 75% 205 80% 206 90% 215 95% 219 98% 514 99% 514 100% 514 (longest request)
Now let’s take a look at how static content compete. The target object is still my blog homepage, but this time with WP Super Cache enabled!
Benchmark command: ab -n10000 -c50 http://url/to/my/vps/wordpress
Apache
Server Software: Apache/2.2.3 Server Hostname: Not tellin' ya! :P Server Port: 80 Document Path: /wordpress/ Document Length: 69700 bytes Concurrency Level: 50 Time taken for tests: 37.19618 seconds Complete requests: 10000 Failed requests: 0 Write errors: 0 Total transferred: 700449648 bytes HTML transferred: 697766700 bytes Requests per second: 270.13 [#/sec] (mean) Time per request: 185.098 [ms] (mean) Time per request: 3.702 [ms] (mean, across all concurrent requests) Transfer rate: 18477.55 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 4.0 0 101 Processing: 0 183 197.9 145 2693 Waiting: 0 134 90.7 128 1086 Total: 0 183 197.8 146 2693 Percentage of the requests served within a certain time (ms) 50% 146 66% 156 75% 164 80% 170 90% 215 95% 485 98% 852 99% 1159 100% 2693 (longest request)
LiteSpeed
Server Software: LiteSpeed Server Hostname: Not tellin' ya! :P Server Port: 80 Document Path: /wordpress/ Document Length: 69700 bytes Concurrency Level: 50 Time taken for tests: 12.495997 seconds Complete requests: 10000 Failed requests: 0 Write errors: 0 Total transferred: 700889164 bytes HTML transferred: 698324300 bytes Requests per second: 800.26 [#/sec] (mean) Time per request: 62.480 [ms] (mean) Time per request: 1.250 [ms] (mean, across all concurrent requests) Transfer rate: 54774.50 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 2 6.2 1 55 Processing: 2 59 27.4 59 401 Waiting: 1 55 27.1 56 399 Total: 2 61 27.0 60 401 Percentage of the requests served within a certain time (ms) 50% 60 66% 61 75% 62 80% 64 90% 76 95% 86 98% 94 99% 97 100% 401 (longest request)
Now that’s better! :) LiteSpeed is three times faster than Apache at serving static pages! Not bad huh?
In general, LiteSpeed is much better at serving static content than Apache. Dynamic content however, I don’t see much performance difference. Although it will be interesting to see benchmarks done on the Enterprise version on higher end hardware.
Some Lighttpd users let Apache to serve PHP content because it’s more stable and has better application compatibility. LiteSpeed on the other hand, is very Apache-compatible and very stable. I would recommend it to any high profile website owners. :)
测一下nginx吧
nginx配置起来有些麻烦,最近肯定是没时间了…… :(
nginx 很容易配置,我感觉比apache还容易配置。。
同上 nginx真的很简单的 速度又快
Dear Fred,
think its a rather useless comparison.
1. you should test against
ab -n50 http://url/to/my/vps/wordpress/
not against
ab -n50 http://url/to/my/vps/wordpress
2. test against really static content .html, if caching opens php process, its of course very differnt.
3. ahmm, sorry -xcache enabled as you already said…
have you tried
pecl install apc
for apache, or eaccelerator? I got different mixupped results on different machines – very interestig stuff.
Hope you will do more of it, e.g. let us know both benchs with / wothout opcode caching on bot servers…
greetings from the other end of da world,
chris
BTW – “Requests per second: 1.08 [#/sec] (mean)”
think that says one thing: for fast PHP, you need much CPU Power.
Chris,
Thanks for your comments. Would you please clarify the URL difference in your first suggestion? AFAIK it makes no difference with or without the trailing slash.
The benchmark, as I have mentioned in the post, was not done scientifically in the sense of using equal software environment. I hope in the future I am able to conduct a more thorough benchmark. As of right now I am busy with some other stuff…
Thanks again for your comments I will definitely take them into account for the next benchmark (whenever that will be).
Cheers,
Fred
I can clarify the trailing slash bit, if you don’t include it the webserver should return a Location: redirect with a new URL including the trailing slash, which means a round trip for nothing. So things will be quicker if you include it.
I am writing a simple little webserver which is outperforming litespeed and other fast servers (by a small margin at the moment).
Nginx is much faster:
NginX vs LiteSpeed: Magento Benchmark Tests
http://turnkeye.com/blog/2010/.....t-magento/
Very interesting, i want apply Litespeed for my site that use Kloxo, but still having trouble trouble for combine with my server that use Kloxo :(
I am interisting but still having trouble trouble Litespeed for mys site that use Kloxo :(
I usually do not drop a comment, but I browsed a few of the responses here Benchmark: LiteSpeed
vs Apache (PHP and Plain HTML) | Beyond Coding.
I actually do have 2 questions for you if you tend not to
mind. Is it simply me or do a few of the responses look like
they are left by brain dead individuals? :-P And, if you are writing on additional online social sites,
I would like to keep up with you. Could you make a list of
all of all your social community sites like your
twitter feed, Facebook page or linkedin profile?