When you run htop
on a Linux system, you'll notice three distinct load average values displayed near the top of the interface. These represent:
Load average: 1.24 0.89 0.67
The three numbers show the system load over:
1. The last 1 minute (bold)
2. The last 5 minutes (normal)
3. The last 15 minutes (red)
The colors indicate urgency levels:
Bold (1-minute): Immediate system state
Normal (5-minute): Recent trend
Red (15-minute): Baseline for comparison
Consider this output from a server:
Load average: 4.32 1.85 0.92
This shows:
- Current spike (4.32)
- Gradual increase from 15m (0.92) to 5m (1.85)
- Possible short-lived process affecting performance
Here's a Python script to extract and analyze these values:
import os
def get_load_averages():
with open('/proc/loadavg') as f:
load = f.read().split()
return {
'1min': float(load[0]),
'5min': float(load[1]),
'15min': float(load[2])
}
loads = get_load_averages()
print(f"Current load: {loads['1min']:.2f}")
if loads['1min'] > loads['15min'] * 2:
print("Warning: Recent load spike detected!")
Compare load averages to your CPU cores:
- 4-core system with load of 4: 100% utilization
- Same system with load of 8: processes queuing
- Consistently high 15-minute average indicates chronic issues
You can modify the colors in ~/.config/htop/htoprc
:
# Change load average colors
color_scheme=0
load1_color=6
load5_color=2
load15_color=1
When you run htop (or check traditional uptime
), you'll notice three numbers representing system load averages. These represent the system load over the last 1-minute, 5-minute, and 15-minute intervals respectively. The color coding in htop serves as visual indicators:
1. Bold (usually white): 1-minute average
2. Normal: 5-minute average
3. Red: 15-minute average
Contrary to common belief, load averages don't represent CPU usage percentage. They indicate the number of processes:
- Currently running on CPU cores
- Waiting for CPU time (runnable but not executing)
- Blocked on uninterruptible I/O operations
For example, on a 4-core system:
Load average: 4.00 means fully utilized
Load average: 8.00 means processes waiting (2x overload)
Load average: 2.00 means 50% idle capacity
htop uses color to indicate temporal trends:
Color | Interpretation |
---|---|
Bold (1-min) | Immediate system state |
Normal (5-min) | Medium-term trend |
Red (15-min) | Sustained load pattern |
Red coloring typically triggers when the 15-minute average exceeds:
Number of CPU cores × load threshold (usually 0.7)
Here's how to check load averages programmatically in Python:
import os
def get_load_averages():
with open('/proc/loadavg') as f:
loads = f.read().split()[:3]
return [float(x) for x in loads]
one_min, five_min, fifteen_min = get_load_averages()
In Bash, you can extract specific values:
# Get 15-minute average
cat /proc/loadavg | awk '{print $3}'
# Alternative using uptime
uptime | grep -oP '(?<=load average: ).*'