This shows you the differences between two versions of the page.
ep:labs:03:contents:tasks:ex2 [2020/10/25 16:20] cristian.marin0805 [02. [10p] Iostat] |
ep:labs:03:contents:tasks:ex2 [2022/09/13 12:59] (current) radu.mantu [02. [30p] iostat & iotop] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ==== 02. [10p] Iostat ==== | + | ==== 02. [30p] iostat & iotop ==== |
+ | === [15p] Task A - Monitoring the behaviour with Iostat === | ||
<note tip> | <note tip> | ||
Parameteres for iostat: | Parameteres for iostat: | ||
Line 15: | Line 16: | ||
</note> | </note> | ||
- | === [10p] Task A - Monitoring the behaviour === | ||
* Run //iostat -x 1 5//. | * Run //iostat -x 1 5//. | ||
* Considering the last two outputs provided by the previous command, calculate **the efficiency of IOPS** for each of them. Does the amount of data written per I/O **increase** or **decrease**? | * Considering the last two outputs provided by the previous command, calculate **the efficiency of IOPS** for each of them. Does the amount of data written per I/O **increase** or **decrease**? | ||
- | :!: :!: Add in your archive screenshot or pictures of the operations and the result you obtained, also showing the output of iostat from which you took the values. | + | Add in your archive screenshot or pictures of the operations and the result you obtained, also showing the output of iostat from which you took the values. |
<note> | <note> | ||
Line 46: | Line 46: | ||
If everything is zero in iostat - perform some I/O operations... | If everything is zero in iostat - perform some I/O operations... | ||
+ | </solution> | ||
+ | |||
+ | |||
+ | === [15p] Task B - Monitoring the behaviour with Iotop === | ||
+ | <note tip> | ||
+ | **Iotop** is an utility similar to top command, that interfaces with the kernel to provide per-thread/process I/O usage statistics. | ||
+ | |||
+ | <code> | ||
+ | Debian/Ubuntu Linux install iotop | ||
+ | $ sudo apt-get install iotop | ||
+ | |||
+ | How to use iotop command | ||
+ | $ sudo iotop OR $ iotop | ||
+ | </code> | ||
+ | |||
+ | Supported options by iotop command: | ||
+ | |||
+ | | **Options** | **Description** ^^ | ||
+ | | --version | show program’s version number and exit || | ||
+ | | -h, --help | show this help message and exit || | ||
+ | | -o, --only | only show processes or threads actually doing I/O || | ||
+ | | -b, --batch | non-interactive mode || | ||
+ | | -n NUM, --iter=NUM | number of iterations before ending [infinite] || | ||
+ | | -d SEC, --delay=SEC | delay between iterations [1 second] || | ||
+ | | -p PID, --pid=PID | processes/threads to monitor [all] || | ||
+ | | -u USER, --user=USER | users to monitor [all] || | ||
+ | | -P, --processes | only show processes, not all threads || | ||
+ | | -a, --accumulated | show accumulated I/O instead of bandwidth || | ||
+ | | -k, --kilobytes | use kilobytes instead of a human friendly unit || | ||
+ | | -t, --time | add a timestamp on each line (implies –batch) || | ||
+ | | -q, --quiet | suppress some lines of header (implies –batch) || | ||
+ | </note> | ||
+ | |||
+ | |||
+ | * Run iotop (install it if you do not already have it) in a separate shell showing only processes or threads actually doing I/O. | ||
+ | * Inspect the script code ({{:ep:laboratoare:dummy.sh|dummy.sh}}) to see what it does. | ||
+ | * Monitor the behaviour of the system with iotop while running the script. | ||
+ | * Identify the PID and PPID of the process running the dummy script and kill the process using command line from another shell (sending SIGINT signal to both parent & child processes). | ||
+ | * Hint - [[https://superuser.com/questions/150117/how-to-get-parent-pid-of-a-given-process-in-gnu-linux-from-command-line|How to get parent PID of a given process in GNU/Linux from command line?]] | ||
+ | |||
+ | Provide a screenshot in which it shows the iotop with only the active processes and one of them being the running script. Then another screenshot after you succeeded to kill it. | ||
+ | |||
+ | <solution -hidden> | ||
+ | {{:ep:laboratoare:lab3-ex4.png?600}} | ||
+ | |||
+ | **dd** performs disk writes... wow! Reason why there are no disk reads is because it uses pseudo-files from **devtmpfs** that don't record these statistics. Also, **tmpfs** are not disks :p | ||
+ | |||
+ | Find PPID from PID: ps -o ppid= -p PID | ||
+ | Send SIGINT signal: kill -SIGINT PID,PPID | ||
</solution> | </solution> |