1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 服务器io测试工具-fio

服务器io测试工具-fio

时间:2020-05-07 08:29:11

相关推荐

服务器io测试工具-fio

Fio 是一个 I/O 工具,旨在用于基准测试和压力/硬件验证。它支持 19 种不同类型的 I/O 引擎(sync、mmap、libaio、posixaio、SG v3、splice、null、network、syslet、guasi、solarisaio 等)、I/O 优先级(适用于较新的 Linux 内核) 、评估 I/O、分叉或线程作业等等。它可以在块设备和文件上工作。fio 接受简单易懂的文本格式的职位描述。包括几个示例作业文件。fio 显示各种 I/O 性能信息,包括完整的 IO 延迟和百分位数。Fio 在许多地方被广泛使用,用于基准测试、QA 和验证目的。它支持 Linux、FreeBSD、NetBSD、OpenBSD、OS X、OpenSolaris、AIX、HP-UX、Android 和 Windows。 目前主流的第三方IO测试工具有fio、iometer 和 Orion,这三种工具各有千秋,在linux 下也可以使用dd 进行简单的磁盘(文件系统)测试(文末补充)。 Fio在Linux系统下使用比较方便,iometer在window系统下使用比较方便,Orion是oracle的IO测试软件,可在没有安装oracle数据库的情况下模拟oracle数据库场景的读写。 Multithreaded IO generation tool , FIO 是一个多线程io生成工具,可以生成多种IO模式,用来测试磁盘设备的性能(也包含文件系统:如针对网络文件系统 NFS 的IO测试)。

1.安装fio工具

1.1 yum 安装fio

[root@s2ahumysqlpg01 fio-3.29]# yum install fio[root@s2ahumysqlpg01 fio-3.29]# yum info fioLoaded plugins: ulninfoAvailable PackagesName: fioArch: x86_64Version : 3.7Release : 2.el7Size: 467 kRepo: centos-7-baseSummary : Multithreaded IO generation toolURL: http://git.kernel.dk/?p=fio.git;a=summaryLicense : GPLv2Description : fio is an I/O tool that will spawn a number of threads or processes doing: a particular type of io action as specified by the user. fio takes a: number of global parameters, each inherited by the thread unless: otherwise parameters given to them overriding that setting is given.: The typical use of fio is to write a job file matching the io load: one wants to simulate.

1.2 源码安装fio

#可根据实际测试中缺少的插件,安装依赖包yum -y install libaio-devel libaio-dev libaio* zilb*​下载 https://git.kernel.dk/cgit/fio/​tar -zxvf fio-3.29.tar.gzcd fio-3.29# 注意如果编译的时候出现gcc 版本过低,可参考问题升级gcc 后在编译。 或者安装fio-3.20的版本./configure makemake install​[root@s2ahumysqlpg01 fio-3.29]# fio -vfio-3.29

2.输入输出参数

2.1Fio常用输入参数

filename=/dev/emcpowerb支持文件系统或者裸设备,-filename=/dev/sdadirect=1 测试过程绕过机器自带的buffer,使测试结果更真实rw=randwread 测试随机读的I/Orw=randwrite 测试随机写的I/Orw=randrw测试随机混合写和读的I/Orw=read 测试顺序读的I/Orw=write 测试顺序写的I/Orw=rw 测试顺序混合写和读的I/Obs=4k 单次io的块文件大小为4kbsrange=512-2048 同上,提定数据块的大小范围size=5g 本次的测试文件大小为5g,以每次4k的io进行测试numjobs=30 本次的测试线程为30runtime=1000 测试时间为1000秒,如果不写则一直将5g文件分4k每次写完为止ioengine=psync io引擎使用pync方式(同步I),如果要使用libaio引擎, 需要yum install libaio-devel包rwmixwrite=30 在混合读写的模式下,写占30%group_reporting关于显示结果的,汇总每个进程的信息lockmem=1g 只使用1g内存进行测试zero_buffers 用0初始化系统buffer。nrfiles=8 每个进程生成文件的数量。​磁盘读写常用测试点:1. Read=100% Ramdon=100% rw=randread (100%随机读)2. Read=100% Sequence=100% rw=read (100%顺序读)3. Write=100% Sequence=100% rw=write (100%顺序写)4. Write=100% Ramdon=100% rw=randwrite (100%随机写)5. Read=70% Sequence=100% rw=rw, rwmixread=70, rwmixwrite=30 (70%顺序读,30%顺序写)6. Read=70% Ramdon=100% rw=randrw, rwmixread=70, rwmixwrite=30 (70%随机读,30%随机写)

