fio 硬盘分区需要格式化吗硬盘吗

博主最新文章
博主热门文章
您举报文章:
举报原因:
原文地址:
原因补充:
(最多只允许输入30个字)博主最新文章
博主热门文章
您举报文章:
举报原因:
原文地址:
原因补充:
(最多只允许输入30个字)博主最新文章
博主热门文章
您举报文章:
举报原因:
原文地址:
原因补充:
(最多只允许输入30个字)fio使用说明
简介:fio 是一个 开源的硬件I/O压力测试工具,主要是用来测试磁盘/SSD的io性能,也可测试cpu,nic的io性能。它可以支持13种不同的I/O引擎,包括:sync,
mmap, libaio, posixaio, SG v3, splice, network, syslet, guasi,
solarisaio, I/O priorities (针对新的Linux内核), rate
I/O, forked or threaded jobs等。不同引擎的具体含义,可以参看fio的说明文档(安装后可以通过man fio查看),例如:
Basic read(2) or write(2) I/O.& fseek(2) is used
to position the I/O location.
psync: Basic pread(2) or pwrite(2) I/O.
vsync: Basic readv(2) or writev(2) I/O. Will emulate queuing by
coalescing adjacents IOs into a&
single&submission.
libaio: Linux native asynchronous I/O.
fio支持的平台:Linux, FreeBSD, NetBSD, OS X, OpenSolaris, AIX,
Windows,这里主要讲讲linux下地使用。
下载地址:
依赖包:libaio-dev
安装:下载解压后具体安装过程详见README,其实只要make, make install即可;
安装过程如果报错请安装依赖包:sudo apt-get install
libaio-dev。
使用:这个工具的可定制性非常强,可以根据测试者的想法进行各种混合io的测试。使用方法主要有两种形式,一种是命令形式,即fio [-options];另一种则是fio +
负载说明文件形式,下面我们来具体看两个例子。
1. 命令形式
fio &filename=/dev/sda1 &direct=1 &rw=randread &bs=4k &size=60G &numjobs=64 &runtime=10 &group_reporting &name=test
各参数含义可通过man fio查询得到,这里只简单说明几个:
filename:待测试的设备名或挂载文件名
direct:绕过OS的文件系统缓冲区测试
rw:指定读写模式,这里是测随机读性能
bs:每次请求的IO大小
size:测试的目标区域大小
name:本次测试任务的名字,随便取
2.负载说明文件形式:先生成一个负载说明文件,再通过fio 负载文件名方式执行
安装后,安装目录下有个examples文件夹,下面已有现成的一些例子,这里举个测试SSD“四项全能”性能的例子:
[文件名:SSD-test]
are usually separated from the good drives.
uses a queue depth of 4. New SATA SSD's will support up to
flight commands, so it may also be interesting to increase the
and compare. Note that most real-life usage will not see
of a queue depth, so 4 is more representative of normal
ioengine=libaio
runtime=60
directory=/mount-point-of-ssd
filename=ssd.test.file
[seq-read]
[rand-read]
rw=randread
[seq-write]
[rand-write]
rw=randwrite
测试结果如下:
seq-read: (g=0): rw=read,
bs=1M-1M/1M-1M/1M-1M, ioengine=libaio, iodepth=4
rand-read: (g=1): rw=randread,
bs=1M-1M/1M-1M/1M-1M, ioengine=libaio, iodepth=4
seq-write: (g=2): rw=write, bs=1M-1M/1M-1M/1M-1M,
ioengine=libaio, iodepth=4
rand-write: (g=3): rw=randwrite,
bs=1M-1M/1M-1M/1M-1M, ioengine=libaio, iodepth=4
fio-2.0.10
Starting 4 processes
seq-read: Laying out IO file(s) (1 file(s) /
seq-read(顺序读性能): (groupid=0, jobs=1): err=
0: pid=2460: Thu Nov &1 21:15:52 2012
io(测试了1G的数据)=1024.0MB, bw(带宽)=139643KB/s, iops(每秒钟的IO数)=136 ,
runt(总运行时间)= &7509msec
& & slat (usec):
min=71 , max=814 , avg=95.42, stdev=42.51
& & clat (msec):
min=8 , max=43 , avg=29.20, stdev= 1.16
&lat (msec): min=9 , max=43 , avg=29.30, stdev=
percentiles (usec):
&| &1.00th=[28288],
&5.00th=[29056], 10.00th=[29056],
20.00th=[29056],
&| 30.00th=[29056], 40.00th=[29312],
50.00th=[29312], 60.00th=[29312],
&| 70.00th=[29312], 80.00th=[29312],
90.00th=[29312], 95.00th=[29312],
&| 99.00th=[31872], 99.50th=[36608],
99.90th=[36608], 99.95th=[43776],
&| 99.99th=[43776]
& & bw (KB/s)
&: min=137885, max=139912, per=100.00%,
avg=, stdev=541.74
& & lat (msec) :
10=0.10%, 20=0.10%, 50=99.80%
&: usr=0.11%, sys=1.55%, ctx=1050, majf=0,
& IO depths &
&: 1=0.1%, 2=0.2%, 4=99.7%, 8=0.0%, 16=0.0%,
32=0.0%, &=64=0.0%
&submit & &:
0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%,
&complete &: 0=0.0%, 4=100.0%,
8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, &=64=0.0%
&issued & &:
total=r=1024/w=0/d=0, short=r=0/w=0/d=0
rand-read(随机读性能): (groupid=1, jobs=1): err=
0: pid=2461: Thu Nov &1 21:15:52 2012
io=1024.0MB, bw=139624KB/s, iops=136 , runt=
& & slat (usec):
min=69 , max=750 , avg=87.59, stdev=41.23
& & clat (msec):
min=8 , max=43 , avg=29.21, stdev= 1.19
&lat (msec): min=9 , max=43 , avg=29.30, stdev=
percentiles (usec):
&| &1.00th=[25728],
&5.00th=[29056], 10.00th=[29056],
20.00th=[29056],
&| 30.00th=[29056], 40.00th=[29312],
50.00th=[29312], 60.00th=[29312],
&| 70.00th=[29312], 80.00th=[29312],
90.00th=[29312], 95.00th=[29312],
&| 99.00th=[33024], 99.50th=[36608],
99.90th=[37120], 99.95th=[43776],
&| 99.99th=[43776]
& & bw (KB/s)
&: min=137612, max=139912, per=100.00%,
avg=, stdev=614.70
& & lat (msec) :
10=0.10%, 20=0.10%, 50=99.80%
&: usr=0.21%, sys=1.39%, ctx=1042, majf=0,
& IO depths &
&: 1=0.1%, 2=0.2%, 4=99.7%, 8=0.0%, 16=0.0%,
32=0.0%, &=64=0.0%
&submit & &:
0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%,
&complete &: 0=0.0%, 4=100.0%,
8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, &=64=0.0%
&issued & &:
total=r=1024/w=0/d=0, short=r=0/w=0/d=0
seq-write(顺序写性能): (groupid=2, jobs=1): err=
0: pid=2462: Thu Nov &1 21:15:52 2012
io=1024.0MB, bw=124593KB/s, iops=121 , runt=
& & slat (usec):
min=91 , max=218 , avg=121.47, stdev=16.35
& & clat (msec):
min=9 , max=123 , avg=32.73, stdev= 7.10
&lat (msec): min=9 , max=123 , avg=32.85, stdev=
percentiles (msec):
&| &1.00th=[ &
29], &5.00th=[ & 30], 10.00th=[
& 30], 20.00th=[ & 30],
&| 30.00th=[ & 30], 40.00th=[
& 30], 50.00th=[ & 31], 60.00th=[
&| 70.00th=[ & 33], 80.00th=[
& 36], 90.00th=[ & 41], 95.00th=[
&| 99.00th=[ & 45], 99.50th=[
& 47], 99.90th=[ &124], 99.95th=[
&| 99.99th=[ &124]
& & bw (KB/s)
&: min=102400, max=136669, per=99.68%,
avg=, stdev=14056.58
& & lat (msec) :
10=0.10%, 20=0.10%, 50=99.41%, 250=0.39%
&: usr=0.57%, sys=1.24%, ctx=1066, majf=0,
& IO depths &
&: 1=0.1%, 2=0.2%, 4=99.7%, 8=0.0%, 16=0.0%,
32=0.0%, &=64=0.0%
&submit & &:
0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%,
&complete &: 0=0.0%, 4=100.0%,
8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, &=64=0.0%
&issued & &:
total=r=0/w=0/d=1024, short=r=0/w=0/d=0
rand-write(随机写性能): (groupid=3, jobs=1): err=
0: pid=2463: Thu Nov &1 21:15:52 2012
io=1024.0MB, bw=101351KB/s, iops=98 , runt= 10346msec
& & slat (usec):
min=90 , max=217 , avg=121.88, stdev=11.10
& & clat (msec):
min=7 , max=152 , avg=40.26, stdev=12.33
&lat (msec): min=7 , max=152 , avg=40.38,
stdev=12.33
percentiles (msec):
&| &1.00th=[ &
29], &5.00th=[ & 33], 10.00th=[
& 34], 20.00th=[ & 36],
&| 30.00th=[ & 38], 40.00th=[
& 39], 50.00th=[ & 40], 60.00th=[
&| 70.00th=[ & 41], 80.00th=[
& 42], 90.00th=[ & 44], 95.00th=[
&| 99.00th=[ &128], 99.50th=[
&133], 99.90th=[ &139], 99.95th=[
&| 99.99th=[ &153]
& & bw (KB/s)
&: min=64887, max=108544, per=99.84%,
avg=, stdev=9916.67
& & lat (msec) :
10=0.10%, 20=0.10%, 50=96.48%, 100=1.76%, 250=1.56%
&: usr=0.70%, sys=0.81%, ctx=1058, majf=0,
& IO depths &
&: 1=0.1%, 2=0.2%, 4=99.7%, 8=0.0%, 16=0.0%,
32=0.0%, &=64=0.0%
&submit & &:
0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%,
&complete &: 0=0.0%, 4=100.0%,
8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, &=64=0.0%
&issued & &:
total=r=0/w=0/d=1024, short=r=0/w=0/d=0
Run status group 0 (all jobs):
io=1024.0MB, aggrb=139642KB/s, minb=139642KB/s, maxb=139642KB/s,
mint=7509msec, maxt=7509msec
Run status group 1 (all jobs):
io=1024.0MB, aggrb=139623KB/s, minb=139623KB/s, maxb=139623KB/s,
mint=7510msec, maxt=7510msec
Run status group 2 (all jobs):
& WRITE: io=1024.0MB,
aggrb=124593KB/s, minb=124593KB/s, maxb=124593KB/s, mint=8416msec,
maxt=8416msec
Run status group 3 (all jobs):
& WRITE: io=1024.0MB,
aggrb=101350KB/s, minb=101350KB/s, maxb=101350KB/s, mint=10346msec,
maxt=10346msec
Disk stats (read/write):
& sdb: ios=,
merge=, ticks=520, in_queue=278152,
util=97.17%
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。& & & 我们如何衡量一个存储的性能呢?IOPS(Input/Output OperationsPer Second),即每秒进行读写(I/O)操作的次数是国际上通用的存储性能衡量标准,IOPS越高意味着在同一时间系统能够处理的用户请求越多,能够承载用户访问压力就越大,满足同样性能需求的配置就越低,由此可以为客户带来更高的生产效率和价值。& & & 各存储厂商增加被测产品IOPS值的办法有两个:尽量使用小容量(如36GB、 73GB)、高转速(15krpm)的磁盘,尽量增加被测产品的磁盘数量,因为单块磁盘的容量越小、转速越高,其IOPS值越高,磁盘数量越多,通过RAID 0获得的IOPS值越高;尽量选择RAID 10设置,因为在各种RAID级别中,RAID 10的IOPS值最高。
-------------------------------------------------------------
FIO是测试IOPS的非常好的工具,用来对硬件进行压力测试和验证,支持13种不同的I/O引擎,
包括:sync,mmap, libaio, posixaio, SG v3, splice, null, network, syslet, guasi, solarisaio 等等。&
fio 官网地址:http://freshmeat.net/projects/fio/&
一、FIO安装&
yum install libaio-devel&
tar -jxvf fio-2.1.7.tar.bz2&
cd fio-2.1.7&
./configure
make &&make install&
fio工具支持多种类型的测试,并且参数非常多,可以通过帮助文档获得使用信息。以下内容简单说明如何查看帮助文档。
主要参数说明:
--help:获得帮助信息。
--cmdhelp:获得命令的帮助文档。
--enghelp:获得引擎的帮助文档。
--debug:通过debug方式查看测试的详细信息。(process, file, io, mem, blktrace, verify, random, parse, diskutil, job, mutex, profile, time, net, rate)
--output:测试结果输出到文件。
--output-format:设置输出格式。(terse, json, normal)
--crctest:测试crc性能。(md5, crc64, crc32, crc32c, crc16, crc7, sha1, sha256, sha512, xxhash:)
--cpuclock-test&&&&&& :CPU始终测试。
二、随机读测试:&
fio -filename=/dev/sdb1 -direct=1 -iodepth 1 -thread -rw=randread -ioengine=psync &-bs=16k -size=200G -numjobs=10 -runtime=1000 -group_reporting -name=mytest
filename=/dev/sdb1 测试文件名称,通常选择需要测试的盘的data目录。&
direct=1 测试过程绕过机器自带的buffer。使测试结果更真实
iodepth:设置IO队列的深度
thread & fio使用线程而不是进程
rw=randread &测试随机读的I/O
ioengine=psync io引擎使用psync方式&
bs=16k 单次io的块文件大小为16k&
bsrange=512-2048 同上,提定数据块的大小范围&
size=200g 本次的测试文件大小为200g,以每次4k的io进行测试
numjobs=10 本次的测试线程为10
runtime=1000 测试时间为1000秒,如果不写则一直将5g文件分4k每次写完为止
group_reporting 关于显示结果的,汇总每个进程的信息
rwmixwrite=30 在混合读写的模式下,写占30%&
lockmem=1g 只使用1g内存进行测试
zero_buffers 用0初始化系统buffer
nrfiles=8 每个进程生成文件的数量
fio -filename=/dev/sdb1 -direct=1 -iodepth 1 -thread -rw=read -ioengine=psync -bs=16k -size=200G -numjobs=30 -runtime=1000 -group_reporting -name=mytest&
fio -filename=/dev/sdb1 -direct=1 -iodepth 1 -thread -rw=randwrite -ioengine=psync -bs=16k -size=200G -numjobs=30 -runtime=1000 -group_reporting -name=mytest&
fio -filename=/dev/sdb1 -direct=1 -iodepth 1 -thread -rw=write -ioengine=psync -bs=16k -size=200G -numjobs=30 -runtime=1000 -group_reporting -name=mytest&
混合随机读写:&
fio -filename=/dev/sdb1 -direct=1 -iodepth 1 -thread -rw=randrw -rwmixread=70 -ioengine=psync -bs=16k -size=200G -numjobs=30 -runtime=100 -group_reporting -name=mytest -ioscheduler=noop&
三,实际测试范例:&
测试结果显示了详细的系统信息,包括io、latency、bandwidth、cpu等信息,详细如下所示:
[root@localhost ~]# fio -filename=/dev/sdb1 -direct=1 -iodepth 1 -thread -rw=randrw -rwmixread=70 -ioengine=psync -bs=16k -size=200G -numjobs=30&-runtime=100 -group_reporting -name=mytest1&
mytest1: (g=0): rw=randrw, bs=16K-16K/16K-16K, ioengine=psync, iodepth=1&
mytest1: (g=0): rw=randrw, bs=16K-16K/16K-16K, ioengine=psync, iodepth=1&
fio 2.0.7&
Starting 30 threads&
Jobs: 1 (f=1): [________________m_____________] [3.5% done] [K /s] [423 /190 iops] [eta 48m:20s] s]&
mytest1: (groupid=0, jobs=30): err= 0: pid=23802&
read&: io(测试的数据量)=1853.4MB,&bw(带宽)=18967KB/s, iops=1185&, runt(总运行时间)=100058msec&
clat (usec): min=60 , max=871116 , avg=25227.91, stdev=31653.46&
lat (usec): min=60 , max=871117 , avg=25228.08, stdev=31653.46&
clat percentiles (msec):&
| 1.00th=[ 3], 5.00th=[ 5], 10.00th=[ 6], 20.00th=[ 8],&
| 30.00th=[ 10], 40.00th=[ 12], 50.00th=[ 15], 60.00th=[ 19],&
| 70.00th=[ 26], 80.00th=[ 37], 90.00th=[ 57], 95.00th=[ 79],&
| 99.00th=[ 151], 99.50th=[ 202], 99.90th=[ 338], 99.95th=[ 383],&
| 99.99th=[ 523]&
bw (KB/s) : min= 26, max= 1944, per=3.36%, avg=636.84, stdev=189.15&
write: io=803600KB,&bw=8031.4KB/s, iops=501&, runt=100058msec&
clat (usec): min=52 , max=9302 , avg=146.25, stdev=299.17&
lat (usec): min=52 , max=9303 , avg=147.19, stdev=299.17&
clat percentiles (usec):&
| 1.00th=[ 62], 5.00th=[ 65], 10.00th=[ 68], 20.00th=[ 74],&
| 30.00th=[ 84], 40.00th=[ 87], 50.00th=[ 89], 60.00th=[ 90],&
| 70.00th=[ 92], 80.00th=[ 97], 90.00th=[ 120], 95.00th=[ 370],&
| 99.00th=[ 1688], 99.50th=[ 2128], 99.90th=[ 3088], 99.95th=[ 3696],&
| 99.99th=[ 5216]&
bw (KB/s) : min= 20, max= 1117, per=3.37%, avg=270.27, stdev=133.27&
lat (usec) : 100=24.32%, 250=3.83%, 500=0.33%, 750=0.28%, %&
lat (msec) : 2=0.64%, 4=3.08%, 10=20.67%, 20=19.90%, 50=17.91%&
lat (msec) : 100=6.87%, 250=1.70%, 500=0.19%, 750=0.01%, %&
cpu : usr=1.70%, sys=2.41%, ctx=5237835, majf=0, minf=6344162&
IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, &=64=0.0%&
  submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, &=64=0.0%&
  complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, &=64=0.0%&
  issued : total=r=118612/w=50225/d=0, short=r=0/w=0/d=0&
Run status group 0 (all jobs):&
  READ: io=1853.4MB, aggrb=18966KB/s, minb=18966KB/s, maxb=18966KB/s, mint=100058msec, maxt=100058msec&
  WRITE: io=803600KB, aggrb=8031KB/s, minb=8031KB/s, maxb=8031KB/s, mint=100058msec, maxt=100058msec&
Disk stats (read/write):&
  sdb: ios=24, merge=0/0, ticks=0, in_queue=2998169, util=99.77%&
主要查看以上红色字体部分的iops(read/write)&
**磁盘阵列吞吐量与IOPS两大瓶颈分析**
  吞吐量主要取决于阵列的构架,光纤通道的大小(现在阵列一般都是光纤阵列,至于SCSI这样的SSA阵列,我们不讨论)以及硬盘的个数。阵列的构架与每个阵列不同而不同,他们也都存在内部带宽(类似于pc的系统总线),不过一般情况下,内部带宽都设计的很充足,不是瓶颈的所在。
  光纤通道的影响还是比较大的,如数据仓库环境中,对数据的流量要求很大,而一块2Gb的光纤卡,所77能支撑的最大流量应当是2Gb/8(小B)=250MB/s(大B)的实际流量,当4块光纤卡才能达到1GB/s的实际流量,所以数据仓库环境可以考虑换4Gb的光纤卡。
  最后说一下硬盘的限制,这里是最重要的,当前面的瓶颈不再存在的时候,就要看硬盘的个数了,我下面列一下不同的硬盘所能支撑的流量大小:
  10 K rpm 15 K rpm ATA
  &&& &&& &&&
  10M/s 13M/s 8M/s
  那么,假定一个阵列有120块15K rpm的光纤硬盘,那么硬盘上最大的可以支撑的流量为120*13=1560MB/s,如果是2Gb的光纤卡,可能需要6块才能够,而4Gb的光纤卡,3-4块就够了。
  决定IOPS的主要取决与阵列的算法,cache命中率,以及磁盘个数。阵列的算法因为不同的阵列不同而不同,如我们最近遇到在hds usp上面,可能因为ldev(lun)存在队列或者资源限制,而单个ldev的iops就上不去,所以,在使用这个存储之前,有必要了解这个存储的一些算法规则与限制。
  cache的命中率取决于数据的分布,cache size的大小,数据访问的规则,以及cache的算法,如果完整的讨论下来,这里将变得很复杂,可以有一天好讨论了。我这里只强调一个cache的命中率,如果一个阵列,读cache的命中率越高越好,一般表示它可以支持更多的IOPS,为什么这么说呢?这个就与我们下面要讨论的硬盘IOPS有关系了。
  硬盘的限制,每个物理硬盘能处理的IOPS是有限制的,如
  10 K rpm 15 K rpm ATA
  &&& &&& &&&
  100 150 50
  同样,如果一个阵列有120块15K rpm的光纤硬盘,那么,它能撑的最大IOPS为120*150=18000,这个为硬件限制的理论值,如果超过这个值,硬盘的响应可能会变的非常缓慢而不能正常提供业务。
  在raid5与raid10上,读iops没有差别,但是,相同的业务写iops,最终落在磁盘上的iops是有差别的,而我们评估的却正是磁盘的IOPS,如果达到了磁盘的限制,性能肯定是上不去了。
  那我们假定一个case,业务的iops是10000,读cache命中率是30%,读iops为60%,写iops为40%,磁盘个数为120,那么分别计算在raid5与raid10的情况下,每个磁盘的iops为多少。
  raid5:
  单块盘的iops = (1.3)*0.6 + 4 * ())/120
  = (4200 + 1
  这里的1.3)*0.6表示是读的iops,比例是0.6,除掉cache命中,实际只有4200个iops
  而4 * () 表示写的iops,因为每一个写,在raid5中,实际发生了4个io,所以写的iops为16000个
  为了考虑raid5在写操作的时候,那2个读操作也可能发生命中,所以更精确的计算为:
  单块盘的iops = (1.3)*0.6 + 2 * ()*(1-0.3) + 2 * ())/120
  = (4200 + 5600 +
  计算出来单个盘的iops为148个,基本达到磁盘极限
  raid10
  单块盘的iops = (1.3)*0.6 + 2 * ())/120
  = (4200 +
  可以看到,因为raid10对于一个写操作,只发生2次io,所以,同样的压力,同样的磁盘,每个盘的iops只有102个,还远远低于磁盘的极限iops。
  在一个实际的case中,一个恢复压力很大的standby(这里主要是写,而且是小io的写),采用了raid5的方案,发现性能很差,通过分析,每个磁盘的iops在高峰时期,快达到200了,导致响应速度巨慢无比。后来改造成raid10,就避免了这个性能问题,每个磁盘的iops降到100左右。

我要回帖

更多关于 新硬盘需要格式化吗 的文章

 

随机推荐