We’re all familiar with top, a real-time system monitor. Some prefer htop and previously I mentioned iotop for use with storage read/write monitoring. Lets looks at another popular tool for Linux server performance analysis: atop.
Advantages of atop
Atop is an ASCII full-screen performance monitor which can log and report the activity of all server processes. One feature I really like is that atop will stay active in the background for long-term server analysis (up to 28 days by default). Other advantages include:
- Shows resource usage of ALL processes, even those that are closed/completed.
- Monitors threads within processes & ignores processes that are unused.
- Accumulates resource usage for all processes and users with the same name.
- Highlights critical resources using colors (red).
- Will add or remove columns as the size of the display window changes.
- Includes disk I/O and network utilization.
- Uses netatop kernel module to monitor TCP & UDP and network bandwidth.
Once atop is launched, by default, it will show system activity for CPU, memory, swap, disks and network in 10 second intervals. In addition, for each process and thread you can analyse CPU utilization, memory consumption, disk I/O, priority, username, state, and even exit codes.
Install atop on RHEL/CentOS/Fedora Linux
dnf install atop
Install atop on Debian/Ubuntu Linux
apt install atop
Once installed on any distro, you can launch it similar to top using:
Using atop – system & process monitor
A good place to start would be to read the man pages:
Other useful commands:
Launch with average-per-second total values:
Launch with active processes only:
Launch with command line per process
Launch with disk info
Launch with memory info
Launch with network info
Launch with scheduling info
Launch with various info (ppid, user, time)
Launch with individual threads
Once atop is running, press the following shortcut keys to sort processes:
- a – sort in order of most active resource.
- c – revert to sorting by cpu consumption (default).
- d – sort in order of disk activity.
- m – sort in order of memory usage
- n – sort in order of network activity
Guide to reading atop reports/logs
By default after install the atop daemon writes snapshots to a compressed log file (eg. /var/log/atop/atop_20140813). These log files can be read using:
atop -r /full/path/to/atop/log/file
Once you open a log file (eg. atop -r /var/log/atop/atop_20140813) then use t to go forward in 10 minute intervals and T to go back. You can analyse specific times by pressing b then entering the time. The above shortcut keys also work in this mode… a, c, d, m,n.
You can use shortcuts with atopsar. For example, using the flag “-c 30 5” with atopsar will generate a report for current CPU utilization for 5 minutes (ten times with intervals of 30 seconds):
atopsar -c 30 5
Using the flag -A with return all available reports.
But you can limit this to a specific time window using beginning “-b” and end “-e” flags:
atopsar -A -b 11:00 -e 11:15
As you can see, it’s easy to effectively use atop for Linux server performance analysis.
Other popular command line Linux server performance analysis tools