What is Excessive Server Resource Usage and How to Fix it

excessive resource usage common causes and solutions hero image

When you use more resources than your server or hosting plan is capable of handling, it can result in problems such as slow website load times and even outages in extreme cases. Excessive resource usage can be caused by many factors such as poorly coded scripts, cyber attacks, outdated plugins/software, high amounts of traffic due to your site growing larger and more popular over time.

This guide will explain what excessive resource usage is, what can cause it, and how to resolve issues with high resource consumption.

Topics include:

What is Excessive CPU Processing?

On a server the CPU or Central Processing Unit can be thought of much like the brain of the machine, almost any request the server has to deal with is going to require time from the CPU to process that request.

The level of CPU processing for a website should be very minimal compared with local desktop CPU activities. Realizing the impact on the server a CPU intensive website could be having can help prevent you from possibly running into an account suspension for having your account use up an excessive amount of CPU time.

As an example, an average WordPress site with a few plugins enabled on it and no form of caching, will typically consume around 1 second of CPU time, that is, it requires the attention of the CPU for at least 1 second before it can send back to the website visitor the full HTML code for their web-browser to display.

Most CPU activities that happen on the server will be in the range of fractions of a second of CPU time to maybe 5 CPU seconds per execution at most. Where you can begin to run into problems is when you’re doing more intensive CPU activities that typically would be ideal on a desktop CPU, but not a server CPU that is being shared by other users. For more information see the following guide:

If you are wondering “How much ram and CPU does my website need,” you can view your CPU resource usage in cPanel on the right-hand sidebar.

Common Causes of Excessive Resource Usage

Now that you have a basic understanding of server resources, we’re going to explain common reasons a website is causing high CPU usage, and provide solutions.

Database Queries

Inefficient or complex database queries can consume a lot of CPU and memory. Frequent, heavy, and poorly optimized queries can significantly degrade performance and resource usage.

MySQL Activity

This can mean many different things. MySQL refers to your site’s database(s) and mysqld is the server that handles database requests. For example, if you have a WordPress website, it uses MySQL to store your website’s content in a database, and database queries are handled by mysqld.

WordPress and MySQL high CPU usage issues are often caused by long-running MySQL queries (asking the database for too much information) or excessive amounts of querying (asking the database for more information repetitively) which can cause your website to load slowly or even crash. This typically means mysqld is using too much memory.

Optimizing MySQL

As databases grow they may need to be re-indexed. Indexing databases helps speed up how data is retrieved when a query is run. This reduces how hard the server has to work to get the data. Think of database indexes as a table of contents in a book. The index — or table of contents — allows the server to go to the specific place where the data is stored without having to “read” the entire database.

The easiest way to accomplish this is by logging into your cPanel > phpMyAdmin and running the ‘optimize’ or ‘repair’ commands against your database. Please read the following guide:

PHP Activity

Since PHP (and MySQL) are server-side languages, the server has to compile every PHP page and process every MySQL query. This means that when people visit your site, the content must be generated each time, which uses server resources.

Due to this, caching can greatly reduce your resource usage and improve the performance of your website load times. Caching stores PHP pages as static HTML files, so the next time the page is loaded, the content is already available and can be served up much faster with fewer resources. For more detailed information check out the following guide.

Most of InMotion’s higher-end plans include NGINX caching which stores the content in memory so it can be served up even faster. There’s also a tool in cPanel, where you can perform tasks such as enabling and purging cache among other things.

Enabling Caching in WordPress

Since so many sites are using a Content Management System (CMS) such as WordPress, you likely have a caching system in place or can download a third-party plugin to help with caching. We recommend the W3 Total Cache plugin, it includes a tool to help walk you through the setup.

InMotion’s Managed WordPress VPS plans include access to advanced caching options and W3 Total Cache to give you instant performance gains.

Poorly-Coded Scripts, Plugins, or Modules

Poorly written or inefficient code can require more CPU cycles or memory to perform tasks than optimized code. This inefficiency can significantly strain server resources, especially under high traffic conditions.

