Back to lessons

Linux Survival Basics

Read Load Average Before You React

You need a fast snapshot of system load and how long the machine has been running.

Command

uptime

What changed

Nothing changes. The command prints uptime, users, and load averages.

Danger

safe

When to use it

Use at the start of performance triage to see whether pressure is rising or falling.

When not to use it

Do not assume high load always means CPU saturation; blocked I/O can raise load too.

Undo or recovery

No undo needed because this command is read-only.

Expected output

A single line showing current time, uptime, user count, and 1, 5, and 15 minute load averages.

demo script

Disposable terminal steps

  1. uptime
  2. ps -eo pid,ppid,stat,pcpu,pmem,comm,args --sort=-pcpu | head -n 10

simulated output

What it looks like

disposable vessel
::fixture-ready::
$ uptime
 12:32:44 up 18 days,  3:11,  2 users,  load average: 3.91, 2.44, 1.08
::exit-code::0
$ ps -eo pid,ppid,stat,pcpu,pmem,comm,args --sort=-pcpu | head -n 10
  PID  PPID STAT %CPU %MEM COMMAND         COMMAND
 1842     1 R    86.4  4.2  app-worker     /srv/app/worker --jobs
 1907     1 S    12.8  1.1  nginx          nginx: worker process
 2011     1 S     4.5  7.9  postgres       postgres: checkpointer
::exit-code::0

YouTube Short

Read server pressure fast.

uptime gives the one, five, and fifteen minute load averages so you can see whether pressure is new or sustained.

LinkedIn hook

A high load number is a clue, not a diagnosis.

Question: Do you read load average as a trend or a single number?

experiments

A/B tests to run

Metric: comment_rate

A: High load is a clue.

B: Compare 1, 5, and 15 minutes.