“How much RAM do I need?” is the first question most people ask when they move a WordPress site from shared hosting to a VPS. The honest answer is that it depends less on WordPress itself and more on everything around it: how many visitors hit uncached pages at the same time, how heavy your plugins are, and whether the database and cache run on the same server. This guide explains where the memory actually goes, gives realistic starting points, and shows how to measure your own site instead of guessing.
Where the memory goes on a WordPress server
A typical self-managed WordPress stack has four main memory consumers:
- PHP-FPM workers. Every uncached request is handled by a PHP worker. Each worker loads WordPress core, your theme and all active plugins, so its size grows with your plugin list. This is usually the largest and most variable part.
- The database (MySQL or MariaDB). Its biggest single setting is the InnoDB buffer pool, which keeps tables and indexes in RAM. MariaDB’s default
innodb_buffer_pool_sizeis 128 MiB. - OPcache. PHP stores compiled scripts in shared memory so it does not recompile them on every request. The default
opcache.memory_consumptionis 128 MB, shared by all workers. - The web server, object cache and the OS. Nginx or Apache, Redis or Memcached if you use them, plus the operating system’s own page cache, which Linux fills with free RAM to speed up disk reads.
Free memory on a Linux server is not wasted; the kernel uses it as file cache. The number that matters is whether your processes ever run out and push the server into swap.
What WordPress and WooCommerce ask for
WordPress has its own memory setting, WP_MEMORY_LIMIT, which is separate from the RAM in your server. By default WordPress tries to raise PHP’s limit to 40 MB on a single site and 64 MB on multisite, and allows up to 256 MB (WP_MAX_MEMORY_LIMIT) in the admin area. WordPress only raises the limit when PHP has less than that value; it never lowers a higher PHP memory_limit.
WooCommerce is more demanding. Its current server requirements ask for a WordPress memory limit of 256 MB or more, PHP 8.3 or newer, and MySQL 8.0+ or MariaDB 10.6+. WordPress itself recommends PHP 8.3+ and MySQL 8.0+ or MariaDB 10.11+. To set the WooCommerce value, add this line to wp-config.php above the “That’s all, stop editing!” comment:
define( 'WP_MEMORY_LIMIT', '256M' );
Keep in mind that this is a per-request ceiling, not what each request uses. Most page views use far less. But it tells you something important: a single heavy request, such as an import, a report or a bulk edit, may use a few hundred megabytes, and your server needs room for that on top of normal traffic.
Realistic starting points
The table below is a starting point for a single server running the web server, PHP and the database together, with a page cache in front of WordPress. It is not a guarantee; plugin choice can easily move a site one row up.
| Site type | Suggested RAM | Notes |
|---|---|---|
| Small brochure site or blog, page cache on | 1–2 GB | 1 GB works for light sites with a full-page cache; add swap as a safety net. |
| Business site with forms, page builder, several plugins | 2–4 GB | Page builders and SEO plugins make PHP workers noticeably larger. |
| Small WooCommerce shop | 4 GB | Cart, checkout and account pages are not cached, so more requests reach PHP. |
| Busy WooCommerce shop, or several sites on one server | 8 GB and up | Give the database a larger buffer pool and add an object cache such as Redis. |
| Large catalogue, heavy search or many concurrent buyers | 16 GB+, or split DB onto its own server | At this point a dedicated server or separate database server often makes sense. |
The WooCommerce rows are higher for a simple reason: logged-in customers, carts and checkout bypass the page cache, so every one of those clicks runs PHP and queries the database. Ten shoppers checking out at once means up to ten busy PHP workers, not ten cached HTML files.
How to measure what your site really needs
Guesses are useful for the first order; measurements are better for the second. On a running server, start with:
free -h
Look at the available column, not free, and check that swap usage is near zero during busy hours. Next, find the average size of your PHP-FPM workers. On Ubuntu 24.04 with PHP 8.3 the process name is php-fpm8.3:
ps --no-headers -o rss -C php-fpm8.3 | awk '{sum+=$1; n++} END {printf "%d workers, %.0f MB average\n", n, sum/n/1024}'
Run it a few times while the site is in use, including in the admin area and during checkout tests. Then check the biggest memory users overall:
ps aux --sort=-rss | head -n 10
Turn the numbers into a PHP-FPM setting
The most common cause of a WordPress VPS running out of memory is a pm.max_children value that allows more PHP workers than RAM can hold. A simple way to size it:
- Take total RAM and subtract what the database, Redis, web server and OS need (check with
psabove). Leave a few hundred megabytes spare. - Divide the remainder by your average PHP worker size.
- Use that number, rounded down, as
pm.max_childrenin/etc/php/8.3/fpm/pool.d/www.conf, then runsudo systemctl restart php8.3-fpm.
If the result is very low, say two or three workers, your server is too small for the site’s uncached traffic, or your plugins are too heavy. Both are worth knowing before a sale or a campaign.
Add swap as a safety net, not as RAM
Swap will not make a small server fast, but it can stop the kernel from killing MySQL during a short spike. If your VPS has no swap, a 1–2 GB swap file is a reasonable cushion:
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
If free -h shows swap in steady use, that is a sign to add RAM rather than more swap.
Ways to need less RAM
- Use a full-page cache. Cached pages are served without starting PHP, which is the single biggest saving for blogs and brochure sites.
- Audit plugins. Deactivate what you do not use and re-measure worker size. Heavy plugins cost memory on every uncached request.
- Size the database deliberately. Set
innodb_buffer_pool_sizeto roughly the size of your database (plus room to grow), not to a value copied from a guide written for a dedicated database server. - Cap Redis. If you add an object cache, set
maxmemoryand an eviction policy such asallkeys-lruso it cannot grow without limit. - Run WP-Cron from system cron on busy sites, so scheduled tasks do not pile onto visitor requests.
RAM is not the only factor
Memory keeps the site from crashing; CPU and disk decide how fast it feels. A WooCommerce checkout is CPU-bound PHP work, so a shop with steady traffic benefits from dedicated cores rather than shared vCPU, which we explain in Shared vCPU vs Dedicated CPU Cores. Database-heavy sites also gain from fast storage; see What Is NVMe Storage and Why It Matters.
Choosing a plan
For a blog or small business site, a Cloud VPS with 2–4 GB of RAM is a sensible start, and Cloud VPS plans start at €4.59/month. For WooCommerce, a Performance VPS with dedicated AMD EPYC cores gives checkout steady CPU time; plans start at €13.69/month, and the 4 GB and 8 GB tiers suit most small shops, for example in Germany for EU shoppers. Whatever you pick, measure with the commands above after a week of real traffic and let the numbers guide the next step.
All servers come unmanaged with full root access. If you would rather not tune PHP-FPM and MySQL yourself, our Managed service covers setup, updates, firewall, monitoring and daily off-server backups. Not sure which size fits your site? Write to support@astrahosting.com with your plugin list and traffic, and we will suggest a plan.