High CPU usage is a very common issue when it comes to shared hosting. Shared server hosts hundreds to thousands of websites and many of them are running PHP processes and MySql queries. There are many WordPress plugins that require more RAM and Processing power to work.
What may create High CPU usage problem
Lot of WordPress installed regardless of they are getting low traffic
Resource consuming plugins installed
Hacked hosting account
Buggy WordPress plugin or a PHP script
Real-time stats collector plugins
High number of online visitors
Self hosted Media streaming
Longer duration Simultaneous download connections
Running frequent and long run cron jobs
WordPress Heartbeat API
All above given things are the potential causes of high CPU usage. Now I am telling you how to resolve most of this kind of issues and how to tweak your hosting account to make it lightest for shared server.
Optimize WordPress database – Clean up database junk
We install and uninstall several WordPress plugins and themes time to time. And when we delete a plugin/theme, it leaves its tables and options in database. With the course of time there is accumulated lots of orphan tables and options in database making database unstable and resource consuming. So it becomes essential to cleanup this unused junk in database. Many free database optimizer plugins are available to install via WordPress repository. But I will recommend WP-Optimize. With the help of WP-Optimize, we can clean unapproved comments, post revisions, comments meta, orphan relationships, orphan tables and options etc.
[Fix] Lots of WordPress installed regardless of they are getting low traffic[Fix] Lots of WordPress installed regardless of they are getting low traffic
This issue many be resolved easily by using a good caching plugin. I recommend you to use W3 Total Cache that can cut 90% load caused by WordPress. But I will also add that if you have over 7-8 WordPress websites on a single shared host, you should buy additional hosting to host some of your blogs to this additional host as every WordPress needs RAM and CPU to run properly and these resources are limited on a shared hosting account.
[Fix] Resource consuming plugins installed
Use P3 Profiler plugin to find out which plugin is causing high load. Having found out about that plugin you should replace that plugin with any other better alternative. For example if All in One SEO plugin is taking higher resources then you should replace it with SEO by Yoast or any other light SEO plugin.
Tip – Deactivate all your plugins and then reactivate them again. Sometime it sorts out the problem and reduces the CPU usage.
[Fix] Hacked hosting account
It is one of the major reason of high CPU usage. This issue can not be resolved easily. You can work manually to resolve this issue or you will have to take help of an expert.
We have a video tutorial for “How to recover and fresh a Hacked WordPress Website“
Generally eCommerce websites need more system resources as they have a powerful ecommerce software in their core. If you are using Woocommerce you need at least 2GB physical RAM and up to 2 CPU cores burstable up to 100% usage. If your host’s CPU limit doesn’t meet these requirements, you should think to change your web hosting. Checkout our recommended hosting list.
[Fix] Real-time stats collector plugins
If you have any tracking plugin installed that collects traffic information of your WordPress website it may cause high load on database server. You can replace that plugin with external trackers such as Histats, Google Analytics, Sitemeter etc.
[Fix] High volume of online visitors
If hundreds of visitors hit your site at once, your hosting account needs more system resources and thus it may be a culprit of high CPU usage on shared server. Using W3 Total Cache plugin (with page cache, browser cache and minify activated), you can reduce load caused by high traffic. CyberDeveloperBD can bear up to 2k – 3k visitors per day with W3 total cache plugin. If your traffic goes up, you should consider buying Managed VPS hosting or Dedicated Server.
[Fix] Media streaming from your hosting account
Media streaming is against of our terms of conditions. So you have to buy VPS hosting for this purpose. Or you can hosting your media file into 3rd party media sharing site like Youtube, Vimeo, Google drive, Dropbox etc and Share in your website to play
[Fix] Longer duration Simultaneous download connections
It is against of our terms of conditions. So you have to buy VPS hosting for this purpose. Shifting your downloads to 3rd party storage websites like Dropbox, Google Drive will fix this issue.
[Fix] Running frequent and long run cron jobs
You must control excessive run of cron jobs and schedule them at that time when Hosting server is least busy. Moreover you can run cron jobs in batch mode to reduce load on CPU. Generally WordPress backup plugins run cron jobs when you schedule backup. Ensure that your backup plugin uses batch mode to create backup and send it to any remote destination. We keep your website backup daily in our remote server. You can restore your website any time from this backup using Restore Manager tools. We strongly recommended that use our remote backup service for your website auto remote back. And it’s free of cost
[Fix] WordPress Heartbeat API function
With Heartbeat API function, WordPress automatically communicates between the web browser and the server. With the help of this function WordPress automatically saves various kind of data including drafts, revisions etc.. It is really a great thing to save post changes automatically as revision and drafts, but sometimes this function sends heavy loads on admin-ajax.php and that is why admin-ajax.php creates high CPU usage.
To resolve this issue, install free plugin Heartbeat Control (from WordPress repository) and locate it it in admin dashboard > Settings. Then configure the plugin as shown in the image below
CloudFlare cuts huge load caused by your websites. CloudFlare prevents spambots from visiting your website and thus saves your website from unwanted and useless traffic. Moreover CloudFlare caching system makes your site faster and lighter. CloudFlare comes free with our all shared hosting packages.
Use External commenting system
By default comments are enable and we can’t ignore the importance of comments for a professional blog. That is why we can’t disable comments. But in fact most of blogs get thousands of spam comments per day that causes heavy load on database server. It is better to disable WordPress default commenting system and use a 3rd party commenting system. I would recommend Disqus.
CloudFlare, However, helps much reduce pressure on the server, but if a content delivery network (that serves media content) was used, it will make all the difference. There are many premium CDN services are available including MaxCDN.
CDN (content delivery network) cuts most of the load delivering most of the site content from itself. A CDN provider can host and serve website images, js and CSS files making your website blazing fast and lighting up your server.
There are two free but of premium quality CDN providers are;
WordPress.com Photon (connects your self hosted WordPress via Jetpack plugin) (subdomain pointing is not available. Images are delivered with the direct links from wordpress.com)
(recommended) Amazon CloudFront (free for one year) (you can set up your own subdomain to deliver content.
Amazon CloudFront can be set up easily with W3Total Cache plugin and you can disable CDN any time.