2.2Fio输出结果说明

Fio工具读写测速结果参数说明io 执行了多少M的IObw 平均IO带宽iops IOPSrunt 线程运行时间slat 提交延迟 (stdev指标准差)clat 完成延迟lat 响应时间bw 带宽cpu 利用率IO depths io队列IO submit单个IO提交要提交的IO数IO complete 与上面的提交编号类似,但用于完成。IO issued发出的读/写请求的数量,以及其中有多少是短的。IO latencies IO完延迟的分布io 总共执行了多少size的IOaggrbgroup总带宽minb 最小平均带宽.maxb 最大平均带宽.mint group中线程的最短运行时间.maxt group中线程的最长运行时间.ios 所有group总共执行的IO数.merge 总共发生的IO合并数.ticks 我们保持磁盘繁忙的ticks数。io_queue花费在队列上的总共时间.util 磁盘利用率

【免费订阅,永久学习】学习地址:

C/C++Linux服务器开发/后台架构师【学习视频教程】

LinuxC/C++服务器开发/架构师 面试题、学习资料、教学视频和学习路线图(资料包括C/C++,Linux,Nginx,ZeroMQ,MySQL,Redis、MongoDB,ZK,流媒体,CDN,P2P,K8S,Docker,TCP/IP,协程,DPDK等),或点击这里加qun免费领取,关注我持续更新哦! !

【免费订阅,永久学习】学习地址:

Dpdk/网络协议栈/vpp/OvS/DDos/NFV/虚拟化/高性能专家-学习视频教程-腾讯课堂

3.测试场景

3.1顺序读

# 顺序读注意,bs 单次io的块文件大小,我们建议可以设置为数据库的块或页大小,在真实的环境中或以调大size fio -filename=/dev/sda1 -direct=1 -iodepth= 1 -rw=read -ioengine=psync -bs=4k -size=1000G -numjobs=50 -runtime=180 -group_reporting -name=sqe_100read_4k​[root@s2ahumysqlpg01 tmp]# fio -filename=/tmp/read.dat -direct=1 -iodepth 1 -rw=read -ioengine=psync -bs=4k -size=4G -numjobs=1 -runtime=180 -group_reporting -name=sqe_100read_4ksqe_100read_4k: (g=0): rw=read, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=psync, iodepth=1fio-3.29Starting 1 processsqe_100read_4k: Laying out IO file (1 file / 4096MiB)Jobs: 1 (f=1): [R(1)][100.0%][r=8372KiB/s][r=2093 IOPS][eta 00m:00s]ta 00m:56s]sqe_100read_4k: (groupid=0, jobs=1): err= 0: pid=5685: Fri Mar 4 17:42:10 read: IOPS=3317, BW=13.0MiB/s (13.6MB/s)(2332MiB/180001msec)clat (usec): min=209, max=535634, avg=296.20, stdev=1443.62lat (usec): min=210, max=535635, avg=297.13, stdev=1443.62clat percentiles (usec):| 1.00th=[ 233], 5.00th=[ 241], 10.00th=[ 243], 20.00th=[ 247],| 30.00th=[ 251], 40.00th=[ 253], 50.00th=[ 258], 60.00th=[ 265],| 70.00th=[ 269], 80.00th=[ 281], 90.00th=[ 302], 95.00th=[ 330],| 99.00th=[ 627], 99.50th=[ 1074], 99.90th=[ 4817], 99.95th=[ 9896],| 99.99th=[34866]bw ( KiB/s): min= 32, max=15432, per=100.00%, avg=13284.66, stdev=2559.17, samples=359iops : min= 8, max= 3858, avg=3321.16, stdev=639.79, samples=359lat (usec) : 250=28.88%, 500=69.77%, 750=0.58%, 1000=0.21%lat (msec) : 2=0.36%, 4=0.08%, 10=0.06%, 20=0.03%, 50=0.02%lat (msec) : 100=0.01%, 250=0.01%, 500=0.01%, 750=0.01%cpu: usr=3.56%, sys=7.57%, ctx=597121, majf=0, minf=14IO 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 rwts: total=597112,0,0,0 short=0,0,0,0 dropped=0,0,0,0latency : target=0, window=0, percentile=100.00%, depth=1​Run status group 0 (all jobs):READ: bw=13.0MiB/s (13.6MB/s), 13.0MiB/s-13.0MiB/s (13.6MB/s-13.6MB/s), io=2332MiB (2446MB), run=180001-180001msec​Disk stats (read/write):sda: ios=599673/169, merge=2/7, ticks=185089/422, in_queue=184716, util=90.06%