External services, APIs, or plugins integrated with the website or server can also be sources of resource drain, especially if they are not well-optimized or if they require extensive computation.

Sometimes it’s as simple as updating your plugins and scripts to the latest versions. Most developers will update their code to address resource usage and fix security holes. If your website is custom coded, you may need to examine the code or contact the developers who built the website for you.

Cron Jobs

Cron Jobs are basic task schedulers. This allows you to schedule a script to run in specific increments like every minute, every hour, or every day. Cron jobs that aren’t configured properly or ran too often can cause high server loads which can affect how your site loads.

High Traffic

High traffic isn’t a bad thing. This means your website is getting a lot of visitors, and with the right marketing, you can leverage that traffic into increased sales or whatever your chief objective may be.

However, if your website receives more traffic than it’s capable of handling, it can consume significant server resources such as CPU, memory, and bandwidth. Some ways to reduce the amount of resources used by high-traffic sites are to use a CDN service or take load-balancing measures.

CDN Service

A CDN service can help by hosting your website’s data, such as images or files, on a network of separate servers. These are often located in different locations resulting for faster load times for people visiting your site globally. We recommend the following guides to learn more about this option.

If you have a WordPress powered site there are also 3rd party plugins available to help setup CDN services.

Load Balancing

Load balancing can help reduce high resource consumption by distributing the work over multiple web servers. Drupal and other CMSs have the ability to connect one database with multiple instances of the same site across multiple web servers. Then, you can use software such as HAProxy or the Apache Load Balancer module to determine how traffic is divided across the servers.

At times, we see our customer’s sites being crawled excessively by search engine bots. Having your site indexed by the search engines can be important so people can find your website. There comes a point where the search engines can be over-crawling your site which can affect your site’s ability to function as you have intended it.

Over-crawling your site can mean different things. Google and other search engines can be crawling too many pages of your website, especially ones that you do not want the public to see. Also, over crawling can mean they are making too many requests to the server. To resolve this please review our article on setting a crawl delay in Google Webmaster Tools or how to stop search engines from crawling my site.

Using Robots.txt

Search engines and robots can account for a large percentage of a site’s traffic, and most of this traffic can be unnecessary, so reducing it can save a lot of resources on the server. You don’t want to eliminate search engines altogether, but you should restrict them from being able to access directories that don’t contain content you need to be indexed, and you should block unfamiliar bots and spiders that are frequenting your site. You can identify the spiders and bots crawling your site by looking at your AWstats, and restrict their activity using a robots.txt file. Also, they may be crawling your website too quickly. You can use Webmaster Tools to set a crawl delay to help in this case. Please see our article on how to block search engines from crawling my site and our article on how to set a crawl delay using Webmaster Tools.

Cyber Attacks

In some cases, your high resource usage may be caused by security threats such as brute force attacks, or malware. For example, a brute force attack could cause a major influx of traffic to flood your server with requests, driving up the amount of CPU and memory being used. Taking the steps to secure your server can help you greatly reduce the chances of an unwanted threat. We recommend the following guides to help you protect your online assets.

Image Manipulation

One of the most common instances of excessive CPU processing would be from image manipulation. If you’ve ever loaded up Adobe Photoshop or some other image software on your desktop PC, you might have noticed when you try to resize a large image, or run certain filters on an image it can take a long time to finish. All along you are probably doing this on a dedicated desktop PC that may have two or more processors dedicated solely to your tasks with nothing else going on in the background.

On a server, especially if you’re using shared hosting instead of a VPS or dedicated server, there are multiple CPU cores, but they are constantly being requested to do little spurts of work to fulfill all the various website requests from all the users on the server. When you all of a sudden queue up 50 large image manipulation tasks for the CPU to handle, this can throw a wrench in the server being able to keep up with all requests globally, not to mention it can eat up close to a minute of CPU time per image manipulation, which would equate roughly to the same as serving up a standard WordPress site to 60 unique visitors.

