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

Go Back   LiteSpeed Support Forums > External Applications > PHP > php 5 config tuning

Reply
 
Thread Tools Display Modes
  #1  
Old 04-14-2008, 02:31 PM
wkenzie wkenzie is offline
New Member
 
Join Date: Feb 2008
Posts: 6
Default php 5 config tuning

I have had great trouble so far trying to get LSAPI php 5.2.5 to work well for me in high concurrency situation, and need some guidance. Currently I am using apache 2.2 with httpd.conf MaxClients=1000, KeepAlive on, KeepAliveTimeout 3, MaxKeepAliveRequests 100, Timeout 60, MaxRequestsPerChild 50, ServerLimit 1250 and MySQL my.cnf max_connections=1600 and max_user_connections=1600. It works but is not very fast when I reach 1000+ concurrent users. I hoped lsws would handle more users and be faster but it froze overnight the first time I ran it, and load is much too high when I reach 1000+ users. I have maxConnections=2000, maxKeepAliveReq=15, smartKeepAlive=1, keepAliveTimeout=3, eventDispatcher=epoll, LSAPI maxconns=1500, PHP_LSAPI_MAX_REQUESTS=2000, PHP_LSAPI_CHILDREN=1499, LSAPI_AVOID_FORK=1, LSAPI_MAX_IDLE=30, persistConn=1, pcKeepAliveTimeout=3, backlog=100, instances=1.

This is on X86_64 Linux 2.6.16.53 #1 SMP with 8GB RAM and dual processor dual-core AMD Opteron 2.2 GHz
Reply With Quote
  #2  
Old 04-14-2008, 03:18 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,585
Your LSAPI configurations are over tuned. Try the following

LSAPI maxconns=150, PHP_LSAPI_MAX_REQUESTS=2000, PHP_LSAPI_CHILDREN=150, persistConn=1, pcKeepAliveTimeout=N/A, backlog=100, instances=1

if the "WaitQ" for the lsphp external app in the real time status report is constantly non-zero, increase "LSAPI maxconns" and "PHP_LSAPI_CHILDREN" to 250.

You need to make sure your MySQL are optimized. LiteSpeed cannot cure bad PHP code either.
Reply With Quote
  #3  
Old 04-14-2008, 06:28 PM
anewday anewday is offline
Senior Member
 
Join Date: Nov 2007
Location: New York
Posts: 723
Isn't 2000 for PHP_LSAPI_MAX_REQUESTS too low? You input 50000 on my server with much less concurrent connections.
Reply With Quote
  #4  
Old 04-14-2008, 08:18 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,585
Quote:
Originally Posted by anewday View Post
Isn't 2000 for PHP_LSAPI_MAX_REQUESTS too low? You input 50000 on my server with much less concurrent connections.
It does not really matter much.
Reply With Quote
  #5  
Old 04-15-2008, 09:10 AM
wkenzie wkenzie is offline
New Member
 
Join Date: Feb 2008
Posts: 6
thanks, I made those changes and went straight to 250 rather than 150 - this morning, which is my busiest time of day, my server load is an acceptable 38 or so - however, my error log shows lots of warnings about running short of concurrent connections, and real-time stats show about 200 "requests in processing" and 63 requests/second and about half the time the WaitQ is > 0 - can I raise this above 250 on my system do you think?

also, is there a better description of these config options, or is it simply a black art ?
Reply With Quote
  #6  
Old 04-15-2008, 09:19 AM
wkenzie wkenzie is offline
New Member
 
Join Date: Feb 2008
Posts: 6
my WaitQ is now over 700 ! with 1050 Requests in Processing !
Reply With Quote
  #7  
Old 04-15-2008, 09:38 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,585
if the requests/second drops to very low number or zero occasionally, you probably need to optimize your SQL or MySQL, MySQL is blocking PHP.

Adding more PHP process may not help the performance.

"Running short of concurrent connections" means that you need to increase server maxConnections maybe to 4000.
Reply With Quote
  #8  
Old 04-15-2008, 12:00 PM
wkenzie wkenzie is offline
New Member
 
Join Date: Feb 2008
Posts: 6
thanks - occasionally WaitQ does drop to 0 but it really fluctuates a lot - I have not seen requests/second drop to anything near 0 - I have maxConnections set to 2000 but it shows 4000 max connections in real time stats - looks like 2 instances are running even though I only configured for 1 instance
Reply With Quote
  #9  
Old 04-15-2008, 01:31 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,585
2-CPU license may double the number.

You can try increase maxconn with lsphp external app see if it helps or not. Just do not over tune it. 500 probably is the maximum.

You need find out where is the bottle neck. some suggestions here
http://www.litespeedtech.com/support...ead.php?t=1944
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


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



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