LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > Install/Configuration > Best configuration for PHP LiteSpeed SAPI

Reply
 
Thread Tools Display Modes
  #1  
Old 09-27-2005, 12:57 PM
jeff jeff is offline
New Member
 
Join Date: Sep 2005
Posts: 1
Default Best configuration for PHP LiteSpeed SAPI

Hello All!

I have installed LiteSpeed Web Server 2.1.1 Standard Edition on linux (Trustix 3 / kernel 2.6).
For test I have compiled PHP 5.0.4 in FastCGI and LiteSpeed PHP SAPI mode.
In my all benchmarks tests with ApacheBench the php in FastCGI mode is more fast than PHP SAPI :

ab -c 298 -n 10000 "http://myserver/phpinfo.php" (LiteSpeed PHP SAPI):
Concurrency Level: 298
Time taken for tests: 33.717688 seconds
Complete requests: 10000
Failed requests: 9962
(Connect: 0, Length: 9962, Exceptions: 0)
Write errors: 0
Total transferred: 373412827 bytes
HTML transferred: 371991430 bytes
Requests per second: 296.58 [#/sec] (mean)
Time per request: 1004.787 [ms] (mean)
Time per request: 3.372 [ms] (mean, across all concurrent requests)
Transfer rate: 10815.09 [Kbytes/sec] received

ab -c 298 -n 10000 "http://myserver/phpinfo.php" (LiteSpeed PHP FCGI):
Concurrency Level: 298
Time taken for tests: 19.784013 seconds
Complete requests: 10000
Failed requests: 28
(Connect: 0, Length: 28, Exceptions: 0)
Write errors: 0
Total transferred: 403320418 bytes
HTML transferred: 401916036 bytes
Requests per second: 505.46 [#/sec] (mean)
Time per request: 589.564 [ms] (mean)
Time per request: 1.978 [ms] (mean, across all concurrent requests)
Transfer rate: 19908.35 [Kbytes/sec] received

I have tried many options in theLiteSpeed server configuration for LiteSpeed PHP SAPI, but LiteSpeed PHP FCGI always win.

What the best LiteSpeed Standard Edition PHP SAPI server configuration for the following parameters?
Max Connections?
Environment?
Response Bufferring?
Auto Start?
Instances?
Priority?

Thanks,

Jefferson
Reply With Quote
  #2  
Old 09-28-2005, 07:16 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,603
Hi Jefferson,

We did some performance test today.

Our test result shows that the scalability of poll is very bad when concurrent level is high, and LiteSpeed PHP has worse performance than FCGI PHP, when epoll is used, LiteSpeed PHP always win.
The poll() implementation in 2.6 Kernel is worse than that in 2.4, we think.

Our result:
FCGI PHP
Code:
ab -n 10000 -c 298 http://192.168.10.45:8088/phpinfo.php

Concurrency Level:      298
Time taken for tests:   21.250 seconds
Complete requests:      10000
Failed requests:        0
Broken pipe errors:     0
Total transferred:      255775919 bytes
HTML transferred:       254333788 bytes
Requests per second:    470.59 [#/sec] (mean)
Time per request:       633.25 [ms] (mean)
Time per request:       2.12 [ms] (mean, across all concurrent requests)
Transfer rate:          12036.51 [Kbytes/sec] received
LiteSpeed PHP
Code:
ab -n 10000 -c 298 http://192.168.10.45:8088/phpinfo.phtml

Concurrency Level:      298
Time taken for tests:   19.020 seconds
Complete requests:      10000
Failed requests:        0
Broken pipe errors:     0
Total transferred:      240157735 bytes
HTML transferred:       238716105 bytes
Requests per second:    525.76 [#/sec] (mean)
Time per request:       566.80 [ms] (mean)
Time per request:       1.90 [ms] (mean, across all concurrent requests)
Transfer rate:          12626.59 [Kbytes/sec] received
Our LiteSpeed PHP configuration:
Code:
Name	   lsphp
Address	uds://tmp/lshttpd/lsphp.sock
Max Connections	20
Environment	PHP_LSAPI_CHILDREN=20
PHP_LSAPI_MAX_REQUESTS=500

Initial Request Timeout (secs)	60
Retry Timeout (secs)	0
Response Bufferring	No
Auto Start	Yes
Command	$VH_ROOT/fcgi-bin/lsphp
Back Log	100
Instances	1
And we found that PHP 4.4.0 is about 50% faster than PHP 5.0.4 for both FCGI PHP and LiteSpeed PHP.

Best Regards,
George Wang
Reply With Quote
  #3  
Old 10-09-2005, 09:46 AM
bkonia bkonia is offline
Member
 
Join Date: Sep 2005
Posts: 16
Quote:
Originally Posted by mistwang
Our test result shows that the scalability of poll is very bad when concurrent level is high, and LiteSpeed PHP has worse performance than FCGI PHP, when epoll is used, LiteSpeed PHP always win.
George,

My understanding of your test results is that if you're running a 2.4 kernel and therefore using poll, you will get better performance with FCGI PHP. And, if you are running a 2.6 kernel and using epoll, you will get better performance with LSAPI PHP.

Is that an accurate assessment?

--
Brad S Konia
Reply With Quote
  #4  
Old 10-09-2005, 04:20 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,603
LSAPI PHP is faster than FCGI PHP on a 2.4 kernel with poll as well.
We believe that the poll implementation in 2.4 kernel is better than that in 2.6 kernel. When poll is used on a 2.6 kernel, LSAPI PHP is slower than FCGI PHP when client concurrent level is high, at least for our standard edition.
When epoll is used, LSAPI PHP always win.
Reply With Quote
  #5  
Old 10-11-2005, 04:50 AM
SyNeo SyNeo is offline
Senior Member
 
Join Date: Dec 2004
Posts: 59
Hi.

So, basically switching poll to epoll in the tuning page, will be enough to improve the performance with LSAPI?
Reply With Quote
  #6  
Old 10-19-2005, 03:51 AM
SyNeo SyNeo is offline
Senior Member
 
Join Date: Dec 2004
Posts: 59
Hi.

Are there any possible caveats in using epoll instead of poll? I switched and it looks fine currently, but perhaps there some points I should be aware of?
Reply With Quote
  #7  
Old 10-19-2005, 09:54 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,603
There is no known issue with epoll, should be safe to use it in production.
Epoll has advantage over poll only when concurrent level is high, otherwise, you will not see big differences.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Setup for Rails via Litespeed Ruby LSAPI Justin Ruby/Rails 2 12-08-2007 07:19 PM
Trying to use litespeed load balancer for balancing lsapi technix Ruby/Rails 3 07-06-2007 08:28 PM
Problem running Gallery under LiteSpeed kchrist PHP 4 10-01-2006 02:53 PM
Problem installing LiteSpeed 2.2.1 Standard on UNIX perezsy Install/Configuration 17 09-22-2006 09:53 AM
RFE: API for adding blocked IPs for a vhost/directory "from the side" ts77 Feedback/Feature Requests 4 06-14-2006 10:05 AM


All times are GMT -7. The time now is 09:34 PM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.