what is slowing the machine
See whether the processor, the memory or a disk is the bottleneck, and which program is behind it.
Steps
-
uptimethe load over 1, 5 and 15 minutes; compare it with the number of processors (`nproc`)
-
topthe busiest programs, live; on Linux, P sorts by processor and M by memory
-
ps aux --sort=-%cpu | headthe 10 programs using the most processor (Linux)
-
ps aux --sort=-%mem | headthe 10 using the most memory (Linux)
-
free -hmemory and swap in use; a full swap slows everything
-
vmstat 1 5processor, memory, swap and disk waits, every second, five times
-
df -ha full disk slows programs that write to it
Notes
- A load well above the number of processors means programs are waiting their turn.
- A high
wainvmstatortopmeans waiting for a disk:iostat -x 1(from sysstat) shows which one. - macOS:
top -o cpu,top -o mem, andvm_statfor memory.
Commands used
tophtoppsvmstatfree
Each has a page in lore: lore top opens it.
Related recipes
- find what killed a processA program vanished or says "Killed": usually the kernel ran out of memory and stopped it. Find out.
- see a program's memory useHow much memory a program really uses, and which programs use the most.
- add a userCreate an account with a home folder and a password, and let it use sudo if it should.
- count the processorsHow many processors and cores this machine has, and what they are.