It’s generally recommended when uploading images into an application that is going to resize or manipulate the image data on the server side, that you first use a local desktop image application to optimize the images for the web prior to uploading them. This will allow you to upload more images, faster, and without as much risk to your account’s resource usage becoming excessive.

There are also websites that allow you to upload and optimize images for free, such as the following:

Hotlinking is more common with sites that serve a lot of images, such as gallery sites. Hotlinking is a term that describes when another site directly links to images on your site, and is generally frowned upon and described as “bandwidth stealing.”

You can enable hotlink protection in your cPanel, but be sure to include your addon/parked/sub-domains in the ‘allow’ list so that all your sites function properly. Please see our article on:

CSF Configuration

When it comes to resource usage, you may see or hear mention of ConfigServer Security and Firewall (CSF) configuration. This would only apply to VPS Hosting users since a shared hosting account cannot access or create a firewall. There are server-level security arrangements already in place for shared hosting. But we mention it here for additional context with regard to how CSF can affect resource usage in your web hosting account.

CSF configuration settings such as blocklists or IP deny lists can have a positive impact on resource usage by limiting certain types of traffic such as brute force attacks. Some CSF configurations may rely more heavily on disk I/O in order to perform their functions, which can be another source of increased resource usage.

So having a balance in your configuration is important. Overall, it is necessary to take all these factors into account when configuring CSF in order to ensure that your server has the resources it needs for optimal performance.

Login Failure Daemon (LFD) Emails

When using CSF it includes the Login Failure Daemon also known as LFD. LFD runs periodically (every X amount of seconds) to check for issues such as a process exceeding the allowed amount of memory. If this setting is exceeded, it can automatically send an email to notify you.

Example “Excessive Resource Usage” Email

Here is an example of the type of email message that can be sent due to CSF using more than the assigned memory.

lfd on hostnet.example.com: Excessive resource usage: example1 (31846 (Parent PID:18822))
Time: Thu May 13 23:18:56 2021 -0700
Account: example1
Resource: RSS Memory Size Exceeded: 263 > 256 (MB)
Executable: /opt/cpanel/ea-php72/root/usr/sbin/php-fpm
Command Line: php-fpm: pool example_com
PID: 31846 (Parent PID:18822)
Killed: No

Change CSF Configuration in WHM

In the example above, you can see that a process exceeded the resident set size (RSS) memory setting of 256MB. If this is a necessary process, you can increase the value to allow it to run. We’ll also show you how to increase the setting for “Process Time” errors.

  1. Login to WHM.
  2. Under Plugins select the ConfigServer Security & Firewall option.
  3. Click Firewall Configuration.
  4. Find the PT_USERMEM setting and you can increase the memory setting here.
  5. Scroll down and change the PT_USERTIME setting if you are getting “Process Time” errors.
  6. Click the Change button at the bottom of the page to save your settings.
  7. Finally, click the Restart csf+lfd button.

Disable/Ignore CSF Alerts

If you are getting alerts for valid items you can manually ignore alerts for a command, user, or executable file in the csf.conf file.

  1. Connect to your server via SSH as the root user.
  2. Edit the csf.pignore file using an editor such as vi or nano.
    nano /etc/csf/csf.conf
  3. You can then ignore items by adding the following example rules.
    Disable Alerts for a Command:
    cmd: command name

    Disable Alerts for a User:
    user: userna1

    Disable Alerts for an Executable:
    exe: /home/userna1/public_html/error_log
  4. Save your changes:
    Ctrl+O
  5. Exit the nano editor:
    Ctrl+X
  6. Restart the firewall with the following command:
    csf -r

Everything Your Website Needs to Scale

Launching your website is easier than you think. With up to $2,412 in web hosting savings, bringing your business online is easier and more affordable than ever. Act now to take advantage of this limited time offer.

check mark99.99% Uptime check mark24/7 Human Support check mark100% Money-Back Guarantee

Web Hosting Plans

More Ways to Reduce CPU Usage in WordPress

If your website was built using WordPress, here are some additional ways you can reduce the amount of CPU your site uses. We also recommend bookmarking our WordPress Troubleshooting Techniques guide to help you narrow down the specific cause of problems.

