litespeed slower than apache?

furimedia

Well-Known Member
#1
Hi I've just installed a trial enterprise edition on a directadmin and noticed that it is a bit slower than apache.

I can just notice the difference right away without even performing a benchmark.

I'm on a quad-core intel on 4gb ram.

Is this because the trial litespeed enterprise i'm using is not a 4 cpu version?

Also I noticed that some of the sites I have which uses .htaccess rewrites, do not seem to work. When I check the error logs, it just says redirected to itself error.

And out of the box, it was on PHP 4 so i used the admin to compile with PHP5 w/xcache. But after it finished and restarted lsws, I notice that it is still running php4?
So I went to fcgi-bin and just renamed the symlink so lsphp would use lsphp-5.2.5. Is this the correct way to do this?


Thanks
 
Last edited:
#2
hi,

i also generated today trial key and starting test with directadmin too...
When we complete installatio i can post full report.. how do you proceeded with installation?
 

furimedia

Well-Known Member
#3
Okay so after performing some benchmarks, it show Litespeed is indeed slower than apache.


I'm using Apache 2 w/ mod_php. Not even running xcache etc...and it still outperforms litespeed? Are there some additional configurations I should do after I install litespeed to make it optimized?

Here are some apachebench numbers:

Apache
----------------------
Document Path: /
Document Length: 27679 bytes

