Website Hosting RAM and CPU Requirements
Are you struggling with slow website performance? Have you received an alert about your web hosting account reaching resource limits? Are you seeing 503 resource limit reached errors on your website?Understanding how your website uses RAM and CPU is crucial for optimal hosting. This article will guide you through website resource usage, how to identify when you’re running our of resources, and ways to upgrade or optimise your website to reduce resource usage. We’ll also explore methods to gain an insight in to resource-heavy elements and reduce usage. This guide aims to help you ensure your website runs smoothly and efficiently.
Key Points
- Having enough RAM and CPU are crucial for website performance and user experience.
- Monitoring resource usage helps prevent issues and identify courses of action to ensure good page load times and improved user experience.
- Caching and database optimisation can improve website performance and reduce resource usage.
- Choosing a hosting plan that provides enough resources for your website’s operation is essential for optimal performance.
Web Hosting Resources
Web hosting accounts provide a resource set that your website can use to operate. A resource set typically comprises of RAM, CPU and Entry processes. The resource set that’s provided is usually related to the cost of a hosting account package. A more expensive hosting account package provides more resources, simply because higher resource usage has more expense for a hosting provider. At netnerd we us Cloudlinux to provide, manage, and monitor hosting account package resource sets. We have this in place for all our shared hosting packages. The associated resource limits prevent one account from monopolising resources (which would cause issues for other websites running on the same server) while providing enough resources to allow web services to function on a per account basis.
What is RAM?
RAM, or Random Access Memory, serves as temporary storage for data that the central processing unit (CPU) needs to access quickly. In web hosting, RAM plays a crucial role in managing multiple processes simultaneously, especially for content management systems like WordPress, Drupal and Joomla.
The amount of RAM available affects a website’s performance, particularly when handling complex tasks or high traffic volumes. A website that has the need to store large amounts of data in RAM, that lacks any caching, or that performs background activities such as malware scanning will have a higher RAM overhead compared to websites that don’t function in this manner.
What is CPU?
The Central Processing Unit (CPU) serves as the “brain” of a computer, executing instructions and performing calculations when serving a website’s pages or when an order is placed in an online store. CPUs handle tasks such as executing the PHP code of a CMS that’s require to generate page output, or when making multiple different sized copies of images upon upload.
Having enough CPU resources is crucial for good website performance, as the CPU is used when generating the page output of PHP based websites. If you have enough CPU your website’s performance isn’t hindered, but if your CPU resources start to become exhausted, this can cause symptoms such as sow page load times, or errors being displayed instead of web pages.
Ensuring that you have enough CPU resources is integral to a well performing website.
What are entry processes?
Entry processes in web hosting refer to the number of simultaneous PHP processes that a hosting account can run. The number of PHP processes that open when a website is requested is dictated by how your website is being operated.
As a web hosting provider we use CloudLinux, to limit entry processes effectively and fairly between hosting accounts. This ensures that one website’s heavy usage doesn’t negatively impact other websites on the same server.
Choosing Appropriate Web Hosting.
For optimal performance, website owners should consider their specific needs and choose an appropriate hosting plan, whether it’s shared hosting or a virtual private server:
- WordPress hosting and Unlimited Hosting: Suitable for small business websites, portfolio websites, smaller ecommerce websites and websites with moderate traffic.
- Business hosting and Pro Hosting: Suitable for medium to high traffic blogs, high traffic business websites and larger ecommerce websites.
- Virtual private server (VPS): Ideal for growing websites with increased resource demands, such as large ecommerce website, websites with large databases, and high traffic blogs.
How does a website use server side resources?
Websites utilise server-side resources, including RAM, CPU, and entry processes, when web pages are requested, when websites are updated, and when timed jobs (such as taking backups) take place. RAM usage depends on content complexity and visitor numbers, while CPU demands increase with dynamic elements, the number of plugins in use and database queries. Entry processes, are mostly dictated by traffic, and the amount of automated tasks your website undertakes. Understanding these factors helps optimise for website performance, or to know when to obtain more resources.
How a website uses RAM
Websites utilise RAM to temporarily store and quickly access data. Every request to a PHP based CMS triggers a script execution, consuming RAM. This could be a web page request, PHP querying the site’s database, or you making an update to a page. The more complex your website, the more plugins installed and the larger your site’s database, the more RAM is likely to be consumed. If your website handles a larger volume of requests, more RAM will also be used.
Using opcache can make more efficient use of RAM (whether this is used or not depends on your website). Opcache is used to store precompiled bytecode in RAM. This results in a reduced RAM overhead, as it’s more efficient to use cached data, than for all code to be compiled on the fly (which is how PHP works by default).
The amount of RAM your website uses varies based on its complexity and traffic volume or whether you make use of server side caching mechanisms.
What causes a website to use a lot of RAM
The key concept when operating a PHP based web application or CMS (WordPress, Drupal, Joomla etc) is that the web application executes as a whole, singular program.
There’s not so much of “this is only used when that happens”, it’s more along the lines of “everything happens when anything else is done”. For this reason, it’s a a good idea to consider your website as a whole entity when looking in to resource usage.
The more things that your website does, and the more data it has to handle, the more RAM will be used. Whilst this sounds vague, if you have a lot of data in your site’s database, more RAM is used. If you have a high number of plugins being used, more RAM is used. The more requests your website receives, the more RAM is used.
Not all components of websites consume the same amount of RAM. In the context of WordPress different themes and different plugins all consume varying amounts of RAM.
Plugins that cause a higher amount of database interactions, such as Woocommerce in a large online store will consume more RAM than other plugins. Likewise some themes will cause higher RAM consumption than others, simply due to how they’re written.
Due to the variation in plugins, themes, templates, and components, there isn’t a one size fits all answer to what can use a lot of RAM.
When looking in to RAM related issues, it’s worth considering what aspects of your site handle larger amounts of data, as these are likely to cause greater RAM consumption.
How a website uses CPU
Websites use CPU resources to execute code, handle database queries, and serve content to visitors. Again when operating a PHP based web application or CMS (WordPress, Drupal, Joomla etc) it’s worth considering that the web application executes as a whole, singular program.
The CPU is used for calculation and processing, which usually relates to the execution of your website’s code.
The more processing your website has to do, the more CPU it will use.
What causes a website to use a lot of CPU
The more code that’s contained in the singular program that is your website, the more CPU resources are required for it’s operation. Using a greater number of plugins results in a greater amount of code execution, and a greater CPU overhead. Again, the more requests your website receives, the more CPU is used to serve these requests.
Not all plugins and website components use the same amount of CPU. The amount of CPU usage varies according to what the plugin does, and how much data it uses when doing that it does.
If we use the example of an image optimiser plugin, such as smush, that converts images to web friendly formats upon upload. This is going to use more CPU resources than, for example, a contact form plugin. This is because smush uses CPU when converting the image from one format to the other. Smush is also going to use more CPU when converting a larger image compared to when converting a smaller image.
When looking in to CPU usage, it’s worth considering how much processing certain plugins will carry out. The more processing involved with an activity, the more CPU resources are used. The less code you can execute on each page load the better, caching being a key consideration in reducing CPU usage (which is covered below).
How to tell if you’re running out of resources
Unless you’re proactively monitoring your website’s resource usage, or your hosting provider has resource usage alerts enabled, you’ll usually know if you’re running out resources due to an undesirable situation occurring.
Although these undesirable situations can vary, they’ll usually either take the form of your website’s performance degrading, or error messages being displayed instead of your website’s pages.
Symptoms
Symptoms of resource exhaustion can vary according to the resource that’s exhausted.
If CPU resources become exhausted processor jobs start to queue, and they either take a longer time to complete (due to the queueing) or they time out. You’ll either see website pages loading slowly, or timeouts occurring in the browser when trying to load your website’s pages.
When RAM resources are exhausted you can also see pages taking longer to load. You might also see partial page loads, or error messages being displayed.
When entry processes are reached, error messages are displayed when a new process tries to open.
Error messages
Error messages are often displayed when resource limits are reached:
- 500 internal server error. This error can be caused by factors other than resources being exhausted. A server 500 error can also be caused by RAM being exhausted, as this prevents PHP scripts being processed or database queries completing.
- 508 resource limit reached. This error means that either RAM or entry process limits have been reached (or both).
- 503 service unavailable. This error means that RAM or CPU resources (or both) have been exhausted, which is preventing your website from functioning. PHP can’t be executed when these resource limits have been reached.
Some hosting providers also have resource usage email alerts enabled. We’ve recently started enabling these (which is why I’m writing this blog post) to keep our customers informed of their account’s resource usage.
Monitoring resource usage
We use cloudlinux to both limit and monitor resource usage. In your cPanel there are two areas that display resource usage, one is in a live context, and the other shows usage over time.
The live resource usage shows you what’s happening right now. These statistics are displayed on the right hand side of your cPanel main page (refreshing the page updates these statistics):

