Skip to main content
← All guides

How much memory do you need? (Measuring actual usage)

Memory is the most confusing part of choosing a plan or a dedicated server. If you already have a server in use, the most accurate way to decide is to measure actual usage.

1. Check total server usage

free -h

Rather than used, look at available. That's how much more new programs can actually use. buff/cache is memory Linux borrows for a while and gives back when needed, so you don't need to worry about it. (For what each field means, see Check your server's specs.)

On a Windows server, you can see how much is in use and how much is available in Task Manager (Ctrl + Shift + Esc) → Performance → Memory.

2. Check usage per program

ps -eo pid,rss,comm --sort=-rss | head -n 11

This shows the top 10 programs by memory use. RSS is the memory a program actually occupies, in KB. (1,024 is 1MB; 1,048,576 is 1GB)

On a Windows server, click the Memory column header on Task Manager's Processes tab to sort by usage.

3. Decide based on your busiest times

Memory use peaks when the most users are connected and while backups or updates run. Rather than measuring once and stopping there, log it for a day to find the maximum.

while true; do echo "$(date '+%F %T') $(free -m | awk '/^Mem/ {print "used=" $3 "MB available=" $7 "MB"}')"; sleep 60; done >> ~/mem.log

This writes usage to ~/mem.log every minute. Stop it with Ctrl + C; to keep logging after you close the window, run it inside screen or tmux. Once you've collected enough, find the moment with the least headroom.

sort -t= -k3 -n ~/mem.log | head -n 3

The right specs are ones where available still has plenty left even at that moment. If you're not sure of the exact criteria, we recommend choosing one step up for headroom, as in How to choose VPS specs (recommended specs by use case).

4. What else to consider for each use

  • Minecraft Java server — The server needs the memory you give the game (-Xmx) plus the operating system's share. Leave 1–2GB for the operating system on Linux, and 2–3GB on Windows. Java uses a bit more than what you set with -Xmx, so don't set it to exactly match the server's memory. (Creating a Minecraft server (Java Edition, Paper and vanilla))
  • Windows server — The operating system uses more memory than Linux, so even the same program needs more memory to spare. Some small plans don't let you choose Windows Server. (Shown as "No Windows Server support" on the Pricing page)
  • Discord bot — Most need only a little memory, so for a single bot you can start with the smallest plan. If it does heavy work, like a music bot, choose a plan one step up.
  • Database — The more memory it has, the more frequently used data it can keep in memory while working, which makes it faster.
  • Several programs together — Add up each program's usage at its busiest.

5. What happens when memory runs out

When Linux runs out of memory, it forcibly kills a program. If a program shut down for no apparent reason, check this first.

sudo dmesg -T | grep -i -E "out of memory|killed process"

If anything shows up, it was killed because memory ran out.

  • For now — Adding swap can reduce forced shutdowns, even if things get slower.
  • The real fix — You need a plan with more memory. You can't change the specs of a server you're using, so get a new server and move to it, or if you need a lot of memory, compare dedicated servers too.

If your problem isn't solved, open a ticket on our Discord.