High CPU Usage, 4CPU 8GB RAM

Hi, My Website is on WordPress, But when I edit/publish posts, CPU usage goes 100%. Multiple users can’t think about editing or publishing posts on my Website. I was checking server stats using CyberPanel>Server Status>Top Processes and I just noticed that only 1 processor is running and 3 sleeping. Screenshot = Screenshot-2022-10-31-001049 hosted at ImgBB — ImgBB

Server & Hosting info
OS: Cent OS 7
Hosted on Linode (4CPU, 8GB RAM)
Panel: CyberPanel
Website Platform: WordPress
Woocommerce: No
PHP: 7.4
Memcached Extension: Disabled
Redis Extension: Enabled
Too many posts/pages: Yes, 2000/2000+
Cache Plugin: Lightspeed Cache
Installed Plugins: 16 (only useful)

Can someone please help me?

Hello @SuperPSX Happy you are here

Considering you are using PHP I believe this is a PHP sessions issue. Just run as sudo user:

# deletes php 7.4 session folders and recreates them
$ rm -rf /var/lib/lsphp/session/lsphp74; mkdir -p /var/lib/lsphp/session/lsphp74; chmod 1733 /var/lib/lsphp/session/lsphp74

Hi Jose, Thank you for your reply. I have a question, Only my 1 Processor working also 3 sleeping? What does sleeping mean?

Well wrong wording. Processors cannot go to sleep. 3 cores are inactive or isolated through cpuset or VPS setting by your provider. Consult your provider.

Or do you mean you have a bunch of processes that are asleep?

Hi, sorry for my bad wording. I’ve attached screenshot where you can see only 1 processor is running and 3 sleeping (inactive). I don’t know how to activate them. I’m facing 100% CPU usage issue when I edit/publish/update posts. I don’t know much about server status I mean how to check and fix it. Please guide

Can you reupload this image here Screenshot-2022-10-31-001049 hosted at ImgBB — ImgBB not any other external service. Click on reply and on the messaging toolbar look for upload option to add your screenshot.


Sleeping processes do not utilize CPU or affect performance. Follow the steps I gave you here High CPU Usage, 4CPU 8GB RAM - #2 by josephgodwinke

Where to put these commands? Putty/SSH?

  1. $ rm -rf /var/lib/lsphp/session/lsphp74
  2. mkdir -p /var/lib/lsphp/session/lsphp74
  3. chmod 1733 /var/lib/lsphp/session/lsphp74

Can I just copy-paste and enter them one by one?

  1. Open SSH terminal using any client
  2. log in as a sudo user or root
  3. copy this command as is:
rm -rf /var/lib/lsphp/session/lsphp74 && mkdir -p /var/lib/lsphp/session/lsphp74 && chmod 1733 /var/lib/lsphp/session/lsphp74

Test by trying to edit several bog posts or have one wp website updating multiple plugins and another try to upload an image

Still same, No changes, I’m gonna upload a video on YouTube for you.

This might be a reason. I missed it ! sorry am multi-tasking

Am convinced becuase here High CPU Usage, 4CPU 8GB RAM - #7 by SuperPSX you are consuming 5gb of RAM in buffer/cache. This must be some technology hogging the system via caching. Try this

$ systemctl status redis.service
$ systemctl stop redis.service
$ systemctl restart lscpd

Then test your server and take a screenshot of your server stats from cyberpanel

Please watch this short video: CPU Usage 100% - YouTube

Just did.

Now post a screenshot of the result of running this command ls /var/lib/lsphp/session/lsphp74

Well we can rule out the php sessions issue unless you are running multiple php versions. To be sure try this:

# start here copy line bleow me
rm -f /var/lib/lsphp/session/lsphp71/* && rm -f /var/lib/lsphp/session/lsphp72/* && rm -f /var/lib/lsphp/session/lsphp73/* 
# then copy line below me
rm -f /var/lib/lsphp/session/lsphp74/* && rm -f /var/lib/lsphp/session/lsphp80/* && rm -f /var/lib/lsphp/session/lsphp81/*