You can see the historical resource for specific time periods by clicking on the “resource usage” icon:

On the next page click the “details” button:

And you’ll then be presented with some graphs showing today’s usage so far:

The “timeframe” drop down can be used to select a specific time period or even a date range, and the graphs will then update accordingly:

If you see resources maxing out, you’ll see thin, blue fault lines in the respective graph:

And you’ll also see faults being logged in the graph at the bottom of the page:

These graphs show you the time periods when resource limits were being reached, and exhausted.
What to do if you’re running out of resources
The approximate sum for overall resource usage is:
Resource overhead of website x number of visitors = total resource overhead
If you find running out of resources, as you can’t always do a great deal to restrict visitors (as the purpose of having a website is to make it publicly accessible) you’re faced with a choice of two courses of action:
- Obtain more server side resources.
- Reduce the resource overhead of your website.
How to obtain more server side resources
More server side resources can be gained by upgrading. If you’re using a shared hosting it’s usually the case that there’s another shared hosting package that provides more RAM, CPU and entry processes than the package you’re currently using. This is usually a good option if hosting account resource limits aren’t being reached very frequently. If you find that hosting account resource limits are being reached very frequently, or if you’d like a much greater or dedicated resource set, this can be obtained by upgrading to your own virtual private server (VPS).
It’s a little tricky to state the package you’ll need to upgrade to, as you can only see resource limits being reached, there’s no indication of the required resources. To address this you might consider upgrading incrementally to arrive at a package that suits the overhead of your website, or upgrading to a package a few steps up from the one you’re on, to provider a greater amount of resources in one upgrade.
Upgrading your hosting
The hosting account packages that we offer provide the following resources (quoted prices exclude VAT):
Package | RAM (GB) | CPU Core Availability | Entry Processes | Cost per month | Cost per year |
Starter Hosting | 0.5 | 50% | 15 | N/A | £10 |
Essentials Hosting | 1 | 75% | 20 | N/A | £29.99 |
Unlimited Hosting | 1 | 100% | 30 | £4.99 | £49.99 |
Multisite Hosting | 2 | 150% | 40 | £8.99 | £89.99 |
Business Hosting | 3 | 200% | 50 | £13.99 | £139.99 |
Pro Hosting | 4 | 400% | 50 | £29.99 | £299.99 |
To upgrade from within your netnerd account click on Services > My services:

