Differences

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

Link to this comparison view

ep:labs:03:contents:tasks:ex1 [2020/07/30 21:20]
gheorghe.petre2608 [02. [5p] Iostat]
ep:labs:03:contents:tasks:ex1 [2021/10/26 10:46] (current)
radu.mantu [01. [10p] Rotational delay - IOPS calculations]
Line 1: Line 1:
-==== 01. [5p] Rotational delay - IOPS calculations ==== +==== 01. [10p] Rotational delay - IOPS calculations ====
- +
-=== Good to know ===+
  
 +<note tip>
 Every disk in your storage system has a maximum theoretical IOPS value that is based on a formula. Disk performance and IOPS is based on three key factors: Every disk in your storage system has a maximum theoretical IOPS value that is based on a formula. Disk performance and IOPS is based on three key factors:
  
-  * **Rotational speed**. Measured in RPM, mostly 7,200, 10,000 or 15,000 RPM. A higher rotational speed is associated with a higher performing disk.+  * **Rotational speed**. Measured in RPM, mostly 7,200, 10,000 or 15,000 RPM. A higher rotational speed is associated with a higher-performing disk.
   * **Average latency**. The time it takes for the sector of the disk being accessed to rotate into position under a read/write head.   * **Average latency**. The time it takes for the sector of the disk being accessed to rotate into position under a read/write head.
   * **Average seek time**. The time (in ms) it takes for the hard drive’s read/write head to position itself over the track being read or written.   * **Average seek time**. The time (in ms) it takes for the hard drive’s read/write head to position itself over the track being read or written.
   * **Average IOPS**: Divide 1 by the sum of the average latency in ms and the average seek time in ms (1 / (average latency in ms + average seek time in ms).   * **Average IOPS**: Divide 1 by the sum of the average latency in ms and the average seek time in ms (1 / (average latency in ms + average seek time in ms).
- +</​note>​ 
-To calculate the IOPS range, use this formula: Average IOPS: Divide ​1 by the sum of the average latency in ms and the average seek time in ms (1 / (average latency in ms + average seek time in ms).+To calculate the **IOPS range** divide ​1 by the sum of the average latency in ms and the average seek time in ms. The formula is:  
 +<​code>​average IOPS = 1 / (average latency in ms + average seek time in ms). 
 +</​code>​
  
 Let's calculate the Rotational Delay - RD for a 10K RPM drive: Let's calculate the Rotational Delay - RD for a 10K RPM drive:
Line 22: Line 23:
   * Divide 1000 MS by 8 MS per I/O: **''​1000/​8 = 125 IOPS''​**   * Divide 1000 MS by 8 MS per I/O: **''​1000/​8 = 125 IOPS''​**
  
-=== IOPS calculations ​===+=== [10p] Task A - Calculate rotational delay ===
  
-Calculate ​the rotational delay (RD) for a 5400 RPM drive.+Add in your archive ​the operations and the result you obtained. ​(Screenshot, picture of calculations made by hand on paper) 
 + 
 +Calculate the Rotational Delay, and then the IOPS for a __5400 ​RPM drive__.
  
 <​solution -hidden> <​solution -hidden>
Line 38: Line 41:
 </​code>​ </​code>​
 </​solution>​ </​solution>​
-==== 02. [5p] Iostat ==== 
  
-=== Good to know === 
- 
-<​code>​ 
-#iostat [ -x for extended statistics, -d to display device stastistics only, -m for displaying r/w in MB/s ] 
-iostat -xdm 
- 
-#iostat with -p for specific device statistics 
-iostat -xdm -p sda 
-</​code>​ 
- 
-=== Monitoring the behaviour === 
- 
-  * 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? 
- 
-<​note>​ 
-How to's 
- 
-  * 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> 
-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. 
- 
-Example: the amount of data written per I/O for ///​dev/​sda//​ increases during each iteration: 
- 
-{{ :​ep:​labs:​ep2017_l3_ex01.png?​700 |}} 
- 
-<​code>​ 
-53040/105 = 505KB per I/O 
-71152/102 = 697KB per I/O 
-</​code>​ 
- 
-If everything is zero in iostat - perform some I/O operations... 
-</​solution>​ 
-==== 03. [5p] Iotop ==== 
- 
-==== 04. [20p] Monitor I/O with vmstat and iostat ==== 
-We said in the beginning that the disk I/O subsystems are the slowest part of any system. This is why the I/O monitoring is so important, maximizing the performance of the slowest part of a system resulting in an improvement of the performance of the entire system. 
- 
-=== [10p] Task A - Script === 
- 
-Write a script that reads the data into memory and generates a text file 500 times larger, by concatenating the contents of the following novel {{:​ep:​labs:​olivertwist.txt|olivertwist.txt}} to itself. 
- 
-<​solution -hidden> 
-<​code>​ 
-if __name__ == '​__main__':​ 
-    text_file1 = open("​OliverTwist.txt",​ "​r"​) 
-    text_file2 = open("​OliverTwistLarge.txt",​ "​w+"​) 
-    lines_file1 = text_file1.readlines() 
-    for x in range(0, 500): 
-    text_file2.writelines(lines_file1) 
-</​code>​ 
-</​solution>​ 
- 
-=== [10p] Task B - Monitoring behaviour === 
- 
-Now we want to analyze what is happening with the I/O subsystem during an expensive operation. Monitor the behavior of the system while running your script using **vmstat** and **iostat**. 
- 
-<note tip> 
-Understanding vmstat IO section: 
-  * **bi** - column reports the number of blocks received (or “blocks in”) from a disk per second. 
- 
-  * **bi** - column reports the number of blocks sent (“blocks out”) to a disk per second. 
-</​note>​ 
  
  
ep/labs/03/contents/tasks/ex1.1596133258.txt.gz · Last modified: 2020/07/30 21:20 by gheorghe.petre2608
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