Load, memory, and what the numbers mean
Topic 200 is capacity planning, and almost all of it is interpretation rather than commands. This guide reads load, memory, CPU and disk from a deliberately idle machine and is specific about what each number does NOT mean - because the commonest capacity mistakes are misreadings, not missing tools.
201: Capacity Planning Guide 10 of 29 Intermediate
- OSUbuntu 26.04 LTS
- Kernel7.0.0-30-generic
- systemd259
- Block devicesone 50 GB disk
- TimeAbout 21 min
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| LPIC2-A01 | 192.168.0.78 | Ubuntu 26.04 LTS | Primary service host - BIND, Apache, Samba, Postfix. Topic 204 RAID runs on loop devices; this machine has no spare disk | 2 Core | 4 GB | 50 GB |
This guide includes
Use this for capacity planning, which is interpretation rather than commands. This matters because load average is not a percentage - and the memory figure most people read is the wrong one.
- reading load average, which is not a percentage
- reading memory, and the number people misread
- sampling where the time goes, with three tools that share one trap
- finding the two separate ways a disk fills up
Before you start
- the-lab-a-service-needs-a-client
-
Load average is not a percentage
Two numbers together, or neither means anything.
bash Example session uptime; echo "---"; nproc; echo "--- load is runnable+uninterruptible tasks, NOT a percentage" 06:58:29 up 20:29, 1 user, load average: 0.11, 0.12, 0.09---2--- load is runnable+uninterruptible tasks, NOT a percentagecat /proc/loadavg; echo "--- 1min 5min 15min running/total lastpid"0.11 0.12 0.09 1/144 10453--- 1min 5min 15min running/total lastpidExpected result
load average: 0.11, 0.12, 0.09on a machine with 2 CPUs, and1/144runnable out of total tasks.Success conditionYou can say whether a load figure is high without guessing.
-
Memory, and the number people misread
freeis fine.availableis the answer.bash Example session free -h; echo "--- available is the number that matters, not free" total used free shared buff/cache availableMem: 3.3Gi 518Mi 2.3Gi 4.1Mi 781Mi 2.8GiSwap: 3.8Gi 0B 3.8Gi--- available is the number that matters, not freegrep -E '^(MemTotal|MemFree|MemAvailable|Buffers|^Cached|SwapTotal|SwapFree)' /proc/meminfoMemTotal: 3480376 kBMemFree: 2387232 kBMemAvailable: 2954824 kBBuffers: 77488 kBCached: 679708 kBSwapTotal: 4003836 kBSwapFree: 4003836 kBcat /proc/sys/vm/swappiness; echo "--- how eagerly the kernel swaps, 0-100"60--- how eagerly the kernel swaps, 0-100Expected result3.3Gi total, 518Mi used, 2.3Gi free but 2.8Gi available, 781Mi in buff/cache - and swappiness 60 with no swap in use.
Success conditionYou can answer "is this machine short of memory" correctly.
-
Where the time goes
Three sampling tools, and one shared trap.
bash Example session vmstat 1 3 2>/dev/null | tail -3; echo "--- the FIRST line is an average since boot, ignore it" 0 0 0 2389936 77488 723256 0 0 14 20 121 0 0 0 100 0 0 0 0 0 0 2395256 77488 723348 0 0 0 0 135 68 0 0 100 0 0 0 0 0 0 2402484 77488 723348 0 0 0 0 133 67 0 0 100 0 0 0--- the FIRST line is an average since boot, ignore itiostat -x 1 2 2>/dev/null | tail -6 || echo "iostat not installed - sysstat package"loop1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00loop2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00sda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00sdb 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00sar -u 1 2 2>/dev/null | tail -3 || echo "sar has no data yet - sysstat collection may be off"06:58:34 AM all 0.00 0.00 0.00 0.00 0.00 100.0006:58:35 AM all 0.00 0.00 0.00 0.00 0.00 100.00Average: all 0.00 0.00 0.00 0.00 0.00 100.00Expected resultvmstat showing
100idle with no swap activity, iostat with every device at zero, and sar reporting 100% idle across two samples.Success conditionYou can sample CPU and disk over an interval rather than guessing.
-
Two ways a disk fills up
Blocks and inodes are separate limits.
bash Example session df -h / /boot | column -tFilesystem Size Used Avail Use% Mounted on/dev/mapper/ubuntu--vg-ubuntu--lv 48G 6.9G 39G 16% //dev/sda2 2.0G 101M 1.7G 6% /bootdf -i / | column -t; echo "--- inodes: a filesystem can be full with space left"Filesystem Inodes IUsed IFree IUse% Mounted on/dev/mapper/ubuntu--vg-ubuntu--lv 3145728 117327 3028401 4% /--- inodes: a filesystem can be full with space leftsudo -n du -xh --max-depth=1 /var 2>/dev/null | sort -h | tail -5824K /var/backups30M /var/log164M /var/cache190M /var/lib383M /varExpected result48G root at 16% used; 3145728 inodes with 4% used; and
/vartotalling 383M with/var/liband/var/cachelargest.Success conditionYou can diagnose a full filesystem that still reports free space.
Troubleshooting
A high load average is reported as a CPU problem.
Why: Load counts processes running OR waiting - including waiting on disk. A load of 8 on 2 CPUs may be entirely IO.
Fix:Compare against
nproc, then look at what is waiting:vmstat 1shows thebcolumn for blocked processes andwafor IO wait./proc/pressure/iosays how much time was actually lost.freeshows little free memory and the machine is called short of RAM.Why: Linux uses spare memory for cache. The number that matters is
available, notfree- 2.3Gi free against 2.8Gi available here.Fix:Read the
availablecolumn. Cache is reclaimed on demand, so a machine with almost no free memory and plenty available is healthy.A filesystem reports free space and writes still fail.
Why: Blocks and inodes are separate limits. A filesystem full of tiny files exhausts inodes with space to spare.
Fix:
df -hfor blocks anddf -ifor inodes - 4% inode use here against 16% blocks. If inodes are the limit, the fix is deleting files or recreating the filesystem with a different inode ratio.Averages look fine and users report the machine is slow.
Why: An average over a minute hides a stall that lasted seconds.
Fix:Read
/proc/pressure/{cpu,memory,io}, which report the share of time work was actually STALLED.someis any task waiting;fullis everything waiting at once.