我们需要得点关注的是IOPS :3317 以及BW IO带宽是:13.0MiB/s read: IOPS=3317, BW=13.0MiB/s (13.6MB/s)(2332MiB/180001msec)

3.2 随机写

#随机写 -rw=randwrite ,我们启用了50个进程模拟[root@s2ahumysqlpg01 fio-3.29]# fio -filename=/tmp/write.dat -direct=1 -iodepth 1 -rw=randwrite -ioengine=psync -bs=4k -size=4G -numjobs=50 -runtime=180 -group_reporting -name=sqe_100write_4ksqe_100write_4k: (g=0): rw=randwrite, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=psync, iodepth=1...fio-3.29Starting 50 processessqe_100write_4k: Laying out IO file (1 file / 4096MiB)Jobs: 50 (f=50): [w(50)][100.0%][w=3692KiB/s][w=923 IOPS][eta 00m:00s] sqe_100write_4k: (groupid=0, jobs=50): err= 0: pid=7128: Fri Mar 4 17:54:18 write: IOPS=1108, BW=4434KiB/s (4540kB/s)(781MiB/180331msec); 0 zone resetsclat (usec): min=311, max=5969.7k, avg=45097.62, stdev=236640.38lat (usec): min=313, max=5969.7k, avg=45098.90, stdev=236640.39clat percentiles (usec):| 1.00th=[ 750], 5.00th=[ 1057], 10.00th=[ 1303],| 20.00th=[ 1647], 30.00th=[ 1844], 40.00th=[ 2343],| 50.00th=[ 3064], 60.00th=[ 3687], 70.00th=[ 4047],| 80.00th=[ 4948], 90.00th=[ 22938], 95.00th=[ 164627],| 99.00th=[1283458], 99.50th=[1753220], 99.90th=[2634023],| 99.95th=[3640656], 99.99th=[5939135]bw ( KiB/s): min= 350, max=103337, per=100.00%, avg=7568.53, stdev=265.17, samples=10555iops : min= 50, max=25811, avg=1887.29, stdev=66.26, samples=10555lat (usec) : 500=0.09%, 750=0.95%, 1000=3.17%lat (msec) : 2=29.75%, 4=34.89%, 10=18.41%, 20=2.36%, 50=2.42%lat (msec) : 100=1.74%, 250=2.29%, 500=1.44%, 750=0.83%, 1000=0.34%lat (msec) : 2000=1.02%, >=2000=0.30%cpu: usr=0.03%, sys=0.15%, ctx=23, majf=0, minf=821IO 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 rwts: total=0,199884,0,0 short=0,0,0,0 dropped=0,0,0,0latency : target=0, window=0, percentile=100.00%, depth=1​Run status group 0 (all jobs):WRITE: bw=4434KiB/s (4540kB/s), 4434KiB/s-4434KiB/s (4540kB/s-4540kB/s), io=781MiB (819MB), run=180331-180331msec​Disk stats (read/write):sda: ios=0/218756, merge=0/1942, ticks=0/9721312, in_queue=9809977, util=100.00%

我们可以看到IOPS是1108 ,BW带宽只有 4434KiB/s write: IOPS=1108, BW=4434KiB/s (4540kB/s)(781MiB/180331msec); 0 zone resets

3.3随机读写混合

#70%随机读-rwmixread=70 ,30%随机写[root@s2ahumysqlpg01 fio-3.29]# fio -filename=/tmp/read_write.dat -direct=1 -iodepth=1 -rw=randrw -rwmixread=70 -ioengine=psync -bs=4k -size=4G -numjobs=50 -runtime=180 -group_reporting -name=randrw_70read_4k​randrw_70read_4k: (g=0): rw=randrw, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=psync, iodepth=1...fio-3.29Starting 50 processesrandrw_70read_4k: Laying out IO file (1 file / 4096MiB)Jobs: 6 (f=6): [m(1),_(7),m(1),_(7),m(1),_(4),m(1),_(6),m(1),_(14),m(1),_(6)][2.2%][r=10.9MiB/s,w=4884KiB/s][r=2801,w=1221 IOPS][eta 02h:11m:59s]randrw_70read_4k: (groupid=0, jobs=50): err= 0: pid=8027: Fri Mar 4 18:01:37 read: IOPS=1802, BW=7209KiB/s (7382kB/s)(1268MiB/180113msec)clat (usec): min=225, max=3503.6k, avg=18238.79, stdev=55447.72lat (usec): min=226, max=3503.6k, avg=18239.86, stdev=55447.72clat percentiles (usec):| 1.00th=[ 330], 5.00th=[ 553], 10.00th=[ 635],| 20.00th=[ 799], 30.00th=[ 1074], 40.00th=[ 1631],| 50.00th=[ 3326], 60.00th=[ 8717], 70.00th=[ 17433],| 80.00th=[ 28967], 90.00th=[ 47973], 95.00th=[ 69731],| 99.00th=[ 147850], 99.50th=[ 196084], 99.90th=[ 429917],| 99.95th=[ 859833], 99.99th=[2936013]bw ( KiB/s): min= 350, max=25119, per=100.00%, avg=8438.00, stdev=106.40, samples=15326iops : min= 50, max= 6272, avg=2094.52, stdev=26.64, samples=15326write: IOPS=774, BW=3096KiB/s (3171kB/s)(545MiB/180113msec); 0 zone resetsclat (usec): min=251, max=3576.5k, avg=22074.38, stdev=134044.57lat (usec): min=252, max=3576.5k, avg=22075.53, stdev=134044.60clat percentiles (usec):| 1.00th=[ 347], 5.00th=[ 537], 10.00th=[ 603],| 20.00th=[ 709], 30.00th=[ 816], 40.00th=[ 955],| 50.00th=[ 1188], 60.00th=[ 1565], 70.00th=[ 2311],| 80.00th=[ 4080], 90.00th=[ 9634], 95.00th=[ 35390],| 99.00th=[ 583009], 99.50th=[1082131], 99.90th=[1501561],| 99.95th=[1837106], 99.99th=[3472884]bw ( KiB/s): min= 350, max=13399, per=100.00%, avg=3753.05, stdev=51.84, samples=14762iops : min= 50, max= 3343, avg=923.38, stdev=13.00, samples=14762lat (usec) : 250=0.06%, 500=2.99%, 750=16.22%, 1000=12.87%lat (msec) : 2=18.13%, 4=10.02%, 10=10.01%, 20=8.68%, 50=13.12%lat (msec) : 100=5.06%, 250=1.98%, 500=0.44%, 750=0.11%, 1000=0.09%lat (msec) : 2000=0.18%, >=2000=0.02%cpu: usr=0.06%, sys=0.14%, ctx=488255, majf=0, minf=1027IO 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 rwts: total=324593,139424,0,0 short=0,0,0,0 dropped=0,0,0,0latency : target=0, window=0, percentile=100.00%, depth=1​Run status group 0 (all jobs):READ: bw=7209KiB/s (7382kB/s), 7209KiB/s-7209KiB/s (7382kB/s-7382kB/s), io=1268MiB (1330MB), run=180113-180113msecWRITE: bw=3096KiB/s (3171kB/s), 3096KiB/s-3096KiB/s (3171kB/s-3171kB/s), io=545MiB (571MB), run=180113-180113msec​Disk stats (read/write):sda: ios=324721/139458, merge=0/2, ticks=5905787/3076202, in_queue=8984158, util=100.00%

