This shows you the differences between two versions of the page.
ep:labs:03:contents:tasks:ex4 [2020/10/25 16:44] cristian.marin0805 [04. [20p] Monitor I/O with vmstat and iostat] |
— (current) | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ==== 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. | ||
- | |||
- | * **bo** - column reports the number of blocks sent (“blocks out”) to a disk per second. | ||
- | </note> | ||
- | |||
- | :!: :!: Add a picture with the script alongside the terminal with the vmstat/iostat output while the script is running. | ||