view paper/file/benchmark/README.md @ 34:bcf20ce5201e

add benchmarks
author Ken Miyahira <e175733@ie.u-ryukyu.ac.jp>
date Sun, 07 Feb 2021 19:49:56 +0900
parents
children d8f79c7bf155
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.

### 測定用の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
```