هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.
$ مستخدم عادي# بصلاحية root (أو مع sudo)
The quick answer
uptime
10:42:07 up 12 days, 3:10, 2 users, load average: 3.92, 2.10, 1.05
nproc
4
free -h
total used free shared buff/cache available
Mem: 7.7Gi 5.9Gi 210Mi 92Mi 1.9Gi 1.5Gi
Swap: 2.0Gi 1.1Gi 900Mi
ps -eo pid,user,%cpu,%mem,rss,cmd --sort=-%cpu | head -6
ps -eo pid,user,%cpu,%mem,rss,cmd --sort=-%mem | head -6
top -o %MEMRead it like this: load average compared with nproc (4 cores: load 4 = full); memory: look at available, not "free".
Step by step
- Is the CPU full? The three load numbers are the last 1, 5 and 15 minutes. Load higher than the number of cores means work is waiting. In
top, the%Cpu(s)line tells you why:
| Field in top | Meaning | High value means |
|---|---|---|
us | User programs | An app is busy (look at the top process). |
sy | Kernel | Many system calls, network or disk work. |
wa | Waiting for disk I/O | The disk is slow, not the CPU. |
st | Stolen by the hypervisor | The VM host is overloaded (cloud: bigger or other instance). |
id | Idle | Free CPU. |
- Use top well. Keys inside
top:P= sort by CPU,M= sort by memory,1= one line per core,c= full command,k= kill,q= quit. One snapshot for a ticket:
- Is the memory full? On Linux "free" is almost always small — the kernel uses spare RAM as cache (
buff/cache) and gives it back when needed. The real number is available. Swap that is used is fine; swap that is moving all the time is a problem:
vmstat 2 5
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
5 1 1153024 214000 51200 1890000 420 610 980 1200 2100 3900 62 11 9 18 0si/so (swap in/out) above 0 again and again = the server needs more RAM or a smaller app. r = processes waiting for CPU, b = blocked on I/O.
- Find the service behind a process. A PID alone is not enough — find its systemd unit or container:
ps -o pid,ppid,user,etime,cmd -p 2817
systemctl status 2817
systemd-cgtop -msystemctl status PID shows the service of that process; systemd-cgtop shows CPU and memory per service (and per container).
- Did the kernel kill a process because RAM was full? Look for the OOM killer:
journalctl -k --since "-1 day" | grep -iE 'out of memory|oom-kill'
Nov 17 03:12:44 web1 kernel: Out of memory: Killed process 2817 (java) total-vm:9123456kB, anon-rss:6012345kB- Watch over time (the problem is often not there when you look):
The pressure files (PSI) show how much time tasks waited for CPU or memory — avg10=0.00 is good, high values mean real waiting.
Check that it worked
After you fixed the cause (stopped a runaway job, gave the app a memory limit, added RAM): the load falls below the core count within some minutes, available memory stays well above zero, vmstat shows si/so at 0, and no new OOM lines appear in journalctl -k.
Common problems
| Problem | Cause | Fix |
|---|---|---|
| "free" is only 200 MB — is the server out of RAM? | No: the kernel uses free RAM as cache. | Look at available. Only a small available is a problem. |
| High load but CPU mostly idle | Processes wait for the disk (wa, state D). | Check the disk: iostat -x 2 (package sysstat), df -h, slow NFS/SAN. |
| A process uses more than 100 % CPU | It uses more than one core (100 % = one core). | Normal for multi-threaded apps; compare with nproc. |
| An app dies at night, no error in its log | The OOM killer stopped it. | journalctl -k, then give it more RAM or limit it (MemoryMax= in the unit, container --memory). |
st (steal) is high on a cloud VM | The host or a burstable instance (CPU credits) is out of CPU. | Move to another instance type or size. |
| Numbers in a container look wrong | free/top inside a container show the host. | Use docker stats or kubectl top pod. |
Go further
- Command pages: top, free, ps, uptime, systemctl.
- Next how-tos: Kill a process that hangs, Read the logs of a service, Check disk space, Monitor a server with Prometheus, Find out why a server is slow, Find a memory leak in a process.
- Learn it: RH124 — Load average, RHCSA — top, RH134 — Find the load.
- Monitor it for real: Install Prometheus, node_exporter, Grafana.
- Practise: Lab: control jobs, priorities and signals.
1A 4-core server shows a load average of 8. What does that mean?
About twice as much work as the CPUs can do — tasks are waiting (for CPU or for the disk; check wa in top).