Then click on the green “active” button on the same line as the package you’d like to upgrade to:

Then click on “upgrade/downgrade” on the left hand side:

Then click “choose product” on the same line as the package you’d like to upgrade to:

And then complete the checkout/payment process. The upgrade is applied a few minutes after payment is received.
Use a VPS
A VPS is a virtual private server. This type of service provides your own server that’s dedicated to the operation of just your website. The hosting packages mentioned above are shared hosting, which is a hosting account on a server that contains hosting accounts belonging to other people. With a VPS, you get your own OS, Web Server, Database Server and Mail Server, and nobody else uses these other than you.
Virtual Private Servers (VPS) offer website owners their own dedicated hosting server. We provide these as a managed service so that you don’t have to suddenly become a server administrator. We do that for you. You can continue to use your cPanel and website just as you have done, but with a greater, dedicated resource set. The VPS we provide and their specifications and prices (which exclude VAT are as follows):
VPS Level | RAM (GB) | CPU Cores | Disk Space (GB) | Price Per Month |
Level 2 | 4 | 2 | 60 | £44.74 |
Level 3 | 6 | 3 | 120 | £54.74 |
Level 4 | 8 | 4 | 200 | £64.74 |
Level 5 | 12 | 6 | 300 | £79.74 |
If you would like to upgrade to a VPS, we’d recommend contacting us or raising a ticket as there will be a migration involved with moving services to a VPS. Whilst we can handle the migration for you, there’s sometimes the need for you to take respective action when the migration takes place.
How to tell what’s using resources
As your PHP application executes as a whole, what’s seen server side as using resources only consists of PHP running against your cPanel user. We don’t see any plugin or theme specific information.
Due to this, the server isn’t the best mechanism to look at when working out what’s using resources.
If you would like to gain some insight into what’s using resources, you’ll need to investigate this from within your CMS (i.e. within your wp-admin area for WordPress or your administrator area for Joomla).
PHP applications and resource monitoring
If you google PHP applications and resource monitoring you’ll often find results referring to application performance monitoring (APM). To be able to do this, you need to install and agent on the hosting server. As this requires root access this isn’t an option for shared hosting, as you won’t be allowed root access for a shared hosting environment.
This leaves you with using plugins (WordPress) or extensions (Joomla) to monitor resource usage.
In the context of WordPress there are a few plugins that can help you work out what part of your WordPress is using a lot of resources. These are the Query Monitor plugin and the Code Profiler plugin.
These plugins won’t tell you exactly what’s using a lot of resources but they will give some indication of things like what’s taking a long time to execute code, what’s generating large amounts of database queries, and which queries are taking a longer time to complete.
Code profiler
Code profiler serves as handy tool for website owners and developers to identify resource-intensive elements within their WordPress. The code profiler plugin is quite easy to use, it’s just install and activate, then start profiling.
You’ll be presented with a bar chart showing what’s taking a long time on a per plugin basis.
Plugins with longer code execution times tend to be running more code and therefore using more resources to function.
Once you’ve identified resource intensive plugins you then have a choice of disabling them, replacing them, or leaving them in place and upgrading to accomodate their overhead.
The downside of the code profiler plugin is that sometimes it won’t capture the slow scenario. If, for example, someone placing an order in your online store causes resource limits to be reached, an order would have to be placed while code profiler is profiling for it to show the resource intensive plugin.
The free version of code profiler shows very rudimentary information, and the paid version will show you more, but you’ll need to take the above into account with either version.
Query monitor
Query monitor is a handy tool to identify resource intensive database operations. This tools tracks database operations in a live context.
You can gain an idea of what’s generating large numbers of queries, and what it’s querying to cause resources to become exhausted.
As with the code profiler plugin you may need to replicate the scenario that causes resources to be exhausted to gain some helpful information.
Once you’ve identified resource intensive plugins you then have a choice of disabling them, replacing them, or leaving them in place and upgrading to accomodate their overhead.
If you find that the problem is more orientated towards large amounts of data being queried you might gain some benefit by using the Index WP MySQL for Speed plugin to add performance keys to tables that contain large amounts of data (make sure you backup your database before trying this).
How to reduce resource usage
Reducing resource usage is crucial for optimising website performance. Effective strategies include implementing caching mechanisms, minimising plugin usage, cleaning databases, and selecting efficient themes. These approaches help lower RAM and CPU demands, ensuring smoother operation and improved loading times for websites hosted on various platforms.
Caching
Caching is a highly effective technique for reducing resource usage in web hosting environments. By storing frequently accessed data in temporary storage, caching minimises the need for repeated database queries and file system operations. This approach significantly reduces CPU and RAM usage, resulting in faster page load times and improved overall website performance.
Website owners can implement various caching methods, including browser caching, server-side caching, and content delivery networks (CDNs). These solutions work together to store static content, database results, and even entire web pages, reducing the workload on the server. By leveraging caching effectively, websites can handle higher traffic volumes without requiring additional server resources, making it a cost-effective optimisation strategy.
We provide opcache and object caching by default with all our shared hosting and VPS offerings. WordPress plugins that can be used to take advantage of these are:
- Redis Object Cache. This only provides object caching, but it’s a very low config plugin and can be used in conjunction with other caching mechanisms.
- WP Fastest Cache. A low config caching plugin. This doesn’t provide object caching or opcache capabilities but can be used with the above.
- W3 total cache. This is a config heavy plugin, but that does provide a granular level of control. This has opcache and object caching functionality.
- Litespeed Cache. This plugin provides opcache, object caching, CDN integration and lots of image optimisation and page output optimisations. You’ll see some benefit from this when operating on an Apache web server, but you’ll gain more benefit when using this plugin on a server using the Litespeed web server. All new hosting packages with netnerd are deployed on litespeed capable web servers.
Reduce the number of plugins
Reducing the number of plugins installed on a website can significantly decrease server resource usage. Each plugin consumes RAM and CPU power, potentially slowing down the site’s performance. Website owners should regularly audit their plugins, removing those that are inactive or redundant, to optimise resource allocation and improve overall site speed.
When selecting plugins, website administrators should prioritise those that offer multiple functionalities in a single package. This approach minimises the total number of plugins required, reducing the strain on server resources. Additionally, choosing well-coded, lightweight plugins from reputable developers can further enhance website performance while maintaining essential features.
Clean the site’s database
Cleaning databases regularly is crucial for reducing resource usage in web hosting environments. By removing outdated or unnecessary data, website owners can significantly decrease the size of their databases, leading to faster query execution and reduced RAM consumption. This process involves deleting old post revisions, spam comments, and unused metadata, which accumulate over time and contribute to database bloat.
The litespeed caching plugin mentioned above provides tools to clean databases in this manner and the WP Optimize plugin also offers these facilities. It’s best to use just one caching plugin so if you use WP Optmimize to clean your site’s database, and have another caching plugin in place, it’s best to just us WP Optimise to clean the database (rather than using it’s other functions which are most likely covered by your caching plugin).
Change theme
Changing a website’s theme can significantly reduce resource usage by implementing a more lightweight design. Website owners should select themes optimised for performance, featuring clean code and minimal reliance on external resources. These efficient themes typically load faster and consume less RAM and CPU power, improving overall site performance.
When choosing a new theme, administrators should consider responsive designs that adapt to various screen sizes without requiring additional plugins. They should also opt for themes with built-in optimisation features, such as lazy loading for images and minification of CSS and JavaScript files. By selecting a resource-efficient theme, website owners can enhance their site’s speed and reduce hosting costs associated with high resource consumption.
Conclusion
Understanding RAM and CPU requirements is crucial for effective website hosting. These resources directly impact site performance, user experience, and overall operational efficiency.
Website owners must monitor resource usage closely to prevent bottlenecks and ensure smooth functionality. Regular performance checks and optimisation strategies help maintain optimal resource allocation.
Choosing the right hosting plan is essential for meeting specific website needs. As sites grow, upgrading to more robust hosting solutions may become necessary to accommodate increased traffic and resource demands.
Effective resource management strategies, such as caching and database optimisation, can significantly improve website performance. Implementing these techniques helps reduce server load and enhances overall site speed:
Frequently Asked Questions
How much RAM and CPU does my website need for optimal performance?
The RAM and CPU requirements for optimal website performance depend on factors like traffic volume, site complexity, and hosting type. Generally, a small to medium-sized website can run efficiently with 1-2 GB of RAM and 1-2 CPU cores. However, for resource-intensive sites or high traffic, more robust specifications may be necessary.
What signs indicate that my website is running out of server resources?
Slow loading times, frequent server errors, and unexpected downtime are key indicators that your website may be running out of server resources. Additionally, high CPU usage, memory exhaustion, and disk space limitations can lead to performance issues and potential service interruptions, affecting your site’s functionality and user experience.
How can I increase the server resources available for my website?
To increase server resources for your website, consider upgrading your hosting plan to a higher tier or switching to a Virtual Private Server (VPS) or dedicated server. These options offer more CPU, RAM, and storage, allowing your site to handle increased traffic and run more efficiently.
Which tools can help identify what’s consuming my website’s server resources?
Server monitoring tools like cPanel’s Resource Usage, the WordPress Code Profiler plugin and Query Monitor plugins can be used to gain insight in to resource usage. These tools provide insights into CPU, memory, giving an indication of high resource usage components.
What strategies can I implement to reduce my website’s resource usage?
To reduce website resource usage, optimise images, enable caching, minify CSS and JavaScript files, and use a content delivery network (CDN). Implement lazy loading for images and videos, remove unnecessary plugins or scripts, and consider using a lightweight theme or framework for your site’s design.
Conclusion
Understanding RAM and CPU requirements is crucial for effective website hosting, directly impacting site performance and user experience. Website owners must closely monitor resource usage to prevent bottlenecks and ensure smooth functionality, implementing optimisation strategies such as caching and database cleaning. Choosing the right hosting plan is essential, with the flexibility to upgrade as sites grow and resource demands increase. By effectively managing server resources, website owners can significantly improve their site’s speed, reliability, and overall operational efficiency, ultimately leading to a better user experience and potentially increased online success.