DevOpsLesson
DevOpsLesson

Free, comprehensive DevOps tutorials and learning roadmaps. Master Docker, Kubernetes, CI/CD, and more.

Stay Updated

Get notified about new tutorials and features.

Tutorials

  • What is DevOps?
  • Docker Tutorial
  • Terraform Tutorial
  • CI/CD Pipeline
  • All Tutorials

Roadmaps

  • DevOps Engineer
  • Cloud Engineer
  • SRE Path
  • All Roadmaps

Company

  • About Us
  • Blog
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 DevOpsLesson. All rights reserved.

DOCKERKUBERNETESTERRAFORMAWSCI/CDLINUXGITDEVOPS ROADMAPCLOUD ROADMAPSRE ROADMAPGIT CHEATSHEETDOCKER CHEATSHEETK8S CHEATSHEETTF CHEATSHEETLINUX CHEATSHEETDOCKERFILE LINTERYAML VALIDATORCRON PARSERREGEX TESTER

Linux Tutorial

Introduction to Linux
Linux Filesystem
Linux Navigation
Linux File Operations
Linux Text Processing
Linux Permissions
Linux Users and Groups
Linux Process Management
Linux systemd Basics
Linux Networking
Linux Disk and Storage
Linux Bash Scripting
Linux Package Management
Linux Environment Variables
Linux Cron Jobs
Linux SSH Keys
Linux Firewall Basics
Linux Log Management
Linux Performance Monitoring and Troubleshooting

Linux Performance Monitoring and Troubleshooting

PreviousPrev

Learn how to inspect CPU, memory, disk, and network behavior on Linux and apply a structured troubleshooting method during performance incidents.

Why Performance Troubleshooting Needs a Method

When a Linux host feels slow, the real bottleneck might be CPU, memory, disk I/O, or network behavior. Guessing based on one symptom usually wastes time.

A better approach is the USE method:

  • Utilization: how busy is the resource?
  • Saturation: is work piling up and waiting?
  • Errors: are failures or drops occurring?

CPU Analysis

top and htop

top
htop

These tools show running processes, CPU usage, memory usage, and load averages. htop is friendlier when installed, but top is usually available by default.

Load averages with uptime

uptime

This shows 1, 5, and 15 minute load averages. A high load number can mean many tasks are running or waiting, not only that CPUs are maxed out.

CPU details with lscpu

lscpu

Use this to learn how many CPUs and cores the system has.

Per-CPU stats with mpstat

mpstat -P ALL 1 5

This is useful when one core is overloaded while others are mostly idle.

Tip: High load average does not automatically mean CPU exhaustion. Disk waits can also raise load.

Memory Analysis

Linux uses memory aggressively for cache, so low raw free memory is not always a problem. What matters is whether the system is under pressure.

free -h

free -h

Look at total, used, free, and especially available memory.

vmstat

vmstat 1 5

vmstat shows process activity, memory, swap, I/O, and CPU state over time. Ongoing swap in or swap out activity can suggest memory stress.

/proc/meminfo

grep -E 'MemTotal|MemFree|MemAvailable|SwapTotal|SwapFree' /proc/meminfo

This provides detailed kernel memory counters and is useful for scripts or deeper inspection.

Note: A system with low free memory but healthy available memory and little swapping may still be fine.

Disk and I/O Analysis

Storage bottlenecks can make the whole server feel slow even when CPU usage looks reasonable.

iostat

iostat -xz 1 5

This helps you inspect device utilization, throughput, and wait times. High utilization plus long waits often points to disk pressure.

iotop

sudo iotop

Use this to find which processes are generating the most disk I/O in real time.

Capacity checks with df and du

df -h
du -sh /var/log/*

df -h shows filesystem usage, while du shows which directories consume space. Full filesystems can break applications, databases, and package managers.

Network Analysis

Network congestion or connection storms can also create performance symptoms.

Socket summaries with ss -s

ss -s

This provides a quick summary of socket states and can help reveal abnormal connection counts.

Interface counters from /proc/net/dev

cat /proc/net/dev

This file shows bytes, packets, drops, and errors for each interface.

Traffic viewers

sudo iftop
sudo nethogs

iftop shows bandwidth by connection. nethogs attributes traffic to processes. They are especially useful when you know the network is busy but not why.

Putting It Together During an Incident

Suppose users report that an API is suddenly slow. A practical first pass could be:

uptime
top
free -h
vmstat 1 5
iostat -xz 1 5
ss -s

You might conclude:

  • very busy CPUs point to compute saturation
  • high I/O wait points to storage delays
  • swap activity points to memory pressure
  • unusually high socket counts point to traffic spikes or connection leaks

This evidence helps you narrow the bottleneck before making changes.

Common Mistakes

Avoid these habits:

  • treating load average as the same thing as CPU percent
  • checking only one metric and stopping there
  • restarting services before collecting enough data
  • failing to compare against a normal baseline

Performance issues often span multiple subsystems, so keep gathering evidence before acting.

What You Should Remember

Break Linux performance work into CPU, memory, disk, and network analysis. Use top, uptime, mpstat, and lscpu for CPU; free -h, vmstat, and /proc/meminfo for memory; iostat, iotop, df, and du for storage; and ss -s, /proc/net/dev, iftop, and nethogs for networking.

Most importantly, use a method such as USE so you troubleshoot from evidence rather than instinct.

Test Your Understanding

Exercise

Exercise 1: Interpreting load average

Why can a high Linux load average appear even when CPU is not fully busy?

Exercise

Exercise 2: Understanding free memory

Which memory value is often more useful than raw free memory for a quick Linux health check?

Exercise

Exercise 3: USE method thinking

In the USE method, what does the S stand for?

PreviousPrev

Continue Learning

Linux SSH Keys

Learn how SSH key authentication works, generate secure keys, configure clients, and manage agents and authorized keys.

20 min·Medium

Linux Firewall Basics

Learn the core ideas behind Linux firewalls and how to use UFW, iptables, and firewalld to allow or block traffic safely.

20 min·Medium

Linux Log Management

Learn where Linux logs live, how to monitor them with tail and journalctl, and how logrotate helps keep log files under control.

15 min·Easy

Explore Related Topics

Do

Docker Tutorials

Run and manage containers on Linux

Gi

Git Tutorials

Master Git version control on the command line

Try the Tool

Cron Parser

Parse and validate cron expressions with a visual schedule preview.

Regex Tester

Test and debug regular expressions used in Bash scripts and configs.

On This Page

Why Performance Troubleshooting Needs a MethodCPU Analysis`top` and `htop`Load averages with `uptime`CPU details with `lscpu`Per-CPU stats with `mpstat`Memory Analysis`free -h``vmstat``/proc/meminfo`Disk and I/O Analysis`iostat``iotop`Capacity checks with `df` and `du`Network AnalysisSocket summaries with `ss -s`Interface counters from `/proc/net/dev`Traffic viewersPutting It Together During an IncidentCommon MistakesWhat You Should RememberTest Your Understanding