WordPress is the most powerful platform for professional bloggers and static websites. If you’re using WordPress on Shared hosting or Virtual Private Server for a while, I’m sure that you came across through CPU usage related errors.
How to reduce your WordPress CPU usage without upgrading to new web hosting server? You’re server crash constantly and it might affect your Google ranking, It doesn’t matter if your under high traffic or normal there might be other reasons that your server might be crashing daily or hourly.
Here’s are few things you should keep in mind,
The first priority to uninstall unnecessary plugins from your WordPress website. Sometimes installed plugins can cause CPU usage. Some suggest use maximum 3 or 4 plugins but that isn’t possible to use limited plugins. It’s really hard to figure out which plugin is casing high CPU usage, but you can get some information from logs. If you wanna see logs through WHM/Server Status/Daily Process Log.
In this scenario, we must compromise on visual effects and should focus on blog optimization. ie., concentrate on necessary show ups and avoid eye-catching sliders, related posts plugins etc.
Try avoiding plugins like “Yet Another Related Posts Plugin (YARPP)” which has many issues with their code.
Tip: You need to clean your WordPress installation by removing unnecessary plugins.
2. Using Cache Plugin
There are two most effective cache plugins in the market. Through, some people suggest W3 Total Cache or WP Super Cache. We should recommend you installing WP Total Cache which is free and has some advanced features.
3. CloudFlare Integration
CloudFlare is free Basic CDN service which is quite good, It helps your websites load perfectly and handle some CPU load. It also prevent DDos attacks on your Website through masking your real server IP Address. I will recommend everyone to use CloudFlare and prevent DDos attacks.
4. By Optimizing Cron Jobs (wp-cron.php)
They are specially assigned to ping server automatically and page requests. After installing WordPress the default, Con Jobs ping server with certain interval of time which causes extra load and requests on server. Fortunately it isn’t a must do action at all. So you can regulate the time interval of pinging to higher limit.
If you are getting 50 visitors to your site every hour, and each of them reads 2-3 pages, then wp-cron.php is being called
50 x 2.5 = 125 times per hour
125 x 24 = 3,000 times per day
3,000 x 30 = 90,000 times per month!
Automatic RSS Feed importer plugins also puts heavy load on server performance and memory.
How to optimize wp-cron.php ?
First, you need to stop wp-cron.php from running on every page view. Do this by opening the file wp-config.php (found in the folder where WordPress is installed) and add the following line close to the top of the file.
What that does is tell the WordPress engine not to run the wp-cron.php script on every page view, essentially it disables it. Second, you need to create a way for the wp-cron.php file to run on a regular basis. Usually the best way to do this is a normal cron job. Create a cron job in cPanel that runs every hour and have the cronjob run this command.
wget -O /dev/null http://www.example.com/wp-cron.php?doing_wp_cron
5. Using Light Themes
Light, Simple themes also affect CPU usage and load. There are tons of themes includes built-in features like slider, Advertisement, related posts and more. The number of features you use the higher the chances of high server load. There’s a famous Genesis Framework as it’s running on thousands of authority blogs.
6. Optimizing WP Database
Database the soul of every website and blog. It contains all your data in it, like Posts media url sorting and meta data etc. It indeed a MySQL section. A poorly optimized database table can annoyingly hamper your blog. It uses unnecessary space to store unwanted data which cause lags your blog.
WP-Optimize is a great free plugin to remove post revisions, spam comments, unapproved comments, tables etc. You can save a hell lot space by just running this cool plugin. Remember, a properly optimized database ensures maximum possible speed apart from the server side.
7. By Compressing/Merging Existing Images in your Posts
There’s a saying ” A picture can speak thousand words”. When it comes to blogging, images are most important factor to grab attention of the readers. On the other hand, it can also be used to gain entry search engine traffic by correctly rendering Alt tags.
But excessive insertion will not only slower your blog but also turns as a nuisance to your loyal readers. Whatever it may be, you may reduce maximum picture additions in your blog. Alternatively, you can host your all images in a sub domain which won’t affect your page speed, hence faster response from server.
Most of the hosting companies provide image optimization tools in cPanel. You can either depend any of these free tools or use any 3rd party apps. Also if you are posting long articles which possesses dozens of images, you can split the post to 2 or 3 pages with respect to the length of the article. This method can also be used in comment section if you are getting hundreds of comments in each posts.
8. Updating Possible Functions
Many plugins release newer versions in certain interval of time. Some themes also update as well. Here, if you don’t update these functions properly, it will automatically surpass update requests whenever you load your blog. So update every plugins and themes (including WordPress) as fast as possible.
In short, Always update everything. If there is an update available, you should always go for it. Updates contain security improvements and bug fixes.