General Performance Guidelines
If you have no indication what the cause of a performance degradation might be, start by getting a high-level picture of the system’s state. Then look for signs in the data that might point to a cause.
Use the following guidelines to gain insight into performance data:
Start with the
toptool can unmask problems caused by processes or applications overconsuming CPUs, time, or RAM. If the percent of CPU utilization is consistently high with little idle time, for example, there might be a runaway process. Restart it.
netstat --statisticscommand can identify bottlenecks causing performance issues. It lists interface statistics for different protocols.
netstatreveal no errors, run the
strace ls -alto view every system call.
watchcommand can help dynamically monitor a command to help troubleshoot performance issues:
watch -n0 --differences <command>
You can also combine
vmstatcommand to dig deeper into statistics about virtual memory, processes, block input-output, disks, and CPU activity. Are there any bottlenecks?
You can use the
dstatutility to see the live, running list of statistics about system resources.
systemd-analyzereveals performance statistics for boot time and can help troubleshoot slow system boots and incorrect unit files.
The additional tools that you select depend on the clues that your initial investigation reveals. The following tools can also help troubleshoot performance: