BlogTechnicalHow to avoid 508 Resource Limit Reached errors

How to avoid 508 Resource Limit Reached errors

The ‘508 – Resource Limit is Reached’ error is one that leaves both website owners and people browsing the web a little bemused. In this article we focus on some tips for a website owner to be able to identify the cause and some practical remedies to this common problem amongst people using shared web hosting.

The history of 508 Errors and why they occur

First off, lets look at the history of where ‘508 – Resource Limit Reached’ errors came about. The 508 error was first ratified as a HTTP code in RFC5842, but known as HTTP Error code ‘508 – Loop Detected’ in 2010. Around the same Cloudlinux was being first released with the goal of being able to provide extra security and stability to shared web hosting servers. One of these technologies they introduced was ‘LVE’ or ‘Lightweight Virtual Environment‘ which is a Linux kernel module based off OpenVZ technology that was designed for the web hosting industry, having the core goal of ensuring that a single website cannot bring down a shared web hosting server.

LVE technology allowed shared web hosting providers to be able to limit the amount of resources that a website could consume on a shared hosting server before blocking the account from being able to use more. Back in the shared hosting days before this was in place, it was a common occurrence that a single website could crash an entire shared web hosting server because it had a sudden influx of traffic. When this happened, it would result in server downtime and effect all of the websites hosted on the server. As one could imagine, this wasn’t really fair to the other clients on the server, it being no direct result of their own actions that they had experienced downtime.

When Cloudlinux was released, the web hosting community adopted this new technology at a very rapid pace as it provided more stability for their infrastructure and a fairer system for their clients. All of a sudden, limits were being imposed on shared web hosting accounts that were not there in the past that would restrict the amount of system memory, CPU and PHP processes that a site could utilize at any given moment in time. Presumably, the closest code that Cloudlinux could find in the IANA HTTP codes that would match LVE detecting that a website was using all of it’s resources was the ‘508’ code that had been recently introduced. This became the code that Cloudlinux would use when resource usage was exceeding the limits imposed by LVE and from 2010 on-wards, shared hosting servers became a lot more stable, albeit at the cost of individual websites with high resource usage.

Establishing which limit is causing your ‘508 Resource Limit is Reached’ error

If you are a web site owner and you have detected that on occasion your site is issuing 508 errors to web site viewers, there are methods to identify what is the cause of the 508 errors you are experiencing. The majority of 508 errors are generated by cPanel based servers that are running Cloudlinux. The 508 error is generated by one of two things occurring on the server.

  • Memory usage (your account has exceeded the amount of memory allocated to your cPanel account and there is no available memory allocated to your account for the server to process your request as the memory is in use by other requests on the account)
  • Entry processes exceeded (your account has exceeded the amount of entry processes allowed that can be run simultaneously on the account at the time your request was sent to the web server)

Contrary to belief, CPU limitations do not cause 508 errors directly. If the CPU allocation of an account is reached, it will stay at this maximum and slow down other processes running on the server. This can cause the amount of entry processes to go up as requests cannot be fulfilled as quick as they would be without a limit in place, potentially causing the entry processes exceeded trigger of a 508 error.

If you have cPanel access to your shared web hosting account and the server is running Cloudlinux, there should be an option for you to be able to review your resource usage for the account and ascertain the cause of the 508 error you are experiencing. The option you should be looking for within cPanel is the “CPU and Concurrent Connection Usage” icon, under the “Metrics” group of options.

CPU and Concurrent Connection Usage

Once you have opened this up you are presenting with information that indicates whether or not your site has hit resource limits within the past 24 hour period and has a link to the ‘details’ of your usage of which will outline the cause of any 508 errors along with the the amount of errors that have occurred during that period of time as well as some additional historical data.

An example of the ‘Faults’ section of these graphs is below (taken from an account that is under-resourced):

Cloudlinux-LVE-Faults

As you can see, the website I have taken the above graphic from has had hundreds of 508 errors in the past 24 hour period. Both Entry Processes and Memory usage has been a factor in this site now being able to display to visitors who otherwise would be able to view the content. This will show you which limits have been reached but not necessarily why they were reached in the first place.

Possible Causes of 508 Resource Limits being Reached

There are many potential causes of the 508 error, some of the most common ones are listed below.

Your hosting provider has limits lower than the requirement of your website.

Many hosting providers have low limits so that they can fit many hundreds of hosting accounts on the one server. These limits may be well below the requirements for your website, especially if it is a heavy website (lots of plugins), or running a heavy E-Commerce CMS such as Magento or WordPress / WooCommerce.

The best thing to do in an instance like this would be to find out what limits your web hosting provider has in place (ask them) and perform some concurrency testing to see how many visitors your website can handle simultaneously before the resources are exhausted. If this limit is not high enough then look to either another web host, or another package where you are provided with enough resources to prevent this from happening.

Often it can be the case (if you have a really busy site) that you should not be on shared webhosting at all and that a dedicated solution without limits could be the best thing for your website and your business.

Website traffic spikes

Many times we have seen clients advertise on TV or Radio whilst still being on a shared web hosting package and receive 508 errors. If you are undertaking any activity that will send spikes of traffic to your website you will need to be on a dedicated hosting platform otherwise you may be wasting the valuable exposure that your website should be getting through the advertising you are carrying out.

If you ever are going to get large amounts of web exposure, make sure to be on a platform that can handle this well before the actual spikes occur.

You have rogue processes, back-end jobs or cron jobs that are impacting on your resource usage

Often it could be a backup job, a long query that has been initialised from the back-end of a website or a cron job that carries out high-memory tasks that could be causing your 508 error. Usually the events should coincide with the actions being carried out which makes this a little easier to detect. Especially if you have resource usage errors at the same time that the cron jobs are being carried out or an website administrator is performing tasks in the backend that are causing resources to be consumed.

Web Crawlers, Search Engines or Denial of Service Attacks

Web crawlers or automated scripts that are browsing your website can often be the cause of resource limit depletion. In addition to this, search engines indexing your site at a rapid pace can also cause your resource limits to be exceeded. In addition to this, sometimes malicious entities may be consistently accessing pages on your site that they know will be generating a lot of resource usage in order to Denial of Service your site. Looking through the servers access logs at the time the 508 error is being generated should be able to give you an idea of the activity on the site which has caused the issue and potentially be able to find the IP Addresses that are causing the issue and block them.

Google’s webmaster tools can be used to change the rate in which they index your site if you believe it is Google cause the issue when it is indexing your site. This can be adjusted to a lower rate of requests per second to prevent this from happening.

Poorly scripted plugins or code

Sometimes it can be badly written CMS plugins, theme or custom code that causes 508 errors. Being able to see which processes your account has running often assists in being able to identify files that the site gets stuck on that use up excess CPU or Memory. This is also a major cause of a site being slow when no one else is using the site.

Summary

Unfortunately the 508 limits are an essential part of being able to provide stable web hosting in a shared environment. There are many reasons you may get one and they are the result of your website or web hosting account using more resources than the hosting provider has allocated the account.

If you do receive these on a consistent basis across your site, the most logical thing to do is to move to either a bigger shared hosting package or look at alternatives such as virtual dedicated server hosting in order to ensure that limitations will not cause your site downtime. Sometimes the revenue you are losing as your site is down is far greater than the cost of upgrading to a suitable package for your businesses website.