WordPress is the easiest, most popular way to design a website, blog, portfolio, Forum, Event or online store even though you are not a developer. It is a free and open-source content management system written in PHP and paired with a MySQL or MariaDB database.

WordPress comprises plugin architecture and a template system, which helps you customize any website. But while hosting a WordPress on shared hosting, you might have come across CPU related errors.

Here we’re administering the tips to lessen CPU usage with WordPress. Following this guide, you can run high traffic blogs on shared hosting without any excess CPU issues. Assume that you are on the shared server and familiar with the basics of WordPress and cPanel. Here we start!!

What is I/O usage?

I/O (input/output is measured in KB/s) is just the “throughput” or speed of data transfer between the hard disk and the RAM. On a server, a disk I/O describes every process that involves writing to or reading from a storage device which on a shared web hosting server will be the hard disk drive or HDD. I/O processes to an HDD are particularly slow when compared with solid-state memory such as RAM, HDD I/O is, on average, 2,000 times slower.

Why is I/O usage is increased?

Mainly the I/O is caused due to the increase in Data output and input or you can say increased in reading speed and writing speed in the disc. If you are the owner of a VPS or Dedicated server and while creating a ZIP file from the files of 20 and each file is having 10 GB then it will take a lot of time and hence increase in I/O usage.

1. Malware 

If your WordPress site is affected by Malware then be sure to clean it else hacker will try to slow down your website by increasing the load of your website. You can take backup of your plugins and theme folder separately and scan them at Virus Total website. Once you scan you will find the result which plugin is creating this issue so clean it one by one or rather I will suggest you to stop using that plugin or theme. Sometimes DoS attacks, spam attacks, poorly designed PHP scripts consume large amounts of memory and this makes the sense of high I/O usage inside your Cpanel.

2. Backup Plugins

There were several backup plugins that creates the backup for you but who knows that on the background it is doing the input/output of your data to read and write the data in your hard drive or HDD. If your website’s total data size is too high then you will notice the backup plugin is taking too high time to make the backup and your I/O usage is too high and once it is completed you will find I/O usage is reduced.

3. Crawler

If your I/O usage limit is at 400 KBPS and you are receiving more than 400 visitors or Crawler is accessing your pages at a speed of 400 KBPS speed then your website will show there is high I/O usage so in both case either your website is serving the pages or your website is writing the data , both will be included inside the I/O usage.As web spiders that crawl sites too aggressively so there is the chance of increasing the I/O usage of your Cpanel account and results in website slow down.

4. PHP Script

Most Linux servers in today’s shared hosting environment run Apache web servers and their hosting panel is Cpanel. And, most of these support CGI and FastCGI scripts and most popular one is SuPhp – written in a number of languages, such as Perl, Python, and the most popular, PHP. A single site potentially can consume all CPU, IO, Memory resources or Apache processes and this may bring the server to a complete grinding halt.


How to fix high I/O usage?

There were several ways you can minimize the high I/O usage and make your website run faster so I will go straight to the solution by highlighting the detailed steps by which you can completely reduce the high I/O usage issue for your WordPress website.

1.  Install Caching plugin

As our WordPress website runs over PHP and it takes high memory and CPU usage as it serves the PHP files so if we cache the files and convert it to HTML files and serve it to the users then the load of the website will be minimized hence it will reduce the load. You can use several WordPress plugins like W3 Total Cache and Wp Super Cache, Comet Cache, WP Fastest Cache also WP Rocket plugin as a premium one.

2. Use a CDN

Sometimes huge crawler and BOT wants your website to be down hence they increase the crawl rate and continuously surf the pages of your website, this creates your website unreachable or HTTP 508 error so to block these bots or crawler I will suggest you use CDN like CloudFlare as one of my best choices.

3. Use Trusted WordPress Plugins and WordPress Themes

Always remember that not paying for something which should be paid will lead you to pay more than what you have not paid. In short, if you have taken any premium plugin or theme from someone else who has nulled it or cracked it then remember that person also expecting something from you i.e either damage to your website or some kind of malfunctioning of your website. Nothing is free in this world so if you have taken any paid plugin or theme be sure to check it on Virus Total site so that the item is clean.

4. Use Less Plugin

Using too much plugin means too much load on your website as each visitors will be served by the plugin to perform the action so there will be a load on your server too. So better use the only required plugins and remove the rest also make sure do not use any automatic plugin like social poster or auto-schedule posts plugin. Use the Query Monitor plugin to see which plugin is creating the high load on your website and fix the load time by analyzing the result generated by the plugin.

5. Optimizing Cron Jobs (WP-Cron.php)

Cron Jobs are particularly designated programs to automatically ping the server when a request emerges to a page. By default, Cron Jobs ping servers in a specific interval of time which causes extra load on the server.

It noticeably reduces your server resource from the back end. Let’s have a look at the wp-cron pinging effect.

If you are getting 40 visitors to your site every hour, and each of them reads 2-3 pages, then wp-cron.php is being called:

40 x 2.5 = 100 times per hour

100 x 24 = 2,400 times per day

2,400 x 30 = 72,000 times per month!

 

Note: If you have appended something on your PHP to load from an external source and the external site is down, your page will also load slowly.

 

How to Optimize wp-cron.php?

First of all, stop wp-cron.php from running on every page. Do this by opening the file wp-config.php (within WordPress installed folder) and add the following line to the top of the file:

define(‘DISABLE_WP_CRON’, true);

These codes will tell the WordPress engine not to run the wp-cron.php script on every page view. Second, you need to create a way for the wp-cron.php file to run regularly. 

 

To 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<

Note: Replace www.example.com with your blog


We have discussed some of the ways to reduce CPU usage on WordPress blogs. Apart from the mentioned, so many other tiny tips to help you build an error-free shared hosting blog. 

Esta resposta lhe foi útil? 7 Usuários acharam útil (12 Votos)