Dstat helps you figure out why your computer is running slow

Slashdot it! Delicious Share on Facebook Tweet! Digg!

Gobbling Up Memory

The memory capacity for older systems is very limited. If such a system does not react as expected and if the results of the CPU metrics are inconclusive, then it could be that a memory hungry process is the culprit. To figure out whether this is true, you should call dstat with the parameters -g -m -s --top-mem and take a look at the pertinent values (Figure 3).

Figure 3: Dstat helps you locate memory hogs quickly.

The relevant fields Paging (-g ), Memory usage (-m ), Swap (-s ), and Most expensive (--top-mem ) have to do with the virtual system memory as well as the real main memory available to applications for completing their tasks.

Normally idle processes do not permanently require memory because the kernel will page out some or all of the memory for an idle process to the hard disk. See the second column in Figure 3 with the heading Page Out . Once this has taken place, additional main memory will become available for other processes. The reverse happens when the system reads the memory back into RAM as soon as the memory is required by the application. See the first column in Figure 3 with the heading Page In .

The Memory Usage area on the other hand indicates the metrics for the real memory. The area tells you how much RAM is currently being used (used ), how much data is in the system queue waiting to be written onto the hard disk (buff ), how much data is in the queue waiting to be read from storage media into RAM (cach ), and how much RAM is still available (free ).

In general, the greater the value in the used column and the smaller the measurement under free , then the greater the system load caused by the programs. If the unused RAM capacity is tending toward zero, then the kernel will begin swapping. This means that it will write memory reserved by the processes onto the hard disk. Since this works considerably more slowly than main memory, the speed of the entire system will slow down. The third area in the output shown in Figure 3 also indicates how much data the kernel has swapped out (used ), and how much capacity is left for swapping (free ).

The --top-mem option, which shows the largest consumer of resources, also gives you information quickly. The benchmarking tool Mbw [6] was used for Figure 3 to determine the amount of memory taken up by the application Compiz. Dstat shows how the kernel increasingly uses paging and moves more and more data into the swap area. This explains why the system reacted slowly when dstat was called.

When looking at memory load, you will find the following relationship. The more actively the swapping and paging is taking place, the slower the system will work. Swapping particularly diminishes the I/O bandwidth available on the hard disk.

Data Throughput

Just as with CPU and RAM work loads, data storage devices containing the operating system and applications will have an impact on the performance of a system. Dstat has options that permit measurements of disk access and data throughput per second. These are usually labeled "Disk I/O" (Figure 4).

Figure 4: Dstat shows a change to green when writing occurs to indicate that there has been a change.

The dstat -d --disk-util --disk-tps command helps to create an overview of all data pertinent to these actions. The Dsk/total (-d ) field shows the throughput for reading and writing for all data storage devices. It also shows the current workload in percentage points for each known storage device. In Figure 4, this is the column sda produced by the option --disk-util . The third area dsk/total indicates the read and write operations per time interval.

It is disconcerting when something like the hard disk work load rises significantly. Once it reaches 100 percent, the system grinds to a halt. At this point, the number of processes queueing for disk I/O (CPU statistics, column wait ) dramatically increases.

Buy this article as PDF

Express-Checkout as PDF

Pages: 4

Price $0.99
(incl. VAT)

Buy Ubuntu User

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content