Understanding VPS Resources - RAM, CPU, storage, bandwidth limits and monitoring

📆 · ⏳ 4 min read · ·

Your Node.js app died overnight because it ate all 4GB of RAM on your $3.99 Hetzner server. Your database is crawling because you’re swapping to disk. You just discovered you’re burning through your 20TB bandwidth faster than expected.

You have no idea what “normal” resource usage looks like, so you’re flying blind until something breaks.

Let’s learn how to monitor your VPS resources correctly so that you can first of all see what’s going wrong and ensure it doesn’t happen again.

Essential Monitoring Commands

Check Current Resource Usage

Terminal window
# Quick overview - shows live CPU, memory, disk usage
htop
# Memory usage breakdown
free -h
# Disk space usage
df -h
# CPU usage over time (5 second intervals)
iostat 5
# Network bandwidth usage
iftop -i eth0

Find Resource Hogs

Terminal window
# Top processes by memory usage
ps aux --sort=-%mem | head -10
# Top processes by CPU usage
ps aux --sort=-%cpu | head -10
# Find large files eating disk space
du -h / | sort -hr | head -20
# Check which process is using bandwidth
ss -tuln | grep :80 # Check what's listening on port 80

Historical Resource Usage

Terminal window
# System load average (1, 5, 15 minutes)
uptime
# Memory usage trend
vmstat 1 5 # Shows 5 samples, 1 second apart
# Disk I/O statistics
iostat -x 1 5
# Check bandwidth usage this month
vnstat -m
💡
Load Average Reality Check

On a 1 vCPU system, load average above 1.0 means you’re overloaded. On a 4 vCPU system, above 4.0 is trouble.

Setting Up Basic Monitoring

Install Essential Tools

Terminal window
# Install tools
sudo apt install htop iotop vnstat -y
sudo systemctl enable --now vnstat

Quick Alert Script

# Create /opt/scripts/check-resources.sh
#!/bin/bash
MEM=$(free | awk '/^Mem:/{printf("%.0f"), $3/$2*100}')
DISK=$(df / | awk 'NR==2{gsub(/%/,""); print $5}')
LOAD=$(uptime | awk -F'load average:' '{print $2}' | cut -d',' -f1 | tr -d ' ')
[ $MEM -gt 80 ] && echo "ALERT: Memory ${MEM}%" && ps aux --sort=-%mem | head -3
[ $DISK -gt 85 ] && echo "ALERT: Disk ${DISK}%" && du -sh /var/log
[ $(echo "$LOAD > 1.5" | bc) -eq 1 ] && echo "ALERT: Load $LOAD" && ps aux --sort=-%cpu | head -3
Terminal window
sudo chmod +x /opt/scripts/check-resources.sh
# Run every 10 minutes
echo "*/10 * * * * /opt/scripts/check-resources.sh" | sudo crontab -

Simple Resource Dashboard

Terminal window
# Create a quick status command
echo 'alias status="echo \"=== SYSTEM STATUS ===\"; uptime; echo; free -h; echo; df -h /; echo; ps aux --sort=-%mem | head -5"' >> ~/.bashrc
source ~/.bashrc
# Run it anytime
status

Warning Signs Before Things Break

Memory Problems

Terminal window
# Swap usage indicates RAM pressure
free -h | grep Swap
# Out of Memory Killer logs
dmesg | grep -i "killed process"
# If you see this, processes are being killed due to low memory

CPU Issues

Terminal window
# Load average consistently above number of vCPUs
uptime
# High CPU wait (wa) indicates I/O bottleneck
iostat 1 1
# If %wa is consistently above 20%, you have disk I/O problems

Disk Problems

Terminal window
# Less than 10% free space = trouble incoming
df -h /
# High disk I/O wait times
iostat -x 1 5
# If await > 100ms consistently, your disk is struggling

Network Issues

Terminal window
# Bandwidth usage this month
vnstat -m
# If you're approaching your monthly limit
# Check for DDoS or unusual traffic patterns
ss -tuln | wc -l # Count active connections
netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
PROMOTED Built & launched by me 🚀

Secure Your Digital Legacy Forever

Eternal Vault Logo

A secure digital lockbox with a dead man's switch. When you pass away, your loved ones don't get even ONE EXTRA second to access your bank accounts, investments, or precious memories. Eternal Vault ensures your digital legacy doesn't disappear with you.

Don't Let Your Legacy Disappear

When to Upgrade vs Optimize

Quick Optimizations

Memory issues on 4GB:

  • Add 2GB swap: sudo fallocate -l 2G /swapfile && sudo chmod 600 /swapfile && sudo mkswap /swapfile && sudo swapon /swapfile
  • Disable snapd: sudo systemctl disable snapd.service (saves 50-100MB)

Upgrade when:

  • Swap usage constant
  • Load consistently > 2.0 on 2 vCPU
  • Memory constantly > 80%

CAX11 ($3.99) → CAX21 ($6.99): Double everything (4 vCPU, 8GB RAM, 80GB storage)

What Could Go Wrong

Can’t SSH due to high load: Use your provider’s console and sudo reboot

Emergency cleanup:

Terminal window
# Free disk space
sudo apt autoremove -y && sudo journalctl --vacuum-time=7d
# Kill runaway processes
sudo pkill -f process-name

Reality Check

20 minutes setup saves hours of debugging at night. CAX11 ($3.99) handles a lot with 4GB RAM and ARM efficiency. Upgrade to CAX21 when you consistently hit 80% on any resource.

You may also like

  • # devops

    Initial VPS Setup Checklist - first 30 minutes on a fresh server

    Essential security hardening commands to secure your fresh VPS fast. No lengthy explanations - just the commands that work.

  • # bash# devops

    Automatically Update AWS Security Group with Your Dynamic IP

    Learn how to automate updating your AWS security group with your current IP address using a simple Bash script. Perfect for users with dynamic or CGNAT IPs who need secure, seamless access to their resources like bastion servers.

  • # cloudflare# devops

    How to setup Cloudflare proxy for your website hosted on Vercel or Netlify

    In this article, I will show you how to properly set up Cloudflare proxy for any of your website which is hosted on some other service like Vercel or Netlify.