How much RAM, CPU and disk your VPS needs, and how to measure it

As a starting point: 1 GB of RAM runs a bot or a static site, 2 GB one small WordPress site, 4 GB an application together with its database, 8 GB a busy shop. Then run it for a week, measure, and correct. The measuring part takes ten minutes and is described below.

Updated: · Prices in the text are with the public IP (₼10 a month) unless stated otherwise.

Starting points by workload

These are first guesses for a new server, not promises. Your code, plugins and data decide the real figure.

WorkloadvCPURAMDiskPlan to try first
Telegram bot, cron scripts, small static site11 GB30 GBNano
One WordPress site with a page cache, a small API12 GB30 GBStarter
Two small sites, or one with background jobs22 GB40 GBBasic
App + PostgreSQL or MySQL, several small sites, n8n24 GB60 GBStandard
Compiling, image processing: much CPU, little memory44 GB80 GBPlus
WooCommerce or OpenCart shop, database-heavy app48 GB100 GBProfessional
Windows Server, two or three remote desktop users48 GB100 GBProfessional
CI builds with many containers, several client projects612 GB120 GBBusiness
Accounting system plus SQL server, several users816 GB160 GBBusiness Pro
Large database kept mostly in memory1232 GB240 GBEnterprise

Add it up before you buy

If the software is known, a sum is better than a guess. For a PHP site on one server:

  • operating system and SSH, logging, cron: about 400 MB
  • MariaDB with a 512 MB buffer pool, with overhead: about 800 MB
  • PHP-FPM, 10 workers of 60 MB each: 600 MB
  • Redis for object cache: 128 MB

That is roughly 1.9 GB. Add a quarter to a third for the file cache and for peaks, and you land near 2.5 GB. Starter and Basic (2 GB) would be tight. There is no 3 GB plan, so the answer is Standard (4 GB) at ₼49.90 a month with public IP (₼10 of that); the step up from Basic costs ₼12. The page on VPS cost shows the price of every such step.

Measure memory

free -h
ps -eo pid,comm,rss --sort=-rss | head -n 11
sudo journalctl -k | grep -i 'out of memory'

In free, look at available, not at free. Linux uses spare memory as a file cache and gives it back on demand, so a low "free" figure is normal. Watch two things: "available" during your busiest hour should stay above 15–20% of the total, and the third command should print nothing. Any line there means the kernel killed a process because memory ran out.

The rss column is in kilobytes. Processes that share memory, such as PHP or PostgreSQL workers, are counted several times, so treat the sum as an upper limit.

Measure processor time

nproc
top -bn1 | head -n 5
vmstat 5 5

Compare the load average with nproc. A 15-minute load that stays above the number of vCPUs means tasks are waiting. Then read the CPU line in top:

  • us high: your program is computing. Faster code helps, or more vCPU.
  • wa high: processes wait for the disk. More vCPU will not help.
  • st high for long periods: the host is busy with other machines; report it to your provider.

A single-threaded program cannot use a second core. If one process sits at 100% while the rest are idle, extra vCPUs change nothing.

Keep a week of history with sar

One look at 11:00 on Tuesday proves little. sysstat records a sample every ten minutes:

sudo apt update && sudo apt install -y sysstat
sudo sed -i 's/ENABLED="false"/ENABLED="true"/' /etc/default/sysstat
sudo systemctl enable sysstat
sudo systemctl restart sysstat

After a few days:

sar -u    # processor, today
sar -r    # memory, today (kbavail is the useful column)
sar -W    # swapping: pswpin/s and pswpout/s should be near 0
sar -q    # load average
sar -r -f /var/log/sysstat/sa15    # the 15th of this month

Note the peak and the typical value. Size for the peak you must survive, plus a margin of about 25%.

Measure the disk

df -h /
df -i /
iostat -xz 5 3
sudo du -xh --max-depth=2 /var | sort -h | tail

Ignore the first block of iostat: it is an average since boot. In the next ones, r_await and w_await are the waiting times in milliseconds. If they stay in the tens on an NVMe disk while users complain, find the process with sudo pidstat -d 5. Check df -i too: a disk can be full of small files while gigabytes are still free.

Signs of the wrong size

What you seeLikely meaningFirst action
Out-of-memory lines, MySQL restarting by itselfToo little RAM, or too many workersLower worker count, then add RAM
Constant pswpin/pswpout activityWorking set does not fitAdd RAM
Load above vCPU count, us highToo little CPU or slow codeProfile, then add vCPU
wa high, database slowData not cached, or too many writesLarger database cache, check queries
Available RAM above 60% at peak, all monthToo largeChoose a smaller size for the next server
Load under 0.2 on 4 vCPU, all monthToo many coresCombine projects on this server

Swap: a cushion, not memory

A small swap file stops a short peak from killing your database:

sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

If sar -W shows it in use every hour, buy RAM instead. More CPU, RAM or disk can be requested in the panel one by one, so you do not need to change everything at once; compare the cost with the next plan. For database servers, read the separate notes on PostgreSQL and MySQL memory; for shops, the page on e-commerce servers.

On Windows Server, use Resource Monitor (resmon): watch "Available" memory and "Hard Faults/sec" at peak, and the disk queue length.

RAM and sizing questions

Is 1 GB of RAM enough for a VPS?

For a bot, a reverse proxy, a static site or a small script, yes. For WordPress with its database it is too little, and Windows Server needs at least 4 GB, which means the Standard plan.

Why does my server show almost no free memory?

Linux fills unused memory with file cache, which is released when programs need it. Read the "available" column of free: that is the amount you can really use.

Should I add CPU or RAM first?

Look at the evidence. Swapping or out-of-memory messages call for RAM; a load above the core count with high user time calls for CPU; high iowait calls for neither until you have checked the disk and the database cache.

How long should I measure before resizing?

At least one full week, so that weekends, backups and reports are included. For shops and accounting, include a month end or a sale day.

How much headroom should a VPS have?

About a quarter above the measured peak. Since resources can be added later, more than that is usually money spent too early.

Read next

All VPS pages

This page in other languages: Azərbaycanca · Русский · Türkçe

Servers in Baku, prices in manat

Create an account, top up your balance and order the plan you need.