Remove Plugins That Have High CPU Usage

WordPress plugins are created by independent 3rd party developers, so there may be times when they cause problems or are incompatible with other plugins, resulting in high CPU usage. If a plugin is utilizing too many resources it can affect the overall performance of your site. Always ensure that all plugins are up-to-date which can correct known issues. You can also use a tool like Query Monitor by John Blackbourn to view long-running queries from plugins.

We also have information on troubleshooting plugins if you suspect they are causing site issues.

Limit the Heartbeat, Autosave, & Post Revision Settings

The WordPress Heartbeat feature is used to intermittently communicate with your browser and send data using jQuery. It persistently sends updated information in a set amount of seconds anytime you are logged into the Dashboard or editing a page/post. This is to perform tasks such as auto-saving which also saves as a “revision”.

This feature can be helpful in instances where you need to revert or restore a page or post, but there are times when it can drive your CPU usage up unnecessarily. Due to this, you should consider limiting the Heartbeat interval/revisions, or even disabling autosave.

Protect Your WordPress Login Page

Your WordPress login page is a common point of attack for many malicious scripts and malware, and they can often try repetitively. A large number of login attempts can drive your CPU usage up and due to this, you should try to protect your login page.

Use a Real Cron Instead of WP-Cron

When WordPress need to perform a task regularly, it automates them using the wp-cron.php file also referred to as WP-Cron. Tasks such as sending email notifications, checking for core/plugin/theme updates, or scheduling posts. But depending on your specific setup, these tasks can become a heavy load on your server’s CPU.

Another way of performing scheduled tasks is to schedule them as a cron job directly in your cPanel. This typically results in tasks only running on their planned schedule and reduces persistent WP-Cron usage.

Use the Latest Version of PHP 8

Running an up-to-date version of PHP can also help reduce CPU usage. PHP 8 is the latest version and it is considered more efficient and includes improved security and performance. Due to this, running the most recent version of PHP 8 that is compatible with your WordPress site can also help your website run more efficiently.

You can easily change your version of PHP in cPanel

If you have a VPS or Dedicated Server you can install new versions of PHP.

What if I Can’t Reduce My CPU Usage

In some cases, it may not be possible to decrease your usage to levels that are acceptable on a shared hosting platform. You may be wondering, “Why do some websites use so much CPU?” Sites that require larger databases or are controlled by server-driven software (like PHP, Python, and Perl) and/or have larger images and files being hosted naturally require more resources in order to function properly.

Resource usage intensifies as traffic increases, which is why higher-traffic server-interactive sites tend to outgrow a shared platform more easily than static HTML sites. If your website uses 100% CPU, it is generally too resource-intensive for a shared system and an upgrade may be in your best interest.

Upgrading Your Hosting Plan

If you have a high CPU usage website, keep in mind it isn’t always an issue with the site or coding. It’s not uncommon for popular websites to start out on a shared hosting platform and eventually outgrow it. A great way to look at this is by using a basic fish analogy:

Let’s say you buy a small fish and a tank for it to live in. Eventually, the fish grows and is happy and healthy. However, at some point, this fish may have grown too big to live comfortably in the original fish tank you purchased. It may be time to move to another tank to ensure your fish remains happy and healthy. The same thing applies to your websites.

You may have outgrown your current hosting plan, and it might be time to upgrade to a different plan that better suits the needs of your CPU-demanding websites. If this is the case, typically our systems administrators will notify you of the plan you’ll need to upgrade to, which will provide minimum platform requirements to support your website with high CPU usage. For more information please see our article on Upgrading your hosting package in AMP.

In most cases, when you choose to upgrade we will handle moving your account over to the VPS or Dedicated server, and most moves do not result in downtime for your site(s).


Congratulations, now you know what can cause excessive resource usage on your server and how to fix problems with high resource consumption!

IC
InMotion Hosting Contributor Content Writer II

InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!

More Articles by InMotion Hosting

Was this article helpful? Join the conversation!