The Four Pillars of Server Performance
Every server performance investigation begins with four fundamental resources: CPU, Memory, Disk I/O, and Network. A bottleneck in any one of these areas can cascade into symptoms that appear elsewhere, making systematic monitoring essential for accurate diagnosis.
This guide organizes monitoring tools by these four pillars, progressing from quick command-line checks to enterprise-grade observability platforms.
CPU Monitoring
Quick Assessment: top and htop
The top command provides a real-time view of CPU utilization, process activity, and system load. Key metrics to watch:
htop provides a more visual, interactive experience with per-core utilization bars, tree view for process hierarchies, and easier sorting and filtering.
Deep Analysis: mpstat and perf
# Per-CPU statistics at 1-second intervals
mpstat -P ALL 1
# Identify CPU-intensive functions with perf
perf top -g
perf record -g -p <PID> -- sleep 30
perf report
perf is invaluable for identifying specific functions consuming CPU time. The flame graph visualization (using Brendan Gregg's FlameGraph tools) transforms perf output into an intuitive visual representation of CPU time distribution.
Memory Monitoring
Quick Assessment: free and vmstat
# Memory overview (human-readable)
free -h
# Virtual memory statistics at 1-second intervals
vmstat 1
Key vmstat columns for memory analysis:
Deep Analysis: /proc/meminfo and slabtop
# Detailed memory breakdown
cat /proc/meminfo | grep -E "(MemTotal|MemFree|MemAvailable|Buffers|Cached|SwapTotal|SwapFree)"
# Kernel slab cache usage (root required)
sudo slabtop -o
Critical insight: Linux aggressively caches disk data in RAM. A server showing 95% memory "used" may be perfectly healthy if most of that usage is cache. The MemAvailable field in /proc/meminfo is the most accurate indicator of actual memory pressure.
Disk I/O Monitoring
Quick Assessment: iostat
# Extended I/O statistics at 1-second intervals
iostat -xz 1
Key metrics:
Deep Analysis: iotop and blktrace
# Per-process I/O usage (requires root)
sudo iotop -o
# Block layer tracing for detailed I/O analysis
sudo blktrace -d /dev/sda -o - | blkparse -i -
iotop identifies which processes are generating I/O, while blktrace provides microsecond-level visibility into the block I/O path — essential for diagnosing complex storage performance issues.
Network Monitoring
Quick Assessment: ss and iftop
# Socket statistics (replacement for netstat)
ss -tunapl
# Real-time bandwidth usage per connection
sudo iftop -i eth0
Deep Analysis: sar and nload
# Network interface statistics
sar -n DEV 1
# Real-time network throughput visualization
nload eth0
For packet-level analysis, tcpdump and Wireshark remain essential tools. Use tcpdump to capture traffic on the server and analyze it locally or transfer the capture file to a workstation for Wireshark analysis.
Enterprise Monitoring: Prometheus + Grafana
For production environments, command-line tools are insufficient for ongoing monitoring. The Prometheus + Grafana stack has become the de facto standard for server observability:
Prometheus scrapes metrics from exporters at configurable intervals and stores them in a time-series database. Key exporters for server monitoring:
Grafana provides visualization dashboards, alerting, and annotation capabilities. The Node Exporter Full dashboard (Grafana ID: 1860) provides a comprehensive single-server view that covers all four performance pillars.
Modern eBPF-Based Tools
eBPF (extended Berkeley Packet Filter) enables powerful, low-overhead kernel-level tracing. The BCC (BPF Compiler Collection) and bpftrace tools provide capabilities that were previously impossible without kernel modifications:
# Trace block I/O latency distribution
sudo biolatency-bpfcc
# Trace TCP connection latency
sudo tcpconnlat-bpfcc
# Trace filesystem latency by process
sudo ext4slower-bpfcc 1
These tools are particularly valuable for diagnosing intermittent performance issues that traditional monitoring misses, as they can trace specific kernel functions with microsecond precision and minimal overhead.
Building Your Monitoring Strategy
Effective monitoring transforms server administration from reactive firefighting into proactive infrastructure management. The investment in setting up proper monitoring pays dividends every time it catches a developing issue before it becomes an outage.