Differences

This shows you the differences between two versions of the page.

Link to this comparison view

ep:labs:05:contents:tasks:ex1 [2019/10/27 17:10]
emilian.radoi created
ep:labs:05:contents:tasks:ex1 [2026/03/30 22:15] (current)
radu.mantu
Line 1: Line 1:
-==== 01. [20p] Gnuplot graphs ​==== +==== 01. [20p] iostat & iotop ====
- +
-Using the Gnuplot documentation,​ implement a script that plots four graphs. Use the data from {{:​ep:​laboratoare:​data4.txt|}} as follows: the first graph should plot columns 1 and 2, the second columns 1 and 3, the third one columns 1 and 4, and the fourth one should be a 3D graph plotting columns 1, 2 and 3. +
-  * Use different colours for the data in each graph. +
-  * Remove the keys for each graph. +
-  * Give a title to each graph. +
-  * Give names to each of the axes: X or Y (or Z for the 3D graph). In the case of the 3D graph: Make the numbers on the axes readable, and correct the position of the names of the axes if these are displayed over the axes numbers. +
-  * Make the script generate the .eps file containing your plot.+
  
 +=== [10p] Task A - Monitoring the behaviour with Iostat ===
 <note tip> <note tip>
- **Hint:*Consider the following commandsset key, xlabel, set title, set xtics, set terminal, set output, using.+Parameteres for iostat: 
 +    ​-x for extended statistics 
 +    ​-d to display device stastistics only 
 +    ​-m for displaying r/w in MB/s 
 +<code bash> 
 +$ iostat -xdm 
 +</​code>​ 
 +Use iostat with -p for specific device statistics: 
 +<code bash> 
 +$ iostat -xdm -p sda 
 +</​code>​
 </​note>​ </​note>​
 +
 +  * 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**?​
 +
 +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>​
 +How to do:
 +
 +  * Divide the kilobytes read (//rkB/s//) and written (//wkB/s//) per second by the reads per second (//r/s//) and the writes per second (//w/s//).
 +  * If you happen to have quite a few [[https://​en.wikipedia.org/​wiki/​Loop_device|loop devices]] in your **iostat** output, find out what they are exactly:
 +
 +<code bash>
 +$ df -kh /dev/loop*
 +</​code>​
 +</​note>​
 +
  
 <​solution -hidden> <​solution -hidden>
-<​code>​+The way to calculate the efficiency of IOPS is to divide the reads per second //(r/s)// and writes per second //(w/s)// by the kilobytes read //(rkB/s)// and written //(wkB/s)// per second.
  
-reset #flush all variables+Example: the amount of data written per I/O for ///​dev/​sda//​ increases during each iteration:
  
-set term postscript color eps enhanced +{{ :​ep:​labs:​ep2017_l3_ex01.png?700 |}}
-set output '​myplot.eps' +
-set size 1,1 #use default pallet size(100% of width and height) +
-set multiplot +
-unset key+
  
-#Graph 1 +<​code>​ 
-set size 0.5,0.5 #half the width and height +53040/105 = 505KB per I/O 
-set origin 0,0.5 #x,y +71152/102 = 697KB per I/O 
-set title '​First'​ +</​code>​
-plot '​data4.txt'​ using 1:2  w l lw 0.5+
  
-#Graph 2 +If everything is zero in iostat - perform some I/O operations... 
-set size 0.5,0.5  +</​solution>​
-set origin 0.5,0.5 +
-set xlabel '​X'​ +
-set ylabel '​Y'​ +
-set title '​Second'​ +
-plot '​data4.txt'​ using 1:3 w l lw 0.5+
  
-#Graph 3 
-set size 0.5,0.5 
-set origin 0,0 
-set xlabel '​X'​ 
-set ylabel '​Y'​ 
-set title '​Third'​ 
-plot '​data4.txt'​ using 1:4 w l lw 0.5 
  
-#Graph 4 +=== [10p] Task B - Monitoring the behaviour with Iotop === 
-set size 0.5,0.5 +<note tip> 
-set origin 0.5,0 +**Iotop** is an utility similar to top commandthat interfaces with the kernel to provide per-thread/​process I/O usage statistics.
-set view 60,15 +
-set xtics 0,1000 +
-set ytics 1.8,0.3 +
-set ztics 1,0.2 +
-set xlabel '​X'​ offset 0,-+
-set ylabel '​Y'​ +
-set zlabel '​Z'​ +
-set title '​Fourth'​ +
-splot 'data4.txt' using 1:2:3 w l lw 0.5 lc rgb '​black'​ +
-set xtics auto +
-set ytics auto +
-set ztics auto+
  
-unset multiplot+<​code>​ 
 +Debian/​Ubuntu Linux install iotop 
 +$ sudo apt-get install iotop
  
 +How to use iotop command
 +$ sudo iotop OR $ iotop
 </​code>​ </​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?]]
 +
 +<​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>​
ep/labs/05/contents/tasks/ex1.1572189014.txt.gz · Last modified: 2019/10/27 17:10 by emilian.radoi
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0