从结果中我们可以看到70%随机读的IOPS 是1802 ,30%随机写是774 ,而带宽分别是7209KiB/s,3096KiB/s。 read: IOPS=1802, BW=7209KiB/s (7382kB/s)(1268MiB/180113msec) write: IOPS=774, BW=3096KiB/s (3171kB/s)(545MiB/180113msec); 0 zone resets

4.补充测试

4.1 测试建议

fio 用于测试磁盘性能时,测试之前需要先把要测试的磁盘卸载掉,测试完后需格式化一遍再挂载上去。

# 卸载磁盘umount /mnt/datadir1​# 格式化磁盘mkfs.ext4 /dev/sdd​# 挂载磁盘mount -t ext4 /dev/sdd /mnt/datadir1​# 自动挂载,在里面添加该盘vim /etc/fstab

4.2IO监控

进行磁盘测试的时候,我们可以使用iostat 等监控工具,查看所有磁盘当前的读写状态(fedora 系统上 sysstat-11.7.3-2.fc29.x86_64 收录了此工具)。监控磁盘IO命令:iostat –mx 1# iostat –mx 1avg-cpu: %user %nice %system %iowait %steal %idle0.25 0.00 3.01 80.70 0.00 16.04​Device r/s w/s rMB/s wMB/s rrqm/s wrqm/s %rrqm %wrqm r_await w_await aqu-sz rareq-sz wareq-sz svctm %utilsda13417.00 0.00 209.64 0.00 0.00 0.00 0.00 0.00 2.23 0.00 29.96 16.00 0.00 0.07 100.00​​rrqms:每秒这个设备相关的读取请求有多少被Merge了(当系统调用需要读取数据的时候,VFS将请求发到各个FS,如果FS发现不同的读取请求读取的是相同Block的数据,FS会将这个请求合并Merge)wrqm/s:每秒这个设备相关的写入请求有多少被Merge了。rsec/s:The number of sectors read from the device per second.wsec/s:The number of sectors written to the device per second.rKB/s:The number of kilobytes read from the device per second.wKB/s:The number of kilobytes written to the device per second.avgrq-sz:平均请求扇区的大小,The average size (in sectors) of the requests that were issued to the device.avgqu-sz:是平均请求队列的长度。毫无疑问,队列长度越短越好,The average queue length of the requests that were issued to the device. await:每一个IO请求的处理的平均时间(单位是微秒毫秒)。这里可以理解为IO的响应时间,一般地系统IO响应时间应该低于5ms,如果大于10ms就比较大了。这个时间包括了队列时间和服务时间,也就是说,一般情况下,await大于svctm,它们的差值越小,则说明队列时间越短,反之差值越大,队列时间越长,说明系统出了问题。svctm:表示平均每次设备I/O操作的服务时间(以毫秒为单位)。如果svctm的值与await很接近,表示几乎没有I/O等待,磁盘性能很好。如果await的值远高于svctm的值,则表示I/O队列等待太长,系统上运行的应用程序将变慢。%util: 在统计时间内所有处理IO时间,除以总共统计时间。例如,如果统计间隔1秒,该设备有0.8秒在处理IO,而0.2秒闲置,那么该设备的%util = 0.8/1 = 80%,所以该参数暗示了设备的繁忙程度,一般地,如果该参数是100%表示磁盘设备已经接近满负荷运行了(当然如果是多磁盘,即使%util是100%,因为磁盘的并发能力,所以磁盘使用未必就到了瓶颈)。

4.3IOFIO 图形界面工具

FIO 图形界面工具:fio性能测试工具新添图形前端gfio ,apt install gfio # fio 图形测试工具。

5.dd测试

dd 也是我们经常使用到的磁盘测试工具,Linux服务器装好系统之后,想要知道硬盘的读写是否能满足服务的需要,如果不满足硬盘的IO就是服务的一个瓶颈。我们可以使用dd命令简单进行测试,更为专业的测试可以使用上面描述的fio 工具: time有计时作用,dd用于复制,从if读出,写到of。if=/dev/zero不产生IO,因此可以用来测试纯写速度。同理of=/dev/null不产生IO,可以用来测试纯读速度。bs是每次读或写的大小,即一个块的大小,count是读写块的数量。

