concept top in category chaos engineering

appears as: top
Chaos Engineering

This is an excerpt from Manning's book Chaos Engineering.

After a minute or two of running it you might notice your VM getting a little sluggish, which is a good hint to check the memory utilization. You can see that by running the top command from the command line, like the following. Note the use of -n1 flag to print one output and exit, rather than update continuously, and -o+%MEM to sort the processes by their memory utilization.

If the download hasn’t finished, please keep it on for the next section. We’ll still need to generate some traffic, while we’re looking at tcptop!

#A here’s the stress command we were seeing in top!

There we go. Here’s our problem - our app (bc command calculating pi) was competing for CPU time with the other commands in the system (stress), and as you can see in the output of top earlier in this section, it wasn’t always winning (stress command tended to get more %CPU allocated). For your convenience, let me repeat that output.

PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
 2893 chaos     20   0    3812    100      0 R  52.9   0.0   0:02.57 stress
 2894 chaos     20   0  265960 183156    324 R  23.5   4.5   0:02.60 stress
 2895 chaos     20   0    4712   1376    264 R  23.5   0.0   0:02.62 stress
 2896 chaos     20   0    3812    100      0 R  17.6   0.0   0:02.64 stress
 2902 chaos     20   0    3168   2000   1740 R  17.6   0.0   0:01.90 bc
 
(...)
Figure 3.10 Datadog website at https://www.datadoghq.com/