Lsphp5 High CPU Usage.

#1
Hello,
When i switch to apache:

When i switch to Litespeed:



I dont like apache and its slow. However this is the only problem that im facing.
Lsphp5 process are using too much CPU usage.
Ive read a couple of threads about the high CPU usage opened by others.
Ive already have an opcode cache: xcache 3.2.0 installed and using PHP 5.6.7.
Tried with Zendopcache too.
Running wordpress with Supercache.
Any help is appreciated. And here is my Litespeed configuration.





 

Pong

Administrator
Staff member
#2
You have 2 CPU license, right?

Try to adjust the Server->General-> PHP SuEXEC Max Conn and External App (lsphp5) -> Max Connections a little lower to see if it helps.

Also check real time stats waitQ during the peak time. If WaitQ > 0 frequently, “PHP suEXEC Max Conn” needs to be increased.

You can also try some methods below to see how it is going.

https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:php:improve-performance
 

mistwang

LiteSpeed Staff
#3
Please check your opcode cache configuration and usage, it is a waste if you reserve too much memory and actually uses a little.
check the number of lsphp processes running.
Check your "top" output to find out the process using too much CPU/memory.
 
#4
From the link that @Pong has mentioned i've put PHP sessions in /dev/shm
Xcaches cache is already to /dev/shm
I decreased the xcache slots from 16k to 4k.
And the cpu usage decreased lol
Its either the slots or the PHP session thing o_O
Either way the outcome is good :D

And one small problem,
I cannot seem to enable Zendopcache.
In the CompilePHP section from the adminpanel it shows only Suhosin,Xcache and memcache.
In the litespeeds php extensions directory there already is an opcache.so
Ive tried setting from php.ini as:
zend_extension=
extension=

Even then it does not show in phpinfo.
And also in the external app " Max Idle Time "
Can i decrease it from 10 to 5 ? will there be 503 errors?
Thankyou :)
 

mistwang

LiteSpeed Staff
#5
Well, if you have Xcache, you do not need to enable opcache. only need one opcode cache.
You can decrease it to 5, no problem. 503 errors are caused by PHP crashes.
 
#6
Ive been struggling with the highcpu usage from time to time.
Even after doing the sessions thing and the xcache one mentioned above the highcpu usage was back.
4 days or so ago i switched to PHP 7.0.0 alpha 1 and used only the modules listed in the wiki:

yum install lsphp70 lsphp70-common lsphp70-gd lsphp70-process lsphp70-mbstring lsphp70-mysqlnd lsphp70-xml lsphp70-mcrypt lsphp70-pdo lsphp70-imap


Code:
https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:php:php-7-installation
Since then i havent had to deal with the lsphp high cpu usage problem at all.
We are running wordpress with some pretty amount of plugins as well.
The maximum load gets to is 2 and most of the time it stays at 1 whilst before the minimum server load always is, about 5-6.

Thought of sharing my experience with this for future viewers.
Note: PHP 7 is still at alpha, And you may come across some problems.

Thankyou.
 
Last edited by a moderator:

mistwang

LiteSpeed Staff
#9
it is due to the new version of PHP engine, not the new version of lsapi. the change is minimum, just API call change to match the engine changes.
 
Top