uptimeHow long the system has run, and its load average
uptime prints one line: the time, how long since boot, how many users are logged in, and the 1, 5 and 15-minute load averages. Load average is the number of tasks running or waiting (for CPU or for disk), so you compare it with the CPU count and watch its trend.
uptime [-p] [-s]Users report the site is slow. uptime is the first, cheapest look at the box.
uptimeprocps-ng uptime: reads /proc/uptime and /proc/loadavg and counts logged-in users.
The time since boot comes from /proc/uptime (seconds since boot, plus total idle seconds summed over all CPUs). The user count comes from the login records in utmp (or systemd-logind). The load averages come from /proc/loadavg. Every 5 seconds the kernel counts tasks that are runnable (R: running or waiting for a CPU) plus tasks in uninterruptible sleep (D: usually waiting on disk or NFS), and folds that number into three exponentially damped moving averages with 1, 5 and 15-minute time constants. So a load of 4.0 on a 4-CPU box means on average 4 tasks wanted to run: fully busy, nobody queueing. Load 8 means tasks waited about as long as they ran. Because D-state tasks count, Linux load can be high while the CPUs are idle; that points to I/O, not CPU.
Every 5 seconds the kernel counts running and disk-waiting tasks and folds the count into 1, 5 and 15-minute averages.
Runnable tasks (state R) are either on a CPU or queued for one. With 4 CPUs, up to 4 run at once and the rest wait.
(none)Time, uptime, users and 1/5/15-minute load averages-pPretty: 'up 1 day, 2 hours, 16 minutes'-sBoot time as YYYY-MM-DD HH:MM:SS/proc/loadavgRaw: 3 averages, running/total tasks, last PID/proc/uptimeRaw: seconds since boot, idle seconds (all CPUs)wSame header line, plus who is logged in and what they runTreating load 8 as bad on every serverLoad is a count of tasks. Load 8 on a 32-CPU box is light; on a 2-CPU box it is a queue four times its capacity.
Divide by nproc: sustained values above 1 per CPU mean queueingAdding CPUs because load is highOn Linux, tasks blocked on disk or NFS (D state) count towards load. If CPUs are idle, more CPUs won't help.
Check top's wa and ps for D-state tasks; look at iostat -xReacting to a single high 1-minute valueThe 1-minute average jumps on short bursts like cron jobs and deploys.
Compare with the 5 and 15-minute values and watch the trendTry these on a Linux machine of your own. Each task has a hint and a solution.
Show when the system booted and how long ago, in words.
Print the load average divided by the number of CPUs (1-minute value).
Count how many processes are currently in each state (R, S, D, ...).
uptimeHow long the system has run, and its load average
uptime prints one line: the time, how long since boot, how many users are logged in, and the 1, 5 and 15-minute load averages. Load average is the number of tasks running or waiting (for CPU or for disk), so you compare it with the CPU count and watch its trend.
uptime [-p] [-s]Users report the site is slow. uptime is the first, cheapest look at the box.
uptimeprocps-ng uptime: reads /proc/uptime and /proc/loadavg and counts logged-in users.
The time since boot comes from /proc/uptime (seconds since boot, plus total idle seconds summed over all CPUs). The user count comes from the login records in utmp (or systemd-logind). The load averages come from /proc/loadavg. Every 5 seconds the kernel counts tasks that are runnable (R: running or waiting for a CPU) plus tasks in uninterruptible sleep (D: usually waiting on disk or NFS), and folds that number into three exponentially damped moving averages with 1, 5 and 15-minute time constants. So a load of 4.0 on a 4-CPU box means on average 4 tasks wanted to run: fully busy, nobody queueing. Load 8 means tasks waited about as long as they ran. Because D-state tasks count, Linux load can be high while the CPUs are idle; that points to I/O, not CPU.
Every 5 seconds the kernel counts running and disk-waiting tasks and folds the count into 1, 5 and 15-minute averages.
Runnable tasks (state R) are either on a CPU or queued for one. With 4 CPUs, up to 4 run at once and the rest wait.
(none)Time, uptime, users and 1/5/15-minute load averages-pPretty: 'up 1 day, 2 hours, 16 minutes'-sBoot time as YYYY-MM-DD HH:MM:SS/proc/loadavgRaw: 3 averages, running/total tasks, last PID/proc/uptimeRaw: seconds since boot, idle seconds (all CPUs)wSame header line, plus who is logged in and what they runTreating load 8 as bad on every serverLoad is a count of tasks. Load 8 on a 32-CPU box is light; on a 2-CPU box it is a queue four times its capacity.
Divide by nproc: sustained values above 1 per CPU mean queueingAdding CPUs because load is highOn Linux, tasks blocked on disk or NFS (D state) count towards load. If CPUs are idle, more CPUs won't help.
Check top's wa and ps for D-state tasks; look at iostat -xReacting to a single high 1-minute valueThe 1-minute average jumps on short bursts like cron jobs and deploys.
Compare with the 5 and 15-minute values and watch the trendTry these on a Linux machine of your own. Each task has a hint and a solution.
Show when the system booted and how long ago, in words.
Print the load average divided by the number of CPUs (1-minute value).
Count how many processes are currently in each state (R, S, D, ...).