Skip to content

Commit 7d1ee34

Browse files
Merge pull request #1949 from madeline-underwood/microbenchmarking
Microbenchmarking_JA to review
2 parents c3bba36 + bf0c9ce commit 7d1ee34

File tree

4 files changed

+121
-72
lines changed

4 files changed

+121
-72
lines changed

content/learning-paths/servers-and-cloud-computing/disk-io-benchmark/_index.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
11
---
2-
title: Microbenchmark Storage Performance with fio
3-
4-
draft: true
5-
cascade:
6-
draft: true
2+
title: Microbenchmark storage performance with fio on Arm
73

84
minutes_to_complete: 30
95

10-
who_is_this_for: This is an introductory topic for developers seeking to optimize storage costs and performance, identify bottlenecks, and navigate storage considerations during application migration across platforms.
6+
who_is_this_for: This is an introductory topic for developers looking to optimize storage performance, reduce costs, identify bottlenecks, and evaluate storage options when migrating applications across platforms.
117

128
learning_objectives:
13-
- Understand the flow of data for storage devices.
14-
- Use basic observability utilities such as iostat, iotop and pidstat.
15-
- Understand how to run fio for microbenchmarking a block storage device.
9+
- Describe data flow through storage devices.
10+
- Monitor storage performance using tools like iostat, iotop, and pidstat.
11+
- Run fio to microbenchmark a block storage device.
1612

1713
prerequisites:
18-
- An [Arm based instance](/learning-paths/servers-and-cloud-computing/csp/) from a cloud service provider or an Arm Linux server.
14+
- An [Arm-based instance](/learning-paths/servers-and-cloud-computing/csp/) from a cloud service provider or an Arm Linux server.
1915
- Familiarity with Linux.
2016

2117
author: Kieran Hejmadi

content/learning-paths/servers-and-cloud-computing/disk-io-benchmark/characterising-workload.md

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,55 @@
11
---
2-
title: Characterizing a workload
2+
title: Analyzing I/O behavior with real workloads
33
weight: 3
44

55
### FIXED, DO NOT MODIFY
66
layout: learningpathall
77
---
88

9-
## Basic Characteristics
9+
## Workload attributes
1010

11-
The basic attributes of a given workload are the following.
11+
The basic attributes of a given workload are the following:
1212

13-
- IOPS
14-
- I/O Size
15-
- Throughput
16-
- Read to Write Ratio
17-
- Random vs Sequential access
13+
- IOPS.
14+
- I/O size.
15+
- Throughput.
16+
- Read-to-write ratio.
17+
- Random vs. sequential access.
1818

19-
There are many more characteristics to observe, such as latency, but since this is an introductory topic you will mostly stick to the high-level metrics listed above.
19+
While latency is also an important factor, this section focuses on these high-level metrics to establish a foundational understanding.
2020

21-
## Run an Example Workload
21+
## Run an example workload
2222

2323
Connect to an Arm-based server or cloud instance.
2424

25-
As an example workload, you can use the media manipulation tool, FFMPEG, on an AWS `t4g.medium` instance. The `t4g.medium` is an Arm-based (AWS Graviton2) virtual machine with 2 vCPUs, 4 GiB of memory, and is designed for general-purpose workloads with a balance of compute, memory, and network resources.
25+
As an example workload, use the media manipulation tool, FFMPEG on an AWS `t4g.medium` instance.
2626

27-
First, install the required tools.
27+
This is an Arm-based (AWS Graviton2) virtual machine with two vCPUs and 4 GiB of memory, designed for general-purpose workloads with a balance of compute, memory, and network resources.
28+
29+
First, install the required tools:
2830

2931
```bash
3032
sudo apt update
3133
sudo apt install ffmpeg iotop -y
3234
```
3335

