Have you received a message from our team warning you about ‘excessive resource usage’?
Any website that relies on dynamically generating the page on each load, such as WordPress, will generally use more resources than a static web site. Lots of website traffic to the site also contributes to this.
That's why those that see lots of traffic and interact heavily with the server, may come across this issue and steps will need to be taken to optimise the site, or upgrade to a higher plan that has more server resources available.
Whilst any website is capable of using too many resources, there are some web site platforms that are known for using a lot more including WordPress, Joomla and Drupal among others. That's because these systems store your web site information in a database, and then dynamically generate the page, based on templates and information stored in a database.
A website that uses too many resources can run slowly, which is can cause a bad user experience when people try to visit your website and it's loading slowly.
So what can you do to resolve this? Read our steps below that can help reduce your website resource usage.
Not sure how to implement any of these steps? Our friendly support team are here for you 24x7, and can assist you with implementing any of these changes to your hosting account.Eight Steps to Reduce Resource Usage 1. Disable wp-cron.php and swap to a true scheduled task
By default, WordPress will make a call to the wp-cron.php file on each page load to carry out any scheduled tasks like backups, updates to the site, etc.
However, once you start to get more than a few visitors to your site, this means that this file is being called hundreds of times per day, both by human visitors and by robots who are visiting your site, and this can create high resource usage for even low traffic sites. By swapping it to a true scheduled task in your cPanel, it will reduce your resource usage substantially whilst improving the reliability of scheduled tasks like backups or posts set to publish on a future date.
Read our step-by-step guide to disabling wp-cron.php
2. Password Protect the wp-login.php file
As one of the most popular publishing platforms, your WordPress site is a common attack target for hackers. By adding an extra layer of password protection on your wp-login.php file, it will stop hackers from being able to access that file, and reduce the load on your hosting account generated by brute force attempts to guess a password and gain access to your WordPress admin area.
Read our step-by-step guide to password protecting wp-login.php
3. Enable Caching
You should cache when you can as this will help your website to perform better and load faster.
Caching takes data and stores it in a temporary location so that when a user visits the site again, the pages are accessed from the cache rather than being dynamically generated by the server again.
A site that uses PHP programming language or a MySQL database management system will require the server to compile and process each page and query. Caching will minimise this by storing any PHP pages as HTML files so any page loads in the future will load the cached copy - which means the site will load faster and use less resources.
If you are using WordPress there are a number of caching plugins that you can install. Three of the most popular plugins are:
- WP Rocket
- WP Super Cache
- W3 Total Cache
Read our step-by-step guide to installing WP Super Cache
.4. Enable Cloudflare
Cloudflare provides a free Content Delivery Network, caching platform and firewall that sits between your web site's visitors and your server.
By adding Cloudflare to your web site, you can:
- Stop potential hackers and other threats, before they reach the server
- Speed up your web site with their Content Delivery Network by caching copies of it closer to your visitors
- Reduce the load on your hosting account, by delivering cached copies of your web site to visitors
All of our servers also include Cloudflare Railgun service for free, which usually costs $200 per month. Railgun speeds up the connection between our servers and Cloudflare's network.5. Optimise MySQL Database
SQL databases that aren’t maintained properly when they are edited or as they grow, make it difficult and slower for the server to access the data.
When altering database tables, indexes can be disorganised which makes finding information slower. Re-indexing SQL tables will help by reducing the time it takes to look up the information in the table.
To do this, simply log in to the cPanel and use the MySQL databases and ‘phpMyAdmin’ to manage, optimise, and repair the database if necessary.
Read our step-by-step guide to Optimising your MySQL databases
.6. Enable Hotlink Protection
Hotlinking refers to when another site links directly to the images on your site.
If a third party site is hotlinking to your images it means that every time someone clicks on your image that is stored on your website server and has been linked to the third party website, it's reading off your server. In other words, when someone clicks on that image, it's your server that's using all the resources.
This is called ‘bandwidth stealing’ and hotlink protection can remove this risk.
Enable this in your cPanel. Make sure you include any add-on, parked and sub-domain names in the ‘allow’ list to cover all parts of the site.
Read our guide on Hotlink Protection
.7. Use a Robots.txt File
As we mentioned earlier, the more traffic to your site, the more resources it will use on the server. Unfortunately, a lot of traffic to websites through search engines is often unnecessary.
You don’t want to block all search engine traffic but by restricting the access to directories that don’t contain content that would be indexed, you can save on resources.
‘Spiders’ and ‘bots’ that are accessing your site unnecessarily can be identified by looking at your Awstats or other web analytics reporting tool. You can then restrict their access by using a ‘robots.txt file’.
This is a file that can be added to a root of a document to reduce the risk and impact of ‘bots' crawling the site.
You can also ‘rate limit’ these if they are frequently crawling your website which limits the amount of traffic to and from your website.
A ‘crawl delay’ is a temporary fix that can also help. It is added to the robots.txt file and can be set up using Google's Webmaster Tools.
Read our Guide on the Robots.txt file
.8. Prevent IMAP Activity
IMAP email accounts can be a burden on server CPU resources. Emails on these accounts are stored on servers so by checking your mails, the email client is connecting to the server every time.
If too many users on your web hosting account have IMAP email accounts, you will use more resources. This is because the server will be working hard to synchronise the folders and email headers across various devices where people access their mail. In turn, this causes high CPU usage in your account.
To stop this, we suggest you archive to offline folders and put limits on the email accounts to instruct how many emails to synchronise with and how often. You can also consider switching to POP3 so that emails are stored locally on a personal machine and not on the server.
Read our guide on Reducing Excessive IMAP Activity
.How Can These Steps Help?
The six steps above are simple ways to lower your account's CPU usage and may resolve your problems. These efforts should also help your site run more efficiently and faster at the same time.
If you have tried these steps and are still getting problems with your resource usage, get in touch with our Customer Support Team. Your site may require too many resources for a shared system. Whilst the team cannot offer programming assistance, they are able to help you out by explaining what your options are, including higher resource plans, Managed WordPress Hosting and dedicated servers, depending on your site's needs.