首页 > 其他分享 >服务器io测试工具-fio --转发 https://blog.51cto.com/u_12993908/5275922

服务器io测试工具-fio --转发 https://blog.51cto.com/u_12993908/5275922

时间:2024-07-10 10:23:34浏览次数:11  
标签:https 5275922 IO 测试 dd th 测试工具 fio 0.0%

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 fio
Loaded plugins: ulninfo
Available Packages
Name : fio
Arch : x86_64
Version : 3.7
Release : 2.el7
Size : 467 k
Repo : centos-7-base
Summary : Multithreaded IO generation tool
URL : http://git.kernel.dk/?p=fio.git;a=summary
License : GPLv2
Description : 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.gz
cd fio-3.29
# 注意如果编译的时候出现gcc 版本过低,可参考问题升级gcc 后在编译。 或者安装fio-3.20的版本
./configure
make
make install

[root@s2ahumysqlpg01 fio-3.29]# fio -v
fio-3.29


2.输入输出参数
2.1Fio常用输入参数
filename=/dev/emcpowerb 支持文件系统或者裸设备,-filename=/dev/sda
direct=1 测试过程绕过机器自带的buffer,使测试结果更真实
rw=randwread 测试随机读的I/O
rw=randwrite 测试随机写的I/O
rw=randrw 测试随机混合写和读的I/O
rw=read 测试顺序读的I/O
rw=write 测试顺序写的I/O
rw=rw 测试顺序混合写和读的I/O
bs=4k 单次io的块文件大小为4k
bsrange=512-2048 同上,提定数据块的大小范围
size=5g 本次的测试文件大小为5g,以每次4k的io进行测试
numjobs=30 本次的测试线程为30
runtime=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的IO
bw 平均IO带宽
iops IOPS
runt 线程运行时间
slat 提交延迟 (stdev指标准差)
clat 完成延迟
lat 响应时间
bw 带宽
cpu 利用率
IO depths io队列
IO submit 单个IO提交要提交的IO数
IO complete 与上面的提交编号类似,但用于完成。
IO issued 发出的读/写请求的数量,以及其中有多少是短的。
IO latencies IO完延迟的分布
io 总共执行了多少size的IO
aggrb group总带宽
minb 最小平均带宽.
maxb 最大平均带宽.
mint group中线程的最短运行时间.
maxt group中线程的最长运行时间.
ios 所有group总共执行的IO数.
merge 总共发生的IO合并数.
ticks 我们保持磁盘繁忙的ticks数。
io_queue 花费在队列上的总共时间.
util 磁盘利用率

 


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_4k
sqe_100read_4k: (g=0): rw=read, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=psync, iodepth=1
fio-3.29
Starting 1 process
sqe_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 2022
read: IOPS=3317, BW=13.0MiB/s (13.6MB/s)(2332MiB/180001msec)
clat (usec): min=209, max=535634, avg=296.20, stdev=1443.62
lat (usec): min=210, max=535635, avg=297.13, stdev=1443.62
clat 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=359
iops : min= 8, max= 3858, avg=3321.16, stdev=639.79, samples=359
lat (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=14
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 rwts: total=597112,0,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : 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_4k
sqe_100write_4k: (g=0): rw=randwrite, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=psync, iodepth=1
...
fio-3.29
Starting 50 processes
sqe_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 2022
write: IOPS=1108, BW=4434KiB/s (4540kB/s)(781MiB/180331msec); 0 zone resets
clat (usec): min=311, max=5969.7k, avg=45097.62, stdev=236640.38
lat (usec): min=313, max=5969.7k, avg=45098.90, stdev=236640.39
clat 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=10555
iops : min= 50, max=25811, avg=1887.29, stdev=66.26, samples=10555
lat (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=220103, majf=0, minf=821
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 rwts: total=0,199884,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : 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.29
Starting 50 processes
randrw_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 2022
read: IOPS=1802, BW=7209KiB/s (7382kB/s)(1268MiB/180113msec)
clat (usec): min=225, max=3503.6k, avg=18238.79, stdev=55447.72
lat (usec): min=226, max=3503.6k, avg=18239.86, stdev=55447.72
clat 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=15326
iops : min= 50, max= 6272, avg=2094.52, stdev=26.64, samples=15326
write: IOPS=774, BW=3096KiB/s (3171kB/s)(545MiB/180113msec); 0 zone resets
clat (usec): min=251, max=3576.5k, avg=22074.38, stdev=134044.57
lat (usec): min=252, max=3576.5k, avg=22075.53, stdev=134044.60
clat 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=14762
iops : min= 50, max= 3343, avg=923.38, stdev=13.00, samples=14762
lat (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=1027
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 rwts: total=324593,139424,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : 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-180113msec
WRITE: 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 1
avg-cpu: %user %nice %system %iowait %steal %idle
0.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 %util
sda 13417.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=5000
5000+0 records in
5000+0 records out
40960000 bytes (41 MB) copied, 0.055353 s, 740 MB/s

real 0m0.288s
user 0m0.004s
sys 0m0.276s
[root@s2ahumysqlpg01 fio-3.29]# time dd if=/dev/zero of=/tmp/ddout bs=8k count=50000
50000+0 records in
50000+0 records out
409600000 bytes (410 MB) copied, 1.59508 s, 257 MB/s

real 0m1.604s
user 0m0.021s
sys 0m0.379s
[root@s2ahumysqlpg01 fio-3.29]# time dd if=/dev/zero of=/tmp/ddout bs=8k count=500000
500000+0 records in
500000+0 records out
4096000000 bytes (4.1 GB) copied, 40.5061 s, 101 MB/s

real 0m40.584s
user 0m0.279s
sys 0m4.036s

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

使用conv, iflag, oflag 三个变量可以配置dd 命令的复制模块式,读取模式和写入模式;
#CONV 选项有:
ascii 从 EBCDIC 到 ASCII
ebcdic 从 ASCII 到 EBCDIC
ibm 从 ASCII 到备用 EBCDIC
block 用空格填充换行符终止的记录到 cbs-size
unblock 用换行符替换 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/O
directory 除非目录失败
dsync 对数据使用同步 I/O
sync 同样,也适用于元数据
fullblock 累积输入的完整块(仅 iflag)
nonblock 使用非阻塞 I/O
noatime 不更新访问时间
nocache 丢弃缓存数据
noctty 不从文件中分配控制终端
nofollow 不遵循符号链接
count_bytes 将 'count=N' 视为字节数(仅限 iflag)
skip_bytes 将 'skip=N' 视为字节数(仅 iflag)
seek_bytes 将 'seek=N' 视为字节数(仅用于标记)

#如果要规避掉文件系统cache,直接读写,不使用buffer cache,需做这样的设置
iflag=direct,nonblock
oflag=direct,nonblock


5.2 dd纯读速度
[root@s2ahumysqlpg01 fio-3.29]# time dd if=/tmp/ddout of=/dev/null bs=4k count=5000
5000+0 records in
5000+0 records out
20480000 bytes (20 MB) copied, 0.180166 s, 114 MB/s

real 0m0.198s
user 0m0.000s
sys 0m0.033s
[root@s2ahumysqlpg01 fio-3.29]# time dd if=/tmp/ddout of=/dev/null bs=4k count=50000
50000+0 records in
50000+0 records out
204800000 bytes (205 MB) copied, 1.5581 s, 131 MB/s

real 0m1.560s
user 0m0.026s
sys 0m0.271s
[root@s2ahumysqlpg01 fio-3.29]# time dd if=/tmp/ddout of=/dev/null bs=4k count=500000
500000+0 records in
500000+0 records out
2048000000 bytes (2.0 GB) copied, 18.0358 s, 114 MB/s

real 0m18.038s
user 0m0.240s
sys 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="https://www.cnblogs.com/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 Linux
CPU x86_64
Big endian no
Compiler gcc
Cross compile no

Static build no

Your compiler doesn't support C11 atomics. gcc 4.9/clang 3.6 are the
minimum versions with it - perhaps your compiler is too old?
C11 atomics support not found
Configure failed, check config.log and/or the above output

# 升级gcc 版本到 5.2
## 1.安装centos-release-scl 工具
wget http://mirror.centos.org/centos/7/extras/x86_64/Packages/centos-release-scl-2-3.el7.centos.noarch.rpm
wget http://mirror.centos.org/centos/7/extras/x86_64/Packages/centos-release-scl-rh-2-3.el7.centos.noarch.rpm


[root@s2ahumysqlpg01 yum.repos.d]# rpm -ivh *.rpm
warning: centos-release-scl-2-3.el7.centos.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing... ################################# [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.5
ln -s /opt/rh/devtoolset-8/root/bin/gcc /usr/bin/gcc
mv /usr/bin/g++ /usr/bin/g++-4.8.5
ln -s /opt/rh/devtoolset-8/root/bin/g++ /usr/bin/g++
gcc --version
g++ --version

标签:https,5275922,IO,测试,dd,th,测试工具,fio,0.0%
From: https://www.cnblogs.com/zclzc/p/18293344

相关文章

  • HTTPS比HTTP安全吗?
    在当今数字化的时代,网络安全成为了人们日益关注的重要问题。当我们浏览网页时,经常会看到网址开头是“HTTP”或“HTTPS”,那么HTTPS比HTTP更安全吗?答案是肯定的。首先我们先要了解什么是HTTP和HTTPS。HTTP,即超文本传输协议,是互联网上应用最为广泛的一种网络协议。HTTPS是在H......
  • HTTP与HTTPS
    一、HTTP的概念HTTP是超文本传输协议,是一种应用层协议,是基于为浏览器/服务器间提供统一的信息交换格式而出现的,其发展历程为HTTP/1.0、HTTP/1.1、HTTP/2、HTTP/3。1.HTTP版本区别HTTP/1.0:HTTP/1.0为短连接,即客户端单次请求后就关闭TCP连接。这样效率显然是很低的HTTP/1.1:H......
  • Linux 性能基准测试工具及测试方法
    上线前,基准测试的重要性,这篇文章着重介绍一下「Linux性能基准测试工具及测试方法」还是老规矩,先请性能领域的大师布伦丹·格雷格(BrendanGregg)登场......
  • HTTP协议29 丨 我应该迁移到HTTPS吗?
    今天是“安全篇”的最后一讲,我们已经学完了HTTPS、TLS相关的大部分知识。不过,或许你心里还会有一些困惑:“HTTPS这么复杂,我是否应该迁移到HTTPS呢?它能带来哪些好处呢?具体又应该怎么实施迁移呢?”这些问题不单是你,也是其他很多人,还有当初的我的真实想法,所以今天我就来跟你......
  • HTTP协议28 丨 连接太慢该怎么办:HTTPS的优化
    你可能或多或少听别人说过,“HTTPS的连接很慢”。那么“慢”的原因是什么呢?通过前两讲的学习,你可以看到,HTTPS连接大致上可以划分为两个部分,第一个是建立连接时的非对称加密握手,第二个是握手后的对称加密报文传输。由于目前流行的AES、ChaCha20性能都很好,还有硬件优化,报文......
  • 9个用于测试自动化的最佳AI测试工具(2024)
    选择一款优质的基于生成式AI人工智能的测试工具能够确保测试过程的准确性和效率,从而加速整个软件测试周期。相反,设计不佳的测试工具可能无法发现错误,并可能存在安全问题。它们可能产生误报或漏报,误导开发与测试团队,导致潜在的软件故障。  1、testRigortestRigor是一个基......
  • Open-TeleVision:增强机器人学习的沉浸式遥开源操作系统 (https://robot-tv.github.io/
      每周跟踪AI热点新闻动向和震撼发展想要探索生成式人工智能的前沿进展吗?订阅我们的简报,深入解析最新的技术突破、实际应用案例和未来的趋势。与全球数同行一同,从行业内部的深度分析和实用指南中受益。不要错过这个机会,成为AI领域的领跑者。点击订阅,与未来同行!订阅:https://......
  • 域名、备案和HTTPS
    12.域名、备案和HTTPS有了域名后,可以方便其他人记住并访问,历史上不乏大企业花大价钱购买域名的:京东域名换成JD.com,并且说是为了防止百度吸引流量,为什么?唯品会买下域名VIP.COM或花费千万‍域名提供商如果想要域名,得去找一些域名注册商去购买,目前基本各大云服务器厂商都......
  • nginx+tomcat+二级域名+https
    1.添加域名解析在腾讯云或者阿里云中添加域名解析,解析到具体得ip​​2.购买SSL证书在腾讯云或者阿里云中购买相应的SSL,基本上每个SSL只能解析一个HTTPS,所以如果你有多个二级域名设置HTTPS的话,需要申请多个SSL3.安装多个tomcat3.1下载tomcat安装包放入服务器中从网上下载t......
  • 政务服务网用哪种HTTPS证书
    政务服务网作为连接政府与民众的重要桥梁,承载着提供高效、安全、透明的在线服务的重任。在众多HTTPS证书类型中,政务服务网应当如何选择最合适的证书?一、证书类型推荐OV(组织验证)SSL证书:特点:OVSSL证书需要验证申请证书组织的真实身份,包括组织名称、地址、电话号码等信息。......