34-
Download the popular reference video for transcoding, `BigBuckBunny.mp4`, which is available under the [Creative Commons 3.0 License](https://creativecommons.org/licenses/by/3.0/).
36+
Download the sample video `BigBuckBunny.mp4`, available under the [Creative Commons Attribution 3.0 License](https://creativecommons.org/licenses/by/3.0/).
3537

3638
```bash
3739
cd ~
3840
mkdir src && cd src
3941
wget http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4
4042
```
4143

42-
Run the following command to begin transcoding the video and audio using the `H.264` and `aac` transcoders respectively. The `-flush_packets` flag forces FFMPEG to write each chunk of video data from memory to storage immediately, rather than buffering it in memory. This reduces the risk of data loss in case of a crash and allows you to observe more frequent disk writes during the transcoding process.
44+
Run the following command to begin transcoding the video and audio using the `H.264` and `aac` transcoders respectively. The `-flush_packets` flag forces FFMPEG to write each chunk of video data from memory to storage immediately, rather than buffering it in memory.
45+
46+
This reduces the risk of data loss in case of a crash and allows disk write activity to be more observable during monitoring, making it easier to study write behavior in real-time.
4347

4448
```bash
4549
ffmpeg -i BigBuckBunny.mp4 -c:v libx264 -preset fast -crf 23 -c:a aac -b:a 128k -flush_packets 1 output_video.mp4
4650
```
4751

48-
### Observe Disk Usage
52+
### Observe disk usage
4953

5054
While the transcoding is running, you can use the `pidstat` command to see the disk statistics of that specific process.
5155

@@ -73,7 +77,7 @@ Linux 6.8.0-1024-aws (ip-10-248-213-118) 04/15/25 _aarch64_
7377
In this simple example, since you are interacting with a file on the mounted filesystem, you are also observing the behavior of the filesystem.
7478
{{% /notice %}}
7579

76-
There may be other processes or background services that are writing to this disk. You can use the `iotop` command for inspection. As shown in the output below, the `ffmpeg` process has the highest disk utilization.
80+
There might be other processes or background services that are writing to this disk. You can use the `iotop` command for inspection. As shown in the output below, the `ffmpeg` process has the highest disk utilization.
7781

7882
```bash
7983
sudo iotop
@@ -88,7 +92,13 @@ Current DISK READ: 0.00 B/s | Current DISK WRITE: 0.00 B/s
8892
2 be/4 root 0.00 B/s 0.00 B/s [kthreadd]
8993
```
9094

91-
Using the input/output statistics command (`iostat`), you can observe the system-wide metrics from the `nvme0n1` drive. Please note that you are using a snapshot of this workload; more accurate characteristics can be obtained by measuring the distribution of a workload.
95+
Using the input/output statistics command (`iostat`), you can observe the system-wide metrics from the `nvme0n1` drive.
96+
97+
{{% notice Note%}}
98+
Be mindful of the fact that you are using a snapshot of this workload; more accurate characteristics can be obtained by measuring the distribution of a workload.
99+
{{% /notice %}}
100+
101+
92102

93103
```bash
94104
watch -n 0.1 iostat -z nvme0n1
@@ -113,7 +123,7 @@ Device r/s rkB/s rrqm/s %rrqm r_await rareq-sz w/s wkB
113123
nvme0n1 0.66 29.64 0.24 26.27 0.73 44.80 2.92 203.88 3.17 52.01 2.16 69.70 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.01 0.15
114124
```
115125

116-
### Basic Characteristics of the Example Workload
126+
### Basic attributes of the example workload
117127

118128
This is a simple transcoding workload with flushed writes, where most data is processed and stored in memory. Disk I/O is minimal, with an IOPS of just 3.81, low throughput (248.71 kB/s), and an average IO depth of 0.01 — all summarized in very low disk utilization. The 52% write merge rate and low latencies further suggest sequential, infrequent disk access, reinforcing that the workload is primarily memory-bound.
119129

content/learning-paths/servers-and-cloud-computing/disk-io-benchmark/introduction.md

Lines changed: 42 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,40 +8,66 @@ layout: learningpathall
88

99
## Introduction
1010

11-
Ideally, your system's storage activity should be zero—meaning all application data and instructions are available in memory or cache, with no reads or writes to hard disk drives (HDDs) or solid-state drives (SSDs) required. However, due to physical capacity limits, data volatility, and the need to store large amounts of data, most applications frequently access storage media.
11+
Performance-sensitive application data - such as frequently-accessed configuration files, logs, or transactional state - should ideally reside in system memory (RAM) or CPU cache, where data access latency is measured in nanoseconds to microseconds. These are the fastest tiers in the memory hierarchy, enabling rapid read and write operations that reduce latency and improve throughput.
1212

13-
## High-Level Flow of Data
13+
However, random-access memory (RAM) has the following constraints:
1414

15-
The diagram below provides a high-level overview of how data is written to or read from a storage device. It illustrates a multi-disk I/O architecture, where each disk (Disk 1 to Disk N) has its own I/O queue and optional disk cache, communicating with a central CPU via a disk controller. Memory, not explicitly shown, sits between the CPU and storage, offering fast but volatile access. File systems, also not depicted, operate at the OS/kernel level to handle file access metadata and provide a user-friendly interface through files and directories.
15+
* It is volatile - data is lost on power down.
16+
* It is limited in capacity.
17+
* It is more expensive per gigabyte than other storage types.
1618

17-
![disk i/o](./diskio.jpeg)
19+
For these reasons, most applications also rely on solid-state drives (SSDs) or hard disk drives (HDDs).
20+
21+
## High-level view of data flow
22+
23+
The diagram below shows a high-level view of how data moves to and from storage in a multi-disk I/O architecture. Each disk (Disk 1 to Disk N) has its own I/O queue and optional disk cache, communicating with a central CPU through a disk controller.
24+
25+
While memory is not shown, it plays a central role in providing fast temporary access between the CPU and persistent storage. Likewise, file systems (also not depicted) run in the OS kernel and manage metadata, access permissions, and user-friendly file abstractions.
26+
27+
This architecture has the following benefits:
28+
29+
* It enables parallelism in I/O operations.
30+
* It improves throughput.
31+
* It supports scalability across multiple storage devices.
32+
33+
![disk i/o alt-text#center](./diskio.jpeg "A high-level view of data flow in a multi-disk I/O architecture.")
1834

1935
## Key Terms
2036

2137
#### Sectors and Blocks
2238

23-
Sectors are the basic physical units on a storage device. Traditional hard drives typically use a sector size of 512 bytes, while many modern disks use 4096 bytes (4K sectors) for improved error correction and efficiency.
39+
* *Sectors* are the smallest physical storage units, typically 512 or 4096 bytes. Many modern drives use 4K sectors for better error correction and efficiency.
40+
41+
* *Blocks* are logical groupings of one or more sectors used by file systems, typically 4096 bytes in size. A block might span multiple 512-byte sectors or align directly with 4K physical sectors if supported by the device.
2442

25-
Blocks are logical groupings of one or more sectors used by filesystems for data organization. A common filesystem block size is 4096 bytes, meaning each block might consist of eight 512-byte sectors, or map directly to a 4096-byte physical sector if supported by the disk.
2643

2744
#### Input/Output Operations per Second (IOPS)
2845

29-
IOPS measures how many random read or write requests your storage system can handle per second. IOPS can vary by block size and storage medium (e.g., flash drives). Traditional HDDs often do not specify IOPS; for example, AWS does not show IOPS values for HDD volumes.
46+
IOPS measures how many random read/write requests your storage system can perform per second. It depends on the block size or device type. For example, AWS does not show IOPS values for traditional HDD volumes, as shown in the image below:
47+
48+
![iops_hdd alt-text#center](./IOPS.png "Example where IOPS values are not provided.")
49+
50+
#### Throughput and bandwidth
3051

31-
![iops_hdd](./IOPS.png)
52+
* *Throughput* is the data transfer rate, usually measured in MB/s.
3253

33-
#### Throughput and Bandwidth
54+
* *Bandwidth* is the maximum potential transfer rate of a connection.
3455

35-
Throughput is the data transfer rate, usually measured in MB/s. Bandwidth specifies the maximum amount of data a connection can transfer. You can calculate storage throughput as IOPS × block size.
56+
You can calculate storage `throughput as IOPS × block size`.
3657

37-
#### Queue Depth
58+
#### Queue depth
3859

39-
Queue depth is the number of simultaneous I/O operations that can be pending on a device. Consumer SSDs typically have a queue depth of 32–64, while enterprise-class NVMe drives can support hundreds or thousands of concurrent requests per queue. Higher queue depth allows more parallelism and can improve I/O performance.
60+
*Queue depth* is the number of I/O operations a device can process concurrently. Consumer SSDs typically support a queue depth of 32–64, while enterprise-class NVMe drives can support hundreds to thousands of concurrent requests per queue. Higher queue depths allow more operations to be handled simultaneously, which can significantly boost throughput on high-performance drives — especially NVMe SSDs with advanced queuing capabilities.
61+
62+
#### I/O engine
4063

41-
#### I/O Engine
64+
The I/O engine is the software layer in Linux that manages I/O requests between applications and storage. For example, the Linux kernel's block I/O scheduler queues and dispatches requests to device drivers, using multiple queues to optimize disk access. Benchmarking tools like `fio` let you choose different I/O engines:
4265

43-
The I/O engine is the software component in Linux that manages I/O requests between applications and the storage subsystem. For example, the Linux kernel's block I/O scheduler queues and dispatches requests to device drivers, using multiple queues to optimize disk access. In benchmarking tools like fio, you can select I/O engines such as sync (synchronous I/O), `libaio` (Linux native asynchronous I/O), or `io_uring` (which uses newer Linux kernel features for asynchronous I/O).
66+
* `sync` – Performs blocking I/O operations using standard system calls. Simple and portable, but less efficient under high concurrency.
67+
* `libaio` – Uses Linux's native asynchronous I/O interface (`io_submit`/`io_getevents`) for non-blocking operations with lower overhead than `sync`.
68+
* `io_uring` – A modern, high-performance async I/O API introduced in Linux 5.1. It minimizes syscalls and context switches, and supports advanced features like buffer selection and batched submissions.
4469

45-
#### I/O Wait
70+
71+
#### I/O wait
4672

47-
I/O wait is the time a CPU core spends waiting for I/O operations to complete.
73+
I/O wait is the time a CPU core spends waiting for I/O operations to complete. Tools like `pidstat`, `top`, and `iostat` can help identify storage-related CPU bottlenecks.

0 commit comments

Comments
 (0)