CPU Server Process Hogging

Hi all, I am hoping someone can point me in the right direction.

I seem to have ongoing issues with PHP on CyberPanel - more specifically, it being a resource hog.

I am currently running a WooCommerce website, which seems to be taking up a lot of CPU usage during Cron scheduling (product datafeed updates). Using

sudo htop

I can see the website (by username), and the service/command “lsphp” using sometimes upwards of 99% CPU usage. This often occurs around the time the Cron scheduling is due to update products.

I understand that this is a CPU intensive process, however, my main concern is that it completely pulls down CyberPanel & my websites, leaving them inaccessible. Essentially, it’s hogging all of the server resources.

I often find myself at a “503 Service Unavailable” page when trying to log into the CyberPanel admin panel during these times, and my sites remain unresponsive, and I can’t log into PuTTY.

I’m uncertain if the CPU usage being 93.7% is for one core, or the overall server, however, regardless of this, I am assuming the CPU gets overloaded and as result causes thesr 503 errors occasionally.

My question to the community, is how can I configure the server more appropriately to prevent everything from crashing? It’s not reasonable to have the entire server become unresponsive.

Currently, I am running a dedicated sever with:

Intel Xeon E3-1230v6 - 4c/8t - 3.5 GHz/3.9 GHz,
32 GB ECC 2133 MHz, and,
2x2 TB HDD SATA Soft RAID.

How can I better optimize the server to utilize the resources at hand? I have been thinking to upgrade the server to something with 8C/16T, but surely my server, currently, as-is, should suffice? I am not running a site with huge traffic, the only main tasks running at the moment are those Cron Jobs running to update product inventory data twice per day (one in the afternoon, and one at midnight), with no more than 8,000 products, of which, only 2,000-3,000 products will get updated at a time, using WP All Import.

If someone has any PHP or Litespeed configuration adjustments I can make, please let me know.

At the same time do you also see MySQL process using high cpu ?

Hello, not that I noticed. What would be the best way to check this? Just keep an eye on the processes and see if MySQL pops up with high CPU load at the same time?

@usmannasir - I believe it’s happening when my Cron is running a WP All Import product update, however, you wouldn’t expect PHP to consume so much server CPU to the point of causing the entire server to become unresponsive, right?

It seems to be happening every day around the same time, which correlates with when the Cron runs.

Looking at htop, it appears that most of the CPU hogging is coming from lsphp.

It’s the only process that hogs resources. I’ve noticed it accross client servers, with NO Cronjobs setup. It happens usually when there’s an intensive script running (not so intensive for a 4C/8T server tho), such as Sheet Editor, or a bulk-editing tool in Wordpress.

Surely there’s a way to help prevent PHP from hogging CPU usage?

How many products do you have?

I also see that your disk is SATA and not SSD, it could also be playing big role.

But all in all it only looks like matter of less resources not much you can do on the optimization end.

@usmannasir , that doesn’t explain the high CPU usage though? Surely the HDD is not causing these significant issues with CPU hogging. Are you saying 4T/8C CPU isn’t powerful enough to run PHP processes within the CyberPanel/Litespeed package?

This isn’t a good example, but just an idea of how LSPHP is a bit of a resource hog. Most of the time the CPU is free, as exampled below, but I’m seeing a lot of LSPHP commands running resource-intensive operations.

What server specs would you recommend then in this instance? What kind of site can I be expected to run on a 4C/8T CPU server?

The Cron’s that I am running, as mentioned, don’t update all products, they’re ran in synchronous tasks, the import itself consumes very little CPU. I will show you an example below of me running a WP CLI command, to understand the server resource usage. Only one import feed is ran at a time, and it doesn’t trigger LSPHP command frequently, if at all.

More:

Feedback would be appreciated, because this tail-chasing is very frustrating.

You need to understand that when PHP starts executing there is nothing much either LiteSpeed or CyberPanel can do.

It is upto the code that how much resources it takes.

@usmannasir , I completely understand that.

However, how do we know what LSPHP is running in the background? How do we know why it’s using up so much resources. As you can clearly see, LSPHP is not consuming much resources when the Cron is run, so by the same token, it leads me to believe there might be a different underlying issue.

These issues have been ongoing.

What I think you’ve failed to understand, and no offense to you or anyone, but the server SHOULD NOT become unresponsive. The server should not return a 503 Service Unavailable error, as the server should never allow PHP, or any other resource, to consume 100% of the CPU and lock everything up.

This leads me to believe that there’s something else causing the issue, perhaps better configuration is needed for PHP or the server itself? I don’t know, that’s why I reached out in hopes that someone with a bit more experience in terms of setups can guide me towards better configuring the server to ensure the resources aren’t pegged at 100%, as it makes ALL sites, including the CyberPanel login/admin panel NOT work. I hope this makes sense.

I agree but this is more of a question for OLS forum where someone with expertise of such problems.

Because without actually looking into your server I can not tell anything. I would suggest hiring someone with expertise to help you with this.