---
# System prepended metadata

title: 'Assignment I: FIO'

---

# Assignment I: FIO

## Q0 (10%) Example

Question : Please run `q0.fio` on your own HDD and write down your output `q0` in report

![](https://i.imgur.com/5L9wx4d.png)

## Q1. (10%) read vs. randread on HDD

Question : Is there any significant difference between read/randread on HDD? Why or why not? Please justify your answer in brief.

![](https://i.imgur.com/IrbO6TN.png)

According to the result of Group0(read) and Group1(randread), here's several comparation.
1. bw : read > randread
2. io : read = randread
3. run : read < randread

In the observation, randread is slower than read. When a computer reads data from a hard disk drive (HDD), it typically reads data sequentially from the disk platters. This is known as a "read" operation. On the other hand, a "randread" operation involves reading data from the disk in a random order, meaning the disk head has to move around more frequently to access the data.

Since the read operation is sequential, it is generally faster than a randread operation. This is because the disk head can move more efficiently along the disk platter when reading data in a sequential order. In contrast, when performing randread operations, the disk head has to constantly reposition itself to access data in a non-sequential order, which can result in slower performance.

In summary, there is a significant difference between read and randread on HDDs due to the nature of how the data is accessed. Sequential reads are faster and more efficient than random reads, which require more disk head movement and therefore slower performance.

## Q2. (10%) write vs. randwrite on HDD/SSD
Question :

(5%) Is there any significant difference between write/randwrite on HDD? Why or why not? Please justify your answer in brief.
(5%) Is there any significant difference between write/randwrite on SSD? Why or why not? Please justify your answer in brief.

![](https://i.imgur.com/943LAAB.png)

1. Yes, there is a significant difference between write and randwrite operations on HDDs.(group0 vs group1) When writing data to an HDD, the disk platters must be magnetically charged in a specific order to store the data. In a "write" operation, the data is written to the disk in a sequential order, which is typically faster and more efficient than a "randwrite" operation where data is written to the disk in a non-sequential order.

    In a randwrite operation, the disk head has to frequently reposition itself to write the data in a non-sequential order, which can result in slower performance compared to a sequential write operation. Additionally, when writing data in a random order, the HDD's cache may become less effective at optimizing write performance, further slowing down the process.

    In summary, there is a significant difference between write and randwrite operations on HDDs due to the nature of how the data is written. Sequential writes are faster and more efficient than random writes, which require more disk head movement and can cause the HDD's cache to become less effective.
    
2. The difference between write and randwrite on SSDs is not as significant as it is on HDDs.(group2 vs group3)

    Unlike HDDs, SSDs do not have moving parts and data is stored on flash memory chips. When writing data to an SSD, the data can be written to any available block of flash memory, regardless of its location on the drive. This means that the difference between a sequential write and a random write is much less pronounced on an SSD than on an HDD.

    However, there is still a difference between write and randwrite operations on SSDs. A sequential write operation may be slightly faster and more efficient than a randwrite operation due to the way SSDs manage their memory blocks. When data is written sequentially, the SSD can more effectively manage its memory blocks by consolidating data and minimizing write amplification, which can lead to better overall performance.

    In summary, while the difference between write and randwrite operations on SSDs is not as significant as it is on HDDs, there is still a difference in performance. Sequential writes may be slightly faster and more efficient than random writes on SSDs due to the way they manage their memory blocks.
    
## Q3. (10%) forward write vs. backward write on 

Question : Is there any significant difference between forward/backward write on HDD? Why or why not? Please justify your answer in brief.

![](https://i.imgur.com/FfAK8z0.png)

In an HDD, data is written to a spinning disk platter in a sequential manner. Writing data in a backward order would require the drive head to physically move to the end of the platter before starting the write operation, resulting in slower performance.

In summary, there is a significant difference between forward/backward write on HDD. Backward write is slower than forward write.


## Q4. (15%) buffered read vs. nonbuffered read on SSD

Question :

(10%) Is there any significant difference between buffered/nonbuffered sequential read on SSD? Why or why not? Please justify your answer in brief.
(5%) Replace sequential read with random read. Is there any significant difference between buffered/nonbuffered random read on SSD? Why or why not? Please justify your answer in brief.

![](https://i.imgur.com/hai09P4.png)


1. Yes, there is a significant difference between buffered and nonbuffered sequential read operations on SSDs.

    Buffered sequential read operations involve reading data into a buffer in memory before it is accessed by the system. This can improve performance by reducing the number of read operations required and allowing the system to access the data quickly from memory. In addition, buffered reads can take advantage of the SSD's high read speeds, resulting in faster performance.

    Nonbuffered sequential read operations, on the other hand, involve accessing the data directly from the SSD without first storing it in memory. While this can reduce the latency associated with buffering the data, it can result in slower performance overall, as the system may need to perform multiple read operations to access the data.

    In summary, there is a significant difference between buffered and nonbuffered sequential read operations on SSDs. Buffered reads can improve performance by reducing the number of read operations required and taking advantage of the SSD's high read speeds, while nonbuffered reads can reduce latency but may result in slower overall performance.
    
2. No, there is a significant difference between buffered and nonbuffered random read operations on SSDs. 

    By the defintion, a Randon Read operation is what happens when you start feeding out a list of individual records you want retreived from a large database file. Based on a knowledge of where in the file each record is stored, on each record retrieval the system has to tell the disk to jump from where it is to wherever the next required record is, and the heads spend a bunch of time moving to the new track location, then waiting for the disk to turn around until the right sector is being read.
    
    As result, it eliminates any benefit of having the buffer and it forces a head relocation for every read requested. Both of them have the same bottleneck on random read, so there is not a significant difference.


## Q5. (10%) LBA on HDD

Question : Is there any bandwidth trend between these jobs? Why or why not? Please justify your answer in brief.

![](https://i.imgur.com/6XD3l2U.png)

![](https://i.imgur.com/YWfY8im.png)

The performance of a storage device can be affected by the offset used for accessing the data. However, the specific trend in bandwidth between using different offsets can vary depending on the type of storage device and the workload being performed.

On an HDD, using larger offsets may result in lower performance due to the increased seek time required to access the data. Using a 0% offset may result in the highest bandwidth, as this offset corresponds to starting at the beginning of the storage device. Using larger offsets, such as 80%, may result in lower bandwidth due to the inner disk is narrow.

In summary, while the choice of offset can affect the bandwidth of a storage device, the specific trend in bandwidth between different offsets can vary depending on the location of disk.

## Q6. (15%) blocksize on HDD

Question :

(10%) Is there any significant difference between 4k/1k write on HDD? Why or why not? Please justify your answer in brief.
(5%) If you want to achieve the best performance in the condition above, how would you modify blocksize? Explain it briefly.

![](https://i.imgur.com/bbXtU0P.png)

1. Yes, there can be a significant difference between 4k and 1k write operations on HDDs.

    When writing data to an HDD, the disk platters must be magnetically charged in a specific order to store the data. The size of the block that is written can affect the performance of the write operation.

    In a 4k write operation, data is written in blocks of 4 kilobytes, whereas in a 1k write operation, data is written in blocks of 1 kilobyte. Writing in smaller block sizes can lead to more frequent head movements and increased seek times, which can slow down the write operation.

    Additionally, some HDDs are optimized for larger block sizes and may perform better when writing in 4k blocks than in 1k blocks. Writing in 4k blocks may also be more efficient in terms of storage utilization, as it allows for more data to be written in each block.

    In summary, there can be a significant difference between 4k and 1k write operations on HDDs due to the way the data is written and the optimization of the drive. Writing in smaller block sizes may lead to slower performance and decreased storage utilization.
    
2. Here's the result of bs=16k: ![](https://i.imgur.com/xFbhbqi.png) and bs=8k : ![](https://i.imgur.com/5X3Qw1h.png) It seens that bw increase when bs increase. If we want to approach the best result of writing, set the bs >= data size, which means write all data in a block. This is the fastest way of writing.



## Q7. (20%) Fastest nonbuffered write on HDD

Question : Please explain how you achieve the fastest 1G nonbuffered write on HDD in brief.

![](https://i.imgur.com/6QuxMDB.png)

Refer to Q6, I think the batch size get the most improvement on write speed. I modify the bs to 32K and it run time is smaller than 5s (3990msec). Also the effset setting as 0, using the outside of disk to write also helps improving write speed.


## Bonus (10%)
(5%) Replace HDD with SSD in Q1.
Is there any significant difference between read/randread on SSD? Why or why not? Please justify your answer in brief.
![](https://i.imgur.com/ZoOwuk3.png)

Yes, there is a significant difference between read and randread operations on SSDs.

A read operation involves reading data from the SSD in a sequential order. This can be done quickly on an SSD since there are no moving parts, and the data can be accessed almost instantly. The SSD controller can retrieve the data from the flash memory chips in a smooth and efficient manner, resulting in high performance.

In contrast, a randread operation involves reading data from the SSD in a random order. This can be slower than a read operation because the SSD needs to search for the location of the data on the flash memory chips. This involves additional overhead and can result in slower performance.

Furthermore, the performance of randread operations on SSDs can be affected by factors such as the type of flash memory used, the size of the data blocks being read, and the number of read operations being performed simultaneously.

In summary, there is a significant difference between read and randread operations on SSDs. Read operations are generally faster than randread operations since the data can be accessed sequentially without the need to search for the location of the data on the flash memory chips.

(5%) Replace HDD with SSD in Q3.
Is there any significant difference between forward/backward write on SSD? Why or why not? Please justify your answer in brief.

![](https://i.imgur.com/NLH423u.png)

No, there is no significant difference between forward and backward write operations on SSDs. This is because the way in which an SSD writes data is fundamentally different from the way in which a hard disk drive (HDD) writes data.

SSDs use a process called wear-leveling to distribute data evenly across the flash memory chips. This means that data can be written to the SSD in any order without affecting performance. When data is written to an SSD, it is stored in blocks of data, and the SSD controller determines the most efficient way to write the data to the flash memory chips.

In summary, there is no significant difference between forward and backward write operations on SSDs since the way in which data is written is fundamentally different from the way in which data is written on an HDD.
