view paper/file/benchmark/README.md @ 64:f2bc4135c9a6 default tip

del comment
author Ken Miyahira <e175733@ie.u-ryukyu.ac.jp>
date Tue, 16 Feb 2021 00:55:48 +0900
parents d8f79c7bf155
children
line wrap: on
line source

# Benchmark

## dd-benchmark

書き込み, 読み込みの測定には[dd-benchmark](https://romanrm.net/dd-benchmark)を使用する。最近では[fio](https://github.com/axboe/fio)がお勧め。

* 下記のコマンドで測定を行う。
```sh
# 書き込み
dd if=/dev/zero of=benchmark bs=64K count=64K conv=fdatasync

# 読み込み
dd if=benchmark of=/dev/null
```

* `conv=fdatasync`が最も普段の動作に近いらしい
>This tells dd to require a complete “sync” once, right before it exits. So it commits the whole 256 MB of data, then tells the operating system: “OK, now ensure this is completely on disk”, only then measures the total time it took to do all that and calculates the benchmark result.

Source: [dd-benchmark](https://romanrm.net/dd-benchmark)

* `dd-benchmark`はrandomではなく、sequential
>dd (sequential reads or writes, only shows throughput, can be configured to use a filesystem or block device, can be configured to bypass the block cache/wait for I/O to be really completed)

Source: [How can I benchmark my HDD?](https://unix.stackexchange.com/questions/108838/how-can-i-benchmark-my-hdd)

### 測定用のshell

ベンチでは, 128MB, 256MB, 512MB, 1GB, 2GB, 4GBの書き込み, 読み込み速度を測定する。測定用のshellは下のやつを利用する。

```sh
#!/bin/sh

for c in 2 4 8 16 32 64
do
    echo "Write"
    dd if=/dev/zero of=benchmark bs=64K count=$c"K" conv=fdatasync

    echo "Read"
    dd if=benchmark of=/dev/null
    
    rm benchmark
done
```