Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
litespeed_wiki:php:concurrency [2018/09/19 18:41]
Michael Alegre [PHP suEXEC Max Connections]
litespeed_wiki:php:concurrency [2019/03/29 19:27]
Lisa Clarke Proofreading
Line 10: Line 10:
  
 This wiki will go over the ways to control concurrency with different PHP LSAPI setups. This wiki will go over the ways to control concurrency with different PHP LSAPI setups.
-====== PHP suEXEC Max Connections ​======+===== PHP suEXEC Max Connections =====
  
 LSWS offers three different PHP suEXEC modes: [[https://​www.litespeedtech.com/​docs/​litespeed-sapi/​php-lsapi/​suexec-worker|Worker]],​ [[https://​www.litespeedtech.com/​docs/​litespeed-sapi/​php-lsapi/​suexec-daemon-mode|Daemon]],​ and [[https://​www.litespeedtech.com/​docs/​litespeed-sapi/​php-lsapi/​suexec-processgroup|ProcessGroup]]. LSWS offers three different PHP suEXEC modes: [[https://​www.litespeedtech.com/​docs/​litespeed-sapi/​php-lsapi/​suexec-worker|Worker]],​ [[https://​www.litespeedtech.com/​docs/​litespeed-sapi/​php-lsapi/​suexec-daemon-mode|Daemon]],​ and [[https://​www.litespeedtech.com/​docs/​litespeed-sapi/​php-lsapi/​suexec-processgroup|ProcessGroup]].
Line 20: Line 20:
   - ProcessGroup:​ The [[https://​www.litespeedtech.com/​docs/​webserver/​config/​general#​phpSuExecMaxConn|PHP suEXEC Max Conn]] setting sets the default concurrency setting. ​   - ProcessGroup:​ The [[https://​www.litespeedtech.com/​docs/​webserver/​config/​general#​phpSuExecMaxConn|PHP suEXEC Max Conn]] setting sets the default concurrency setting. ​
  
- PHP suEXEC Max Connections can be customized/​overridden at vhost/​account level with the "LSPHP_Workers" ​directive in an Apache configuration file for all three modes:worker, Daemon and ProcessGroup mode+ PHP suEXEC Max Connections can be customized/​overridden at vhost/​account level with the ''​LSPHP_Workers'' ​directive in an Apache configuration file for all three modes:ProcessGroup, Daemonand Worker
  
-For example, ​"40" ​has been set through PHP suEXEC Max Conn setting in web admin console, but you would like to set a little higher as "100" ​for a particular user/​account,​ add the following to the user/​account'​s Apache vhost configuration to override the above setting:+For example, ​''​40'' ​has been set through PHP suEXEC Max Conn setting in web admin console, but you would like to set a little higher as ''​100'' ​for a particular user/​account,​ add the following to the user/​account'​s Apache vhost configuration to override the above setting:
  
   <​IfModule LiteSpeed>​   <​IfModule LiteSpeed>​
     LSPHP_Workers 100     LSPHP_Workers 100
   </​IfModule>​   </​IfModule>​
-====== PHP Non-suEXEC Max Connections ​======+===== PHP Non-suEXEC Max Connections =====
  
 LSWS offers two non-suEXEC PHP modes: Worker and ProcessGroup. LSWS offers two non-suEXEC PHP modes: Worker and ProcessGroup.
  
-In non-suEXEC modes, there is only one PHP user. PHP concurrency is thus controlled by the the number of connections allowed between LSWS and the PHP engine: the External Application [[https://​www.litespeedtech.com/​docs/​webserver/​config/​extapps#​maxConns|Max Connections setting]] ​(WebAdmin > Configuration > Server > External App > your external application).+In non-suEXEC modes, there is only one PHP user. PHP concurrency is thus controlled by the the number of connections allowed between LSWS and the PHP engine: the External Application [[https://​www.litespeedtech.com/​docs/​webserver/​config/​extapps#​maxConns|Max Connections setting]] ​**Configuration > Server > External App > your_external_application**.
  
 One must make sure that your external application is also supplied with enough processes to serve these connections. The number of processes should always be set to be equal the Max Connections. This is set differently depending on your PHP mode: One must make sure that your external application is also supplied with enough processes to serve these connections. The number of processes should always be set to be equal the Max Connections. This is set differently depending on your PHP mode:
  
-  - Worker: Simply set the [[https://​www.litespeedtech.com/​docs/​webserver/​config/​extapps#​instances|Instances setting]] ​(WebAdmin > Configuration > Server > External App > your external application).+  - Worker: Simply set the [[https://​www.litespeedtech.com/​docs/​webserver/​config/​extapps#​instances|Instances setting]] ​**Configuration > Server > External App > your_external_application**.
   - ProcessGroup:​ In ProcessGroup,​ the Instances setting must be set to 1. Control the number of processes instead with the [[https://​www.litespeedtech.com/​docs/​litespeed-sapi/​php-lsapi/​configuration|PHP_LSAPI_CHILDREN environment variable]].   - ProcessGroup:​ In ProcessGroup,​ the Instances setting must be set to 1. Control the number of processes instead with the [[https://​www.litespeedtech.com/​docs/​litespeed-sapi/​php-lsapi/​configuration|PHP_LSAPI_CHILDREN environment variable]].
  
-=====Which setup am I using? ======+===== Determining ​Which PHP Setup is in Use =====
  
 Some users may be confused about which setup they are using. Follow the steps in the [[litespeed_wiki:​php:​which_php_setup_am_I_using|Which PHP setup am I using? wiki]] to figure it out. Some users may be confused about which setup they are using. Follow the steps in the [[litespeed_wiki:​php:​which_php_setup_am_I_using|Which PHP setup am I using? wiki]] to figure it out.
  
  
-====== Reached ​max children process limit? ​======+===== Reached ​Max Children Process Limit ======
  
 You might have already fine-tuned the environment variables such as LSAPI_CHILDREN to 50 but still experienced error message like “Reached max children process limit: 15, extra: 5, current: 20, please increase LSAPI_CHILDREN”. <​env>​LSAPI_CHILDREN=50</​env>​ has been double-checked in lsphp5 external app and seems no problem. Why doesn'​t match? What happened? How to fix it? You might have already fine-tuned the environment variables such as LSAPI_CHILDREN to 50 but still experienced error message like “Reached max children process limit: 15, extra: 5, current: 20, please increase LSAPI_CHILDREN”. <​env>​LSAPI_CHILDREN=50</​env>​ has been double-checked in lsphp5 external app and seems no problem. Why doesn'​t match? What happened? How to fix it?
Line 60: Line 60:
  
 On the other hand, you should verify if it is normal to have so many PHP processes. You may try to enable cache to avoid such high PHP processes. On the other hand, you should verify if it is normal to have so many PHP processes. You may try to enable cache to avoid such high PHP processes.
- + 
 +===== New PHP suEXEC Max Conn Being Ignored ===== 
 + 
 +After you change **PHP suEXEC Max Conn**, for example, from ''​10''​ to ''​20'',​ error messages sometime show as mixed old value ''​10''​ and new setting ''​20''​. Why? 
 +  (14715) Reached max children process limit: 10, extra: 3, current: 13, busy: 12, please increase LSAPI_CHILDREN. 
 +  (28253) Reached max children process limit: 20, extra: 6, current: 26, busy: 26, please increase LSAPI_CHILDREN. 
 +  (14715) Reached max children process limit: 10, extra: 3, current: 13, busy: 12, please increase LSAPI_CHILDREN. 
 +  (28253) Reached max children process limit: 20, extra: 6, current: 26, busy: 26, please increase LSAPI_CHILDREN. 
 +  (14715) Reached max children process limit: 10, extra: 3, current: 13, busy: 12, please increase LSAPI_CHILDREN. 
 +  (28253) Reached max children process limit: 20, extra: 6, current: 26, busy: 26, please increase LSAPI_CHILDREN. 
 +  (28253) Reached max children process limit: 20, extra: 6, current: 26, busy: 26, please increase LSAPI_CHILDREN. 
 +  (14715) Reached max children process limit: 10, extra: 3, current: 13, busy: 12, please increase LSAPI_CHILDREN. 
 +  (28253) Reached max children process limit: 20, extra: 6, current: 26, busy: 26, please increase LSAPI_CHILDREN. 
 +  (28253) Reached max children process limit: 20, extra: 6, current: 26, busy: 26, please increase LSAPI_CHILDREN. 
 + 
 +To make the change effective immediately,​ you will need to restart LiteSpeed Web Server. If LSWS 5.3+ is used, you will also need to restart detached PHPs 
 + 
 +  service lsws restart 
 +  killall lsphp 
 +  
  • Admin
  • Last modified: 2022/10/25 20:03
  • by Lisa Clarke