5.1 dd纯写速度

[root@s2ahumysqlpg01 fio-3.29]# time dd if=/dev/zero of=/tmp/ddout bs=8k count=50005000+0 records in5000+0 records out40960000 bytes (41 MB) copied, 0.055353 s, 740 MB/s​real 0m0.288suser 0m0.004ssys 0m0.276s[root@s2ahumysqlpg01 fio-3.29]# time dd if=/dev/zero of=/tmp/ddout bs=8k count=5000050000+0 records in50000+0 records out409600000 bytes (410 MB) copied, 1.59508 s, 257 MB/s​real 0m1.604suser 0m0.021ssys 0m0.379s[root@s2ahumysqlpg01 fio-3.29]# time dd if=/dev/zero of=/tmp/ddout bs=8k count=500000500000+0 records in500000+0 records out4096000000 bytes (4.1 GB) copied, 40.5061 s, 101 MB/s​real 0m40.584suser 0m0.279ssys 0m4.036s

dd 测试读写速度,就是读当前磁盘文件,再写入当前磁盘之中。一定程度上,复制量越大,读写的时间越长,统计的结果越准。但是测试结果信息量较少,只能作为参考量,更多读写模式和测试信息:可以使用dd 命令参数来配置: 使用conv, iflag, oflag 三个变量可以配置dd 命令的复制模块式,读取模式和写入模式;

#CONV 选项有:ascii 从 EBCDIC 到 ASCIIebcdic 从 ASCII 到 EBCDICibm 从 ASCII 到备用 EBCDICblock 用空格填充换行符终止的记录到 cbs-sizeunblock 用换行符替换 cbs-size 记录中的尾随空格lcase 将大写改为小写ucase 将小写变为大写sparse 尝试寻找而不是写入 NUL 输入块的输出swab 交换每对输入字节sync 用 NUL 填充每个输入块到 ibs 大小; 与 block 或 unblock 一起使用时,用空格而不是 NUL 填充excl 如果输出文件已经存在,则失败nocreat 不创建输出文件notrunc 不截断输出文件noerror 在读取错误后继续fdatasync 在完成之前物理写入输出文件数据fsync 同样,还要写入元数据​#FLAG( iflag, oflag) 选项有:append 附加模式(仅对输出有意义;建议使用 conv=notrunc)direct 对数据使用直接 I/Odirectory 除非目录失败dsync 对数据使用同步 I/Osync 同样,也适用于元数据 fullblock 累积输入的完整块(仅 iflag)nonblock 使用非阻塞 I/Onoatime 不更新访问时间nocache 丢弃缓存数据noctty 不从文件中分配控制终端nofollow 不遵循符号链接count_bytes 将 'count=N' 视为字节数(仅限 iflag)skip_bytes 将 'skip=N' 视为字节数(仅 iflag)seek_bytes 将 'seek=N' 视为字节数(仅用于标记)​#如果要规避掉文件系统cache,直接读写,不使用buffer cache,需做这样的设置iflag=direct,nonblockoflag=direct,nonblock

5.2 dd纯读速度

[root@s2ahumysqlpg01 fio-3.29]# time dd if=/tmp/ddout of=/dev/null bs=4k count=50005000+0 records in5000+0 records out20480000 bytes (20 MB) copied, 0.180166 s, 114 MB/s​real 0m0.198suser 0m0.000ssys 0m0.033s[root@s2ahumysqlpg01 fio-3.29]# time dd if=/tmp/ddout of=/dev/null bs=4k count=5000050000+0 records in50000+0 records out204800000 bytes (205 MB) copied, 1.5581 s, 131 MB/s​real 0m1.560suser 0m0.026ssys 0m0.271s[root@s2ahumysqlpg01 fio-3.29]# time dd if=/tmp/ddout of=/dev/null bs=4k count=500000500000+0 records in500000+0 records out2048000000 bytes (2.0 GB) copied, 18.0358 s, 114 MB/s​real 0m18.038suser 0m0.240ssys 0m2.054s

