How much RAM does my VPS need?
It’s the question that plagues would-be VPS buyers more than any other, save for which operating system to use, perhaps. Or which provider to go with in the first place.
The question of how much RAM to buy is a difficult one, because no two people use their VPSs in precisely the same way. There’s plenty of different applications, configurations, and needs—what works perfectly for one person might be a disaster for someone else.
No one answer is going to work for everyone. Buying a VPS is like buying a car—all leather, an entertainment system for the back seats, and 400HP is overkill for me, but might be the next person’s bare minimum.
And, unfortunately, things don’t work this way:
Can you at least point me in the right direction?
Sure! There are a few standard applications that have either officially published or widely-recognized RAM minimums. If you’re using any of these programs, you can use these numbers as rough estimates.
cPanel is an immensely powerful program, and that comes with a cost: it’s a little RAM hungry. cPanel requires a minimum of 1GB of RAM, and that doesn’t even leave overhead for the applications you’re planning on running.
They even say, “A server that meets only these requirements may not function properly, especially when the server runs certain high demand functions.” So, we recommend adding 1GB of RAM just for cPanel.
WordPress doesn’t publish specific hardware requirements, but we think at least 256MB per site is a fair value—this won’t be fast, but it will work. If you’re handy with tuning (see our MySQL tuning guide), or know how to enable caching, you can push a small amount of RAM a little bit further.
In fact, one expert tuner managed to run a single default WordPress site and a small static site using about 30MB of RAM, so there’s some potential.
If you are going to add an advanced theme and plugins to your WordPress installation, however, RAM usage jumps dramatically, so keep that in mind. And if you require raw speed, you should give WordPress more RAM to work with, hence “>= (greater than or equal) 256MB/each.”
“Of course, more RAM won’t hurt you and will certainly be helpful if you’re also doing other things on the computer.”
2GB of RAM will hopefully be enough for you to stream HD content to a single user on a single stream. If you’re going for multiple users/streams, or are going to do lots of transcoding, you’ll probably need 4 or even 8GB of RAM.
Just as with Plex, if you’re hosting multiple people using ownCloud/Nextcloud regularly, your minimum requirements can jump quickly.
The recommended (but optional) overhead: 1GB
We genuinely recommend giving yourself a little bit of RAM overhead, for a few reasons. First of all, you never know when your blog, business website, or web app might become incredibly popular. There’s nothing worse than crashing right when you need stability the most. Second, more RAM should equal more speed, since you’re not using swap (a slower, disk-based equivalent to RAM).
Finally, it’s just not sustainable, or fun, to eke out your VPS existence. It limits what you can do, how quickly you can do it, and how smooth the whole experience feels.
So, add your numbers up and see what you get. That gives you a rough estimate of what kind of VPS you should be looking at.
What if I’m not using any of those?
Good riddance and good luck, then!
Seriously though, the RAM choice is entirely up to you in this case. Check on your chosen applications to see if they have published minimums/recommendations, or ask around to get a read on other people’s experiences.
Again, it’s not unlike buying a car: Do you want to save money now and hope you won’t need the extra features later, or will you go all-in and hope that you’ll take advantage of them?
Running out of RAM?
SSD Nodes offers 6x RAM per dollar compared to Vultr and 8x RAM per dollar compared to DigitalOcean.
What if I already have a server?
This actually makes the process easier, not harder. Because you already have a server, presumably running the applications you’re most interested in, you have some real-world data.
Try out your websites/applications yourself. Many factors cause general app slowness, such as network congestion, but RAM bottlenecks are a particular annoyance. When your VPS is low on RAM, processes will start to bottleneck. If you have swap, your VPS will use it, but higher disk I/O slows everything down as well. If you know that your connection is solid (try a speed test), and your applications run slowly, it could be a RAM bottleneck.
Check out RAM usage in your VPS provider’s dashboard. If you’re thinking a RAM bottleneck is the likely culprit, it’s time to get some data. Most hosting providers offer charts and graphs that let you monitor your VPS’s performance without you having to install any fancy monitoring systems yourself.
If you’re consistently using a majority of your provided RAM, it’s probably time to upgrade. Or to look into some serious optimizations.
free to see your current RAM usage. Let’s get onto the command line for some more nuanced investigation.
free -mh, a command that polls your VPS for details about RAM and displays the results in “human readable” format. Here’s what it looks like on a typical VPS:
total used free shared buff/cache available Mem: 3.9G 570M 2.0G 43M 1.3G 3.0G Swap: 0B 0B 0B
The results say that I have 4GB of RAM, and have used 570MB. 2GB of RAM is entirely unused. Various system processes (shared and buff/cache) are using 43MB and 1.3GB, respectively—remember, there’s overhead in running any operating system.
The last line—
available—is an estimate of how much RAM is available for starting new applications. In this case, I have a good deal of RAM overhead. If the
available numbers start to drop into the hundreds, or even hover near 0, a bottleneck is forthcoming or already happening.
You can also run
watch free -mh to monitor your RAM usage over time. Run it, play around with your applications, and see how RAM gets utilized in real time.
vmstat as well. If you run
vmstat -a 1 on your VPS, you’ll see an auto-updating chart of your system resources. Pay close attention to these fields:
-----------memory---------- ---swap-- swpd free inact active si so 0 2098816 165540 1589328 0 0
These results show 2GB of RAM available and 0 swap usage. Try using your applications again to see how they affect your RAM usage.
If, for example, every time you load a page on your WordPress blog the numbers under
si go above 0, that means you’re using swap (and thus disk I/O) to serve web pages. Not good. A
free column that approaches 0 also isn’t ideal.
What do I do next?
Buying a new VPS or determining whether your current plan is enough can be tricky. I hope the guidelines and steps I’ve listed above are helpful, but if you’re still unsure, take comfort in the fact that, for the most part, a standard VPS is easy to upgrade.
Not all hosting providers are the same, but SSD Nodes offers zero-downtime upgrades on RAM and other vital resources, such as disk space and transfer. If your RAM is running low, or things just feel sluggish, an upgrade will do you a world of good.
So, if you underestimate your needs, or you unexpectedly go viral, an upgrade can quickly cover your needs.
I’d love to hear real-world RAM experiences with other popular applications, or different strategies for figuring out if you’re reaching your RAM limit—leave a comment, and I’ll add it to the piece. Or, if you know someone who’s stuck in the middle of this exact discussion, send them this way—it’s nice to be the friend or colleague with the right answer for once.