Concurrency Level: 10
Time taken for tests: 60.472908 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 28073599 bytes
HTML transferred: 27695221 bytes
Requests per second: 16.54 [#/sec] (mean)
Time per request: 604.729 [ms] (mean)
Time per request: 60.473 [ms] (mean, across all concurrent requests)
Transfer rate: 453.34 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 1.2 0 16
Processing: 298 602 151.4 579 1310
Waiting: 0 29 22.2 22 218
Total: 298 602 151.4 579 1310

Percentage of the requests served within a certain time (ms)
50% 579
66% 646
75% 692
80% 715
90% 786
95% 874
98% 996
99% 1140
100% 1310 (longest request)


Litespeed
-----------------------
Document Path: /
Document Length: 24962 bytes

Concurrency Level: 10
Time taken for tests: 103.835695 seconds
Complete requests: 1000
Failed requests: 288
(Connect: 0, Length: 288, Exceptions: 0)
Write errors: 0
Total transferred: 33982552 bytes
HTML transferred: 33637552 bytes
Requests per second: 9.63 [#/sec] (mean)
Time per request: 1038.357 [ms] (mean)
Time per request: 103.836 [ms] (mean, across all concurrent requests)
Transfer rate: 319.60 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 236 1001 1151.2 792 11410
Waiting: 62 426 745.8 363 10077
Total: 236 1001 1151.2 792 11410

Percentage of the requests served within a certain time (ms)
50% 792
66% 954
75% 1116
80% 1241
90% 1714
95% 2026
98% 2418
99% 9453
100% 11410 (longest request)



I am actually testing it on several php apps with several other benchmarking tools(siege), (wordpress, joomla, magento) and they all show relevant results.


Can someone help me to understand why this is happening? I'd have expected even the Litespeed's standard edition would outperform Apache and the results of the Enterprise edition is you can say, dissapointing.

Anyone else tried performing some benchmarks on it?

Is this because mod_php is faster than fcgi?
 
Last edited:

mistwang

LiteSpeed Staff
#5
Can someone help me to understand why this is happening? I'd have expected even the Litespeed's standard edition would outperform Apache and the results of the Enterprise edition is you can say, dissapointing.

Anyone else tried performing some benchmarks on it?

Is this because mod_php is faster than fcgi?
I think there is something wrong with your LiteSpeed setup, I believe that, you have PHP opcode cache with Apache mod_php, but not with litespeed, please check the phpinfo page produced by both server.

You have to edit the php.ini to enable xcache, it wont enabled if you just compile PHP with xcache option.

And you should use the same PHP version and the same opcode cache for both setup.
 

mistwang

LiteSpeed Staff
#6
make sure "PHP suEXEC Max Conn" is >10 if you use PHP suEXEC in your test.
LiteSpeed start PHP process dynamically, so it will affect the benchmark a little.
You should do a warm-up test run first and discard the result, like

ab -n 100 -c 10 ...

So, the PHP processes will get started, then start your official test immediately before those php processes get killed off by web server.
 

furimedia

Well-Known Member
#7
No on my apache, i do not even have xcache or other opcodes enabled, because I was getting segfaults and it is not safe for my production needs.

But with litespeed, i have enabled xcache from within php.ini as well as setting up xcache's config settings.


As for the performance, even without benchmarking I can clearly tell a difference.

I have a ySlow also on my firefox and it just seem to load a second slower than apache.
 

mistwang

LiteSpeed Staff
#8
No on my apache, i do not even have xcache or other opcodes enabled, because I was getting segfaults and it is not safe for my production needs.

But with litespeed, i have enabled xcache from within php.ini as well as setting up xcache's config settings.
If you do not use opcode cache for Apache, you should not use it for LiteSpeed either. maybe some problem with opcode cache. Always keep your test environment consistent, it is fair to everyone.

As for the performance, even without benchmarking I can clearly tell a difference.

I have a ySlow also on my firefox and it just seem to load a second slower than apache.
It definitely not right.
Are you keep both Apache and LiteSpeed running at the same time when you do the benchmark? Is Apache also taking the live traffic? Is you server IO Wait high?

You should only have one server running when you do the test. If Apache causes high I/O wait of the server, it will definitely affect the performance of LSWS.
 

furimedia

Well-Known Member
#9
Thanks for the reply Mr Wang.

But now I have completed the change from Apache to Litespeed and now I am trying to gauge whether I notice any performance gains but I don't see any, if not slower?

First of all I am on a 100mbit connection and usually a blog site with lots of images which is hosted on my server used to all download almost instantly.

But now, the images tend to load slowly and almost looks as if it is loading progressively.

Is this some feature of litespeed or have i misconfigured something? Is there way to maximize the performance of litespeed? Or is this because im on quad core but only using a 2-core trial license?

Please let me know at your earliest. Thanks.
 

furimedia

Well-Known Member
#10
I'm wondering if the default Litespeed sets it so it throttles your bandwidth?

Things like loading images, seem to be a lot slower on litespeed than on apache, why?
 

furimedia

Well-Known Member
#11
I have also tried to enable xcache on litespeed and notice that its not caching anything.
Only thing it caches is when I try to access the xcache admin page, only that page gets cached.

Is there some remedy to this?

Here is my xcache settings:

[xcache]
xcache.shm_scheme = "mmap"
xcache.size = 64M
xcache.count = 4
xcache.slots = 8K
xcache.ttl = 0
xcache.gc_interval = 0
xcache.var_size = 32M
xcache.var_count = 4
xcache.var_slots = 8K
xcache.var_ttl = 0
xcache.var_maxttl = 0
xcache.var_gc_interval = 300

I've tried xcache.count to 1 through 4 and they all do not seem to do the trick.

As for the softlimit/hardlimit on litespeed, i have set them to 512MB.

And also, I have placed my copy of php.ini to /usr/local/lsws/lsphp5/lib/php.ini , is this the correct standard way?

And I did make the change so that PHP suEXEC Max Conn is 200.

I was hoping for some performance gains once I move to litespeed but it seems I'm experiencing everything oposite of what litespeed advertises on performance.
 
Last edited:

mistwang

LiteSpeed Staff
#12
I'm wondering if the default Litespeed sets it so it throttles your bandwidth?

Things like loading images, seem to be a lot slower on litespeed than on apache, why?
Pleae post your I/O wait reading. Higher I/O wait has bigger impact on event-driven web servers than multi-process or multi-thread web servers.

LiteSpeed does has bandwidth throttling feature, but it is not enabled by default under "Server->Security" tab.

Also, if there is I/O intensive tasks on your server, you can try bump the process priority of lshttpd by set "Server->General->Priority" to "-10" or something. It may help.
 

furimedia

Well-Known Member
#13
Correct me if I'm wrong but, does that mean Litespeed has a bottleneck on harddrive rather than on cpu?
I am on SATA 7200rpm and although its no scsi, I still think it should be enough.

But after setting the priority to -10, it does seem like its loading the images a bit quicker, but still not the same level as apache.
 

mistwang

LiteSpeed Staff
#14
Another trick is to let two lshttpd processes work together.
Create a listener with <IP>:80, IP is the IP addressed used by the primary web site hosted on the server. "Bind" the listener to both "Process 1" and "Process 2". the restart. both lshttpd processes will be actively serving files for that site. it should work better.

LiteSpeed use multiple processes to compensate the I/O wait. All other light-weight web servers has exactly the same issue with the same remedy.

You should identify the task causing high disk I/O wait if any, and try to minimize it as much as you can, no matter you use Apache or LiteSpeed, or whatever.
 

furimedia

Well-Known Member
#15
Hello Wang, thanks and I will try out that solution later tonight.

But what worries me is that, I wonder if this is Litespeed's flaw?

Because when I switch back to Apache, the images(especially) loads much quicker. It loads most of the images almost instantly. This is same for almost all the sites hosted on this server.

I can really tell the difference when especially loading a wordpress blog with lots of images.

On Litespeed, it loads images much slowly. Is this happening for just me? Is anyone else having this issue?

The server does not really have much load, it is just always under 0.5 most of the time so I don't think there is any I/O wait hit and most of the sites are just wordpress blogs. And like I said, I never had this problem on apache.
 

mistwang

LiteSpeed Staff
#16
I don't know what's wrong with your installation, have you change anything under "Server"->"Security"->"Per Client limits"?

Post you configuration. I can take a look at the configuration as well if you PM me the login to the Admin console.
 

PSS

Well-Known Member
#19
Another trick is to let two lshttpd processes work together.
Create a listener with <IP>:80, IP is the IP addressed used by the primary web site hosted on the server. "Bind" the listener to both "Process 1" and "Process 2". the restart. both lshttpd processes will be actively serving files for that site. it should work better.

LiteSpeed use multiple processes to compensate the I/O wait. All other light-weight web servers has exactly the same issue with the same remedy.

You should identify the task causing high disk I/O wait if any, and try to minimize it as much as you can, no matter you use Apache or LiteSpeed, or whatever.
What happens when binding is "Not Set"? I seem to have 4 or 5 lshttpd processes (4 cores) so the default is "bind all"?
 

furimedia

Well-Known Member
#20
Hmm lets say that I have an 8-core cpu and license.

Does that mean that it'd be much better if I create 8 listeners with 1 cpu binded? rather than having a single listener bound with 8 CPU binded?
 
Top