5.3 dd 命令三种经典测试

# dd 命令三种经典使用方法:dd if=/dev/zero of=test bs=64k count=16k 是不准确的,可能有数据存在内核缓存中,没有同步到磁盘上。对于关键数据应该加上fsync标识,防止关键数据丢失;dd if=/dev/zero of=test bs=64k count=16k conv=fsync 较为稳妥,但是时间用时较长,他在dd结束前会写数据和文件元数据到磁盘;dd if=/dev/zero of=test bs=64k count=4k oflag=dsync or sync 每写一次就写一次磁盘,在实际操作中,可以听到磁盘响声,用时较长;更多dd 命令详细使用方法,可以参考man pages. dd 命令可以用来制作启动盘,请参见博文 <a href="/xuyaowen/p/linux_make_USB_boot.html" target="_blank" style="text-decoration:none;color:rgb(0, 0, 0);">linux (fedora 28) 制作启动U盘,启动盘</a>​#SSD 性能测试:PCIe-SSD Optane: dd if=/dev/urandom of=./optane.bin bs=256k count=102400 (顺序写 25GB的随机数据) M.2-STAT-SSD: dd if=/dev/urandom of=./m2sata.bin bs=256k count=102400 (顺序写 25GB的随机数据) M.2-NVMe-SSD: dd if=/dev/urandom of=./m2nvme.bin bs=256k count=102400 (顺序写 25GB的随机数据) HDD: dd if=/dev/urandom of=./sata.bin bs=256k count=102400 (顺序写 25GB的随机数据)

6.关于gcc 版本过低问题

[root@s2ahumysqlpg01 fio-3.29]# ./configure Operating system LinuxCPU x86_64Big endian noCompiler gccCross compile no​Static buildno​Your compiler doesn't support C11 atomics. gcc 4.9/clang 3.6 are theminimum versions with it - perhaps your compiler is too old?C11 atomics support not foundConfigure failed, check config.log and/or the above output ​# 升级gcc 版本到 5.2 ## 1.安装centos-release-scl 工具wget /centos/7/extras/x86_64/Packages/centos-release-scl-2-3.el7.centos.noarch.rpmwget /centos/7/extras/x86_64/Packages/centos-release-scl-rh-2-3.el7.centos.noarch.rpm​​[root@s2ahumysqlpg01 yum.repos.d]# rpm -ivh *.rpmwarning: centos-release-scl-2-3.el7.centos.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEYPreparing... ################################# [100%]Updating / installing...1:centos-release-scl-rh-2-3.el7.cen################################# [ 50%]2:centos-release-scl-2-3.el7.centos################################# [100%] ​#2.安装devtoolset,注意,如果想安装7.*版本的,就改成devtoolset-7-gcc*,以此类推yum install centos-release-scl ​#3. 激活对应的devtoolset,所以你可以一次安装多个版本的devtoolset,需要的时候用下面这条命令切换到对应的版本enable devtoolset-8 bash​#4.查看一下gcc版本gcc -v#5. 这条激活命令只对本次会话有效,重启会话后还是会变回原来的4.8.5版本,如下操作可以直接替换旧的gcc旧的gcc是运行的 /usr/bin/gcc,所以将该目录下的gcc/g++替换为刚安装的新版本gcc软连接,免得每次enable , 一般个人不建议直接替换mv /usr/bin/gcc /usr/bin/gcc-4.8.5ln -s /opt/rh/devtoolset-8/root/bin/gcc /usr/bin/gccmv /usr/bin/g++ /usr/bin/g++-4.8.5ln -s /opt/rh/devtoolset-8/root/bin/g++ /usr/bin/g++gcc --versiong++ --version

参考

GitHub - axboe/fio: Flexible I/O Tester fio - fio - Flexible IO Tester Best Open Source Mac Software Development Software CentOS 7升级gcc版本 - 姬无华 - 博客园 linux 磁盘IO测试工具:FIO 和dd工具测试_笑歌自若L的博客-CSDN博客_dd测试工具 dd 工具使用; SSD 顺序写性能测试; - xuyaowen - 博客园

原文链接:/cqdba/p/15965713.html

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。