千家信息网

如何进行磁盘的I/O测试

发表于:2025-02-01 作者:千家信息网编辑
千家信息网最后更新 2025年02月01日,如何进行磁盘的I/O测试https://wiki.mikejung.biz/Benchmarking译文有增删1 Linux 常见基准测试工具FIOSysbenchPhoronix Test Suit
千家信息网最后更新 2025年02月01日如何进行磁盘的I/O测试

如何进行磁盘的I/O测试

https://wiki.mikejung.biz/Benchmarking

译文有增删


1 Linux 常见基准测试工具

FIO

Sysbench

Phoronix Test Suite (moved to it's own page)

IOzone

Ioping

UnixBench

Google's Perfkit Benchmarker

2 FIO

fio算是比较老的io测试工具了,作者是Jens Axboe

主页https://www.thomas-krenn.com/en/wiki/Fio

fio的安装

我的测试环境有centos7 redhat5 因此要下载两个版本的fio

redhat5 版本的需要去归档站点去下载

http://archives.fedoraproject.org/pub/archive/epel/

下载后的安装 rpm -ivh fio-1.57-1.el5.x86_64.rpm

centos7 则可以去很多镜像站点下载,站点列表可以查询

https://admin.fedoraproject.org/mirrormanager/mirrors/EPEL

如果配置了epel yum 源,直接yum install -y fio

fio测试选项和例子

示例 使用fio测试磁盘的随机写

fio --name=randwrite --ioengine=libaio --iodepth=1 --rw=randwrite --bs=4k \

--direct=0 --size=512M --numjobs=8 --runtime=240 --group_reporting

--rw=randwrite 指定随机写

--direct=0 指定使用buffered IO 还是direct IO。如果使用buffer,注意总大小不要超过物理内存

--numjobs=8 启动8个进程

--size=512M 每个进程写512M

--group_reporting 将多个进程的统计结果进行聚合,更易阅读

--runtime=240 持续运行时间4分钟

--bs=4k --blocksize=4k (default)

--ioengine=libaio 可用的io引擎可以使用 fio --enghelp查看(fio-2.2.8)

--iodepth=1 缺省 测试ssd磁盘时,可以扩大到32,通常4就够了

The iodepth option defines the amount of IO units that will continue to hammer a file with requests during the test.

避免使用buffer的方法是指定--direct=1 或者使用比物理内存大一倍的写文件

fio结果的重点关注项目:

iops=1416 iops = 1416

95.00th=[ 2] 95%IO2毫秒完成

util=99.62% 设备繁忙程度

示例 使用fio测试磁盘的随机读

fio --name=randread --ioengine=libaio --iodepth=16 --rw=randread --bs=4k \

--direct=0 --size=512M --numjobs=8 --runtime=240 --group_reporting

fio 帮助

man fio

fio -h

fio -v

fio 命令行中写上选项,也可以将命令行选项写入一个参数文件job file

fio 安装后,自带了一些样例

# rpm -ql -p fio-1.57-1.el5.x86_64.rpm

/usr/bin/fio

/usr/bin/fio_generate_plots

/usr/share/doc/fio-1.57

/usr/share/doc/fio-1.57/COPYING

/usr/share/doc/fio-1.57/HOWTO

/usr/share/doc/fio-1.57/README

/usr/share/doc/fio-1.57/REPORTING-BUGS

/usr/share/doc/fio-1.57/examples

/usr/share/doc/fio-1.57/examples/1mbs_clients

/usr/share/doc/fio-1.57/examples/aio-read

......

aio-read 参数文件,修改一下可以马上使用

# fio aio-read.bak

file1: (g=0): rw=randread, bs=128K-128K/128K-128K, ioengine=libaio, iodepth=4

file2: (g=0): rw=randread, bs=128K-128K/128K-128K, ioengine=libaio, iodepth=32

file3: (g=0): rw=randread, bs=128K-128K/128K-128K, ioengine=libaio, iodepth=8

file4: (g=0): rw=randread, bs=128K-128K/128K-128K, ioengine=libaio, iodepth=16

fio 1.57

......

fio 输出结果的一些注释

io Number of megabytes of I/O performed.

bw Average data rate (bandwidth).

runt Threads run time.

slat Submission latency minimum, maximum, average and standard deviation. This

is the time it took to submit the I/O.

clat Completion latency minimum, maximum, average and standard deviation. This

is the time between submission and completion.

bw Bandwidth minimum, maximum, percentage of aggregate bandwidth received, average and standard deviation.

The group statistics show:

io Number of megabytes I/O performed.

aggrb Aggregate bandwidth of threads in the group.

minb Minimum average bandwidth a thread saw.

maxb Maximum average bandwidth a thread saw.

mint Shortest runtime of threads in the group.

maxt Longest runtime of threads in the group.

Finally, disk statistics are printed with reads first:

ios Number of I/Os performed by all groups.

merge Number of merges in the I/O scheduler.

ticks Number of ticks we kept the disk busy.

io_queue

Total time spent in the disk queue.

util Disk utilization.

示例 随机读直接IO

fio --name=randread --ioengine=libaio --iodepth=16 --rw=randread --bs=4k --direct=1 --size=1G --numjobs=8 --runtime=240 --group_reporting

csdn上一个翻译成中文的帖子 http://blog.csdn.net/yuesichiu/article/details/8722417 没耐心看英文的估计中文的也不会看完。

3 sysbench

sysbench可以测试cpu \ oltp mysql\ fileio 网上用来测试mysql的文章比较多。

sysbench的安装

centos 中,可以从epel直接安装。安装时需要mysql / postgresql

源文中的安装方法

wget ftp://ftp.gnome.org/mirror/fedora/epel/6/x86_64/sysbench-0.4.12-5.el6.x86_64.rpm

wget http://downloads.mysql.com/archives/mysql-5.1/MySQL-shared-compat-5.1.49-1.rhel5.x86_64.rpm

rpm -iv MySQL-shared-compat-5.1.49-1.rhel5.x86_64.rpm

yum install postgresql-libs.x86_64

rpm -iv sysbench-0.4.12-5.el6.x86_64.rpm

实际安装方法

rpm -ivh http://archives.fedoraproject.org/pub/archive/epel/epel-release-latest-5.noarch.rpm

or

rpm -ivh http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

yum install sysbench

sysbenchI/O测试

先掌握sysbench的语法

# sysbench

Missing required command argument.

Usage:

sysbench [general-options]... --test= [test-options]... command

General options:

--num-threads=N number of threads to use [1]

--max-requests=N limit for total number of requests [10000]

--max-time=N limit for total execution time in seconds [0]

--forced-shutdown=STRING amount of time to wait after --max-time before forcing shutdown [off]

--thread-stack-size=SIZE size of stack per thread [32K]

--init-rng=[on|off] initialize random number generator [off]

--test=STRING test to run

--debug=[on|off] print more debugging info [off]

--validate=[on|off] perform validation checks where possible [off]

--help=[on|off] print help and exit

--version=[on|off] print version and exit

Compiled-in tests:

fileio - File I/O test

cpu - CPU performance test

memory - Memory functions speed test

threads - Threads subsystem performance test

mutex - Mutex performance test

oltp - OLTP test

Commands: prepare run cleanup help version

来一些命令

# run a random write test with "--file-extra-flags=direct" 随机写

sysbench --test=fileio --file-total-size=4G --file-num=2 --file-test-mode=rndwr --max-time=240 --max-requests=0 --file-block-size=8K --num-threads=4 --file-extra-flags=direct

prepare

run

cleanup

sysbench --test=fileio --file-total-size=1G --file-num=10 --file-test-mode=rndwr --max-time=240 --max-requests=0 --file-block-size=8K --file-extra-flags=direct

或者

随机写

sysbench --test=fileio --file-total-size=2G --file-num=64 prepare

sysbench --test=fileio --file-total-size=2G --file-test-mode=rndwr --max-time=240 --max-requests=0 --file-block-size=4K --file-num=64 --num-threads=1 run

for each in 1 4 8 16 32 64; do \

sysbench --test=fileio --file-total-size=2G --file-test-mode=rndwr --max-time=240 --max-requests=0 --file-block-size=4K --file-num=64 --num-threads=$each run; \

sleep 10; done

随机读

sysbench --test=fileio --file-total-size=2G --file-test-mode=rndrd --max-time=240 --max-requests=0 --file-block-size=4K --file-num=64 --num-threads=1 run

for each in 1 4 8 16 32 64; do sysbench --test=fileio --file-total-size=2G --file-test-mode=rndrd --max-time=240 --max-requests=0 --file-block-size=4K --file-num=64 --num-threads=$each run; sleep 10; done

测试结果中的几个重点:

一个虚拟机(openstack)的测试结果

[root@v-yfb-cos72-sql05 test]# sysbench --test=fileio --file-total-size=4G --file-num=2 --file-test-mode=rndwr --max-time=240 --max-requests=0 --file-block-size=8K --num-threads=4 run

sysbench 0.4.12: multi-threaded system evaluation benchmark

Running the test with following options:

Number of threads: 4

Extra file open flags: 0

2 files, 2Gb each

4Gb total file size

Block size 8Kb

Number of random requests for random IO: 0

Read/Write ratio for combined random IO test: 1.50

Periodic FSYNC enabled, calling fsync() each 100 requests.

Calling fsync() at the end of test, Enabled.

Using synchronous I/O mode

Doing random write test

Threads started!

Time limit exceeded, exiting...

(last message repeated 3 times)

Done.

Operations performed: 0 Read, 14433721 Write, 288270 Other = 14721991 Total

Read 0b Written 110.12Gb Total transferred 110.12Gb (469.84Mb/sec) <---- 60140.13 * 8k = 469.84

60140.13 Requests/sec executed <---- 重点1 IOPS

Test execution summary:

total time: 240.0015s

total number of events: 14433721

total time taken by event execution: 66.3879

per-request statistics:

min: 0.00ms

avg: 0.00ms

max: 2.05ms

approx. 95 percentile: 0.01ms <---- 重点2 每个请求的响应时间

Threads fairness:

events (avg/stddev): 3608430.2500/38671.29

execution time (avg/stddev): 16.5970/0.16

另外一个虚拟机(VMware esx)的测试结果

[root@dbsrvb test]# sysbench --test=fileio --file-total-size=4G --file-num=2 --file-test-mode=rndwr --max-time=240 --max-requests=0 --file-block-size=8K --num-threads=4 run

sysbench 0.4.12: multi-threaded system evaluation benchmark

Running the test with following options:

Number of threads: 4

Extra file open flags: 0

2 files, 2Gb each

4Gb total file size

Block size 8Kb

Number of random requests for random IO: 0

Read/Write ratio for combined random IO test: 1.50

Periodic FSYNC enabled, calling fsync() each 100 requests.

Calling fsync() at the end of test, Enabled.

Using synchronous I/O mode

Doing random write test

Threads started!

FATAL: Failed to fsync file! file: -1667944680 errno = 9 ()

FATAL: Incorrect file discovered in request

(last message repeated 2 times)

Done.

Operations performed: 0 Read, 10503 Write, 208 Other = 10711 Total

Read 0b Written 82.055Mb Total transferred 82.055Mb (21.993Mb/sec)

2815.05 Requests/sec executed <---- 重点1 IOPS

Test execution summary:

total time: 3.7310s

total number of events: 10503

total time taken by event execution: 0.9682

per-request statistics:

min: 0.01ms

avg: 0.09ms

max: 17.76ms

approx. 95 percentile: 0.22ms <---- 重点2 比上面的服务器要差一些

Threads fairness:

events (avg/stddev): 2625.7500/377.73

execution time (avg/stddev): 0.2421/0.02

另外一个虚拟机(笔记本上的VirtualBox)的测试结果

[root@node1 test]# sysbench --test=fileio --file-total-size=4G --file-num=2 --file-test-mode=rndwr --max-time=240 --max-requests=0 --file-block-size=8K --num-threads=4 run

sysbench 0.4.12: multi-threaded system evaluation benchmark

Running the test with following options:

Number of threads: 4

Extra file open flags: 0

2 files, 2Gb each

4Gb total file size

Block size 8Kb

Number of random requests for random IO: 0

Read/Write ratio for combined random IO test: 1.50

Periodic FSYNC enabled, calling fsync() each 100 requests.

Calling fsync() at the end of test, Enabled.

Using synchronous I/O mode

Doing random write test

Threads started!

Time limit exceeded, exiting...

(last message repeated 3 times)

Done.

Operations performed: 0 Read, 635100 Write, 12701 Other = 647801 Total

Read 0b Written 4.8454Gb Total transferred 4.8454Gb (20.673Mb/sec)

2646.16 Requests/sec executed <--- Virtual Box IOPS VMware稍微低一点

Test execution summary:

total time: 240.0086s

total number of events: 635100

total time taken by event execution: 2.7852

per-request statistics:

min: 0.00ms

avg: 0.00ms

max: 3.75ms

approx. 95 percentile: 0.01ms <--- 这个就比VMware

Threads fairness:

events (avg/stddev): 158775.0000/3440.64

execution time (avg/stddev): 0.6963/0.02

如果测试硬件性能,要在物理服务器上进行对比。

为了避免从内存读取数据,测试文件要大于内存的两倍。

sysbench mysql测试

##Create Database

mysql u root ppassword e "CREATE DATABASE sysbench;"

##Create User

mysql u root ppassword e "CREATE USER 'sysbench'@'localhost' IDENTIFIED BY 'password';"

##Grant Access

mysql u root ppassword e "GRANT ALL PRIVILEGES ON *.* TO 'sysbench'@'localhost' IDENTIFIED BY 'password';"

或者

mysql> create database sysbench;

mysql> create user 'sysbench'@'%' identified by 'sysbench' ;

mysql> select host,user from mysql.user;

+-----------+-----------+

| host | user |

+-----------+-----------+

| % | sysbench |

| localhost | mysql.sys |

| localhost | root |

+-----------+-----------+

3 rows in set (0.00 sec)

mysql> grant all privileges on *.* to 'sysbench'@'%' ;

mysql> flush privileges;

数据库环境准备完毕后,准备sysbench命令

sysbench --test=oltp --db-driver=mysql --oltp-table-size=1000000 \

--mysql-db=sysbench --mysql-user=sysbench --mysql-password=sysbench \

prepare

自动产生的测试表的样子

mysql> desc sbtest

-> ;

+-------+------------------+------+-----+---------+----------------+

| Field | Type | Null | Key | Default | Extra |

+-------+------------------+------+-----+---------+----------------+

| id | int(10) unsigned | NO | PRI | NULL | auto_increment |

| k | int(10) unsigned | NO | MUL | 0 | |

| c | char(120) | NO | | | |

| pad | char(60) | NO | | | |

+-------+------------------+------+-----+---------+----------------+

4 rows in set (0.00 sec)

mysql>

mysql> select * from sbtest limit 5;

+----+---+---+----------------------------------------------------+

| id | k | c | pad |

+----+---+---+----------------------------------------------------+

| 1 | 0 | | qqqqqqqqqqwwwwwwwwwweeeeeeeeeerrrrrrrrrrtttttttttt |

| 2 | 0 | | qqqqqqqqqqwwwwwwwwwweeeeeeeeeerrrrrrrrrrtttttttttt |

| 3 | 0 | | qqqqqqqqqqwwwwwwwwwweeeeeeeeeerrrrrrrrrrtttttttttt |

| 4 | 0 | | qqqqqqqqqqwwwwwwwwwweeeeeeeeeerrrrrrrrrrtttttttttt |

| 5 | 0 | | qqqqqqqqqqwwwwwwwwwweeeeeeeeeerrrrrrrrrrtttttttttt |

+----+---+---+----------------------------------------------------+

5 rows in set (0.00 sec)

for each in 1 4 8 16 32 64; do \

sysbench --test=oltp --db-driver=mysql --oltp-table-size=10000000 \

--mysql-db=sysbench --mysql-user=sysbench --mysql-password=sysbench \

--max-time=240 --max-requests=0 --oltp-read-only --oltp-skip-trx \

--oltp-nontrxmode=select --num-threads=$each run; \

sleep 10; done

sysbench --test=oltp --db-driver=mysql --oltp-table-size=10000000 \

--mysql-db=sysbench --mysql-user=sysbench --mysql-password=sysbench \

--max-time=240 --max-requests=0 --oltp-read-only --oltp-skip-trx \

--oltp-nontrx-mode=select --num-threads=2 run;

4 Phoronix 测试套件

Phoronix 测试套件简称pts, 从官网http://phoronix-test-suite.com/?k=downloads下载安装包 phoronix-test-suite-7.0.1.tar.gz

pts的安装依赖php-cli 等多个包

tar xvf phoronix-test-suite_6.2.2.tar.gz

cd phoronix-test-suite/

./install-sh

/usr/bin/phoronix-test-suite list-available-suites

/usr/bin/phoronix-test-suite list-available-tests

phoronix-test-suite info pts/disk

phoronix-test-suite install pts/iozon

phoronix-test-suite install pts/disk

pts/disk包括了fio iozone aio-stress等等多个工具,pts太过庞大,install时因为网速原因,耗时较长。这里只使用一个iozone做个测试。

使用pts套件运行iozone

[root@node1 ~]# phoronix-test-suite run pts/iozone-1.8.0

IOzone 3.405:

pts/iozone-1.8.0

Disk Test Configuration

1: 4Kb

2: 64Kb

3: 1MB

4: Test All Options

Record Size: 1

1: 512MB

2: 2GB

3: 4GB

4: 8GB

5: Test All Options

File Size: 4

1: Write Performance

2: Read Performance

3: Test All Options

Disk Test: 1

Phoronix Test Suite v6.6.0

System Information

Hardware:

Processor: Intel Core i7-3537U @ 2.49GHz (1 Core), Motherboard: Oracle VirtualBox v1.2, Chipset: Intel 440FX- 82441FX PMC, Memory: 4096MB, Disk: 72GB VBOX HDD, Graphics: InnoTek VirtualBox, Audio: Intel 82801AA AC 97 Audio, Network: Intel 82540EM Gigabit

Software:

OS: Oracle Linux Server 7.3, Kernel: 4.1.12-61.1.18.el7uek.x86_64 (x86_64), Compiler: GCC 4.8.5 20150623, File-System: xfs, System Layer: KVM VirtualBox

Would you like to save these test results (Y/n): y

Enter a name to save these results under: tmp

Enter a unique name to describe this test run / configuration: tmp

If desired, enter a new description below to better describe this result set / system configuration under test.

Press ENTER to proceed without changes.

Current Description: KVM VirtualBox testing on Oracle Linux Server 7.3 via the Phoronix Test Suite.

New Description:

IOzone 3.405:

pts/iozone-1.8.0 [Record Size: 4Kb - File Size: 8GB - Disk Test: Write Performance]

Test 1 of 1

Estimated Trial Run Count: 3

Estimated Time To Completion: 22 Minutes (04:14 CDT)

Started Run 1 @ 03:53:01

Started Run 2 @ 04:11:11

Started Run 3 @ 04:22:17 [Std. Dev: 108.27%]

Started Run 4 @ 04:26:15 [Std. Dev: 83.68%]

Started Run 5 @ 04:29:54 [Std. Dev: 69.61%]

Started Run 6 @ 04:33:32 [Std. Dev: 60.77%]

Test Results:

8.509765625

14.8359375

69.3681640625

74.802734375

74.82421875

76.93359375

Average: 53.21 MB/s

Do you want to view the results in your web browser (Y/n): n

Would you like to upload the results to OpenBenchmarking.org (Y/n): n

单独运行iozone

# find / -name iozone

/var/lib/phoronix-test-suite/installed-tests/pts/iozone-1.8.0/iozone3_405/src/current/iozone

/var/lib/phoronix-test-suite/installed-tests/pts/iozone-1.8.0/iozone

# cd /var/lib/phoronix-test-suite/installed-tests/pts/iozone-1.8.0/

# export LOG_FILE=1.log

# ./iozone -Ra -g 8G -i 0 -b iozone.xls

参考

http://phoronix-test-suite.com/documentation/phoronix-test-suite.html#GettingStarted

https://wiki.mikejung.biz/Phoronix_Test_Suite

5 IOzone 的安装和使用

官网 http://iozone.org/

官方帮助文档 IOzone_msword_98.doc

下载安装包 [Stable tarball] iozone3_465.tar

安装过程

150 mkdir test_iozone

151 mv iozone3_465.tar test_iozone/

152 cd test_iozone/

153 ls

154 tar -xf iozone3_465.tar

155 cd iozone3_465/src/current/

156 ls

157 make

158 uname -a

159 make linux-AMD64

160 yum provides cc

161 yum install -y gcc

162 make linux-AMD64

163 ll

164 ls -ort

165 date

166 iozone

167 ./iozone

168 ./iozone -h

169 ./iozone -Ra -g 8G -i 0 -b iozone.xls 这个输出到xls文件

运行命令

./iozone -Ra -g 8G -i 0 这个输出到屏幕

iozone产生的结果比较直观地看到不同块大小和不同文件大小对IO的影响。

7 UnixBench 的安装和使用

apt‐get install make gcc

wget https://byte‐unixbench.googlecode.com/files/UnixBench6.1.3.tgz

tar zxvf UnixBench6.1.3.tgz

cd UnixBench

make

./Run ‐i 1

download UnixBench6.1.3.tgz from

https://code.google.com/archive/p/byte-unixbench/downloads

255 tar -xzf UnixBench6.1.3.tgz

256 ls

257 cd UnixBench

258 ls

259 make

260 ls -ort

261 ./Run -i 1

262 which perl

263 yum install -y perl

[root@v-yfb-cos72-sql05 UnixBench]# ./Run -i 1

make all

make[1]: Entering directory `/root/UnixBench'

Checking distribution of files

./pgms exists

./src exists

./testdir exists

./tmp exists

./results exists

make[1]: Leaving directory `/root/UnixBench'

sh: 3dinfo: command not found

# # # # # # # ##### ###### # # #### # #

# # ## # # # # # # # ## # # # # #

# # # # # # ## ##### ##### # # # # ######

# # # # # # ## # # # # # # # # #

# # # ## # # # # # # # ## # # # #

#### # # # # # ##### ###### # # #### # #

Version 5.1.3 Based on the Byte Magazine Unix Benchmark

Multi-CPU version Version 5 revisions by Ian Smith,

Sunnyvale, CA, USA

January 13, 2011 johantheghost at yahoo period com

......

========================================================================

BYTE UNIX Benchmarks (Version 5.1.3)

System: v-yfb-cos72-sql05.novalocal: GNU/Linux

OS: GNU/Linux -- 3.10.0-327.el7.x86_64 -- #1 SMP Thu Nov 19 22:10:57 UTC 2015

Machine: x86_64 (x86_64)

Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")

CPU 0: Intel Core Processor (Haswell, no TSX) (4600.0 bogomips)

x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET

CPU 1: Intel Core Processor (Haswell, no TSX) (4600.0 bogomips)

x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET

06:01:21 up 78 days, 3:34, 1 user, load average: 0.11, 0.04, 0.05; runlevel 3

------------------------------------------------------------------------

Benchmark Run: Thu May 04 2017 06:01:21 - 06:08:05

2 CPUs in system; running 1 parallel copy of tests

Dhrystone 2 using register variables 29114714.8 lps (10.0 s, 1 samples)

Double-Precision Whetstone 3660.1 MWIPS (9.8 s, 1 samples)

Execl Throughput 3227.4 lps (29.1 s, 1 samples)

File Copy 1024 bufsize 2000 maxblocks 962272.0 KBps (30.0 s, 1 samples)

File Copy 256 bufsize 500 maxblocks 256736.0 KBps (30.0 s, 1 samples)

File Copy 4096 bufsize 8000 maxblocks 2537028.0 KBps (30.0 s, 1 samples)

Pipe Throughput 1282585.0 lps (10.0 s, 1 samples)

Pipe-based Context Switching 284899.6 lps (10.0 s, 1 samples)

Process Creation 9563.0 lps (30.0 s, 1 samples)

Shell Scripts (1 concurrent) 6315.2 lpm (60.0 s, 1 samples)

Shell Scripts (8 concurrent) 1360.1 lpm (60.0 s, 1 samples)

System Call Overhead 2215239.6 lps (10.0 s, 1 samples)

System Benchmarks Index Values BASELINE RESULT INDEX

Dhrystone 2 using register variables 116700.0 29114714.8 2494.8

Double-Precision Whetstone 55.0 3660.1 665.5

Execl Throughput 43.0 3227.4 750.6

File Copy 1024 bufsize 2000 maxblocks 3960.0 962272.0 2430.0

File Copy 256 bufsize 500 maxblocks 1655.0 256736.0 1551.3

File Copy 4096 bufsize 8000 maxblocks 5800.0 2537028.0 4374.2

Pipe Throughput 12440.0 1282585.0 1031.0

Pipe-based Context Switching 4000.0 284899.6 712.2

Process Creation 126.0 9563.0 759.0

Shell Scripts (1 concurrent) 42.4 6315.2 1489.4

Shell Scripts (8 concurrent) 6.0 1360.1 2266.8

System Call Overhead 15000.0 2215239.6 1476.8

========

System Benchmarks Index Score 1400.8

------------------------------------------------------------------------

Benchmark Run: Thu May 04 2017 06:08:05 - 06:14:49

2 CPUs in system; running 2 parallel copies of tests

Dhrystone 2 using register variables 58393583.7 lps (10.0 s, 1 samples)

Double-Precision Whetstone 7356.6 MWIPS (9.8 s, 1 samples)

Execl Throughput 7037.2 lps (29.9 s, 1 samples)

File Copy 1024 bufsize 2000 maxblocks 1368114.0 KBps (30.0 s, 1 samples)

File Copy 256 bufsize 500 maxblocks 390873.0 KBps (30.0 s, 1 samples)

File Copy 4096 bufsize 8000 maxblocks 3596554.0 KBps (30.0 s, 1 samples)

Pipe Throughput 2688283.4 lps (10.0 s, 1 samples)

Pipe-based Context Switching 572723.9 lps (10.0 s, 1 samples)

Process Creation 22877.0 lps (30.0 s, 1 samples)

Shell Scripts (1 concurrent) 9545.3 lpm (60.0 s, 1 samples)

Shell Scripts (8 concurrent) 1391.3 lpm (60.0 s, 1 samples)

System Call Overhead 3284659.7 lps (10.0 s, 1 samples)

System Benchmarks Index Values BASELINE RESULT INDEX

Dhrystone 2 using register variables 116700.0 58393583.7 5003.7

Double-Precision Whetstone 55.0 7356.6 1337.6

Execl Throughput 43.0 7037.2 1636.6

File Copy 1024 bufsize 2000 maxblocks 3960.0 1368114.0 3454.8

File Copy 256 bufsize 500 maxblocks 1655.0 390873.0 2361.8

File Copy 4096 bufsize 8000 maxblocks 5800.0 3596554.0 6201.0

Pipe Throughput 12440.0 2688283.4 2161.0

Pipe-based Context Switching 4000.0 572723.9 1431.8

Process Creation 126.0 22877.0 1815.6

Shell Scripts (1 concurrent) 42.4 9545.3 2251.2

Shell Scripts (8 concurrent) 6.0 1391.3 2318.8

System Call Overhead 15000.0 3284659.7 2189.8

========

System Benchmarks Index Score 2394.8

[root@v-yfb-cos72-sql05 UnixBench]#

[root@node1 UnixBench]# ./Run -i 1

make all

make[1]: Entering directory `/root/UnixBench'

Checking distribution of files

./pgms exists

./src exists

./testdir exists

./tmp exists

./results exists

make[1]: Leaving directory `/root/UnixBench'

sh: 3dinfo: command not found

# # # # # # # ##### ###### # # #### # #

# # ## # # # # # # # ## # # # # #

# # # # # # ## ##### ##### # # # # ######

# # # # # # ## # # # # # # # # #

# # # ## # # # # # # # ## # # # #

#### # # # # # ##### ###### # # #### # #

Version 5.1.3 Based on the Byte Magazine Unix Benchmark

Multi-CPU version Version 5 revisions by Ian Smith,

Sunnyvale, CA, USA

January 13, 2011 johantheghost at yahoo period com

...... 这个工具不单单是测试I/O

8 ioping 的安装和使用

下载 ioping-0.8.tar.gz

wget https://ioping.googlecode.com/files/ioping‐0.8.tar.gz

tar zxvf ioping‐0.8.tar.gz

cd ioping‐0.8/

make

make install

./ioping ‐c 1000 /home/

##To run ioping in current directory

./ioping ‐c 1000 .

## run ioping with direct I/O

./ioping ‐D ‐c 1000 .

# ./ioping -D -c 10 .

4.0 KiB from . (xfs /dev/mapper/centos-root): request=1 time=2.7 ms

4.0 KiB from . (xfs /dev/mapper/centos-root): request=2 time=330 us

4.0 KiB from . (xfs /dev/mapper/centos-root): request=3 time=382 us

4.0 KiB from . (xfs /dev/mapper/centos-root): request=4 time=383 us

4.0 KiB from . (xfs /dev/mapper/centos-root): request=5 time=451 us

4.0 KiB from . (xfs /dev/mapper/centos-root): request=6 time=280 us

4.0 KiB from . (xfs /dev/mapper/centos-root): request=7 time=435 us

4.0 KiB from . (xfs /dev/mapper/centos-root): request=8 time=292 us

4.0 KiB from . (xfs /dev/mapper/centos-root): request=9 time=241 us

4.0 KiB from . (xfs /dev/mapper/centos-root): request=10 time=309 us

--- . (xfs /dev/mapper/centos-root) ioping statistics ---

10 requests completed in 9.0 s, 1.7 k iops, 6.8 MiB/s

min/avg/max/mdev = 241 us / 576 us / 2.7 ms / 697 us

注意上面的时间单位 microsecond(us)=1/1000000 ms (millisecond)=1/1000

下面引用褚霸总结的性能必知数字 《利用新硬件提升数据库性能.pptx

L1 cache reference

0.5 ns

Branch mispredict

5 ns

L2 cache reference

7 ns

Mutex lock/unlock

25 ns

Main memory reference

100 ns

Compress 1K bytes with Zippy

3,000 ns

Send 2K bytes over 1 Gbps network 20微秒)

20,000 ns

Read 1 MB sequentially from memory

250,000 ns

Round trip within same datacenter

500,000 ns

Disk seek 10毫秒 10 ms

10,000,000 ns

Read 1 MB sequentially from disk

20,000,000 ns

Send packet CA->Netherlands->CA (150毫秒)

150,000,000 ns

nanoseconds (ns) = 1/1000000000

9 PerfKitBenchmarker

参考 https://wiki.mikejung.biz/Google_PerfKitBenchmarker

这个没有做测试。

apt-get install git python-pip python-dev unzip openjdk-7-jre

git clone https://github.com/GoogleCloudPlatform/PerfKitBenchmarker.git

cd PerfKitBenchmarker/

pip install -r requirements.txt

10 AIX 下磁盘 I/O 性能分析

https://www.ibm.com/developerworks/cn/aix/library/1203_weixy_aixio/index.html

1. 常见磁盘类型及其 IOPS

http://en.wikipedia.org/wiki/IOPS

0