MIO 配置示例
可在应用程序级配置 MIO。
操作系统配置
alot_buf 应用程序完成以下操作:- 写入一个 14 GB 的文件。
- 以 100 KB 的缓冲区进行 140000 次连续写操作。
- 以 100 KB 的缓冲区顺序读取该文件。
- 以 100 KB 的缓冲区后向顺序读取该文件。
# vmstat
System Configuration: lcpu=2 mem=512MB
kthr memory page faults cpu
----- ----------- ------------------------ ------------ -----------
r b avm fre re pi po fr sr cy in sy cs us sy id wa
1 1 35520 67055 0 0 0 0 0 0 241 64 80 0 0 99 0
# ulimit -a
time(seconds) unlimited
file(blocks) unlimited
data(kbytes) 131072
stack(kbytes) 32768
memory(kbytes) 32768
coredump(blocks) 2097151
nofiles(descriptors) 2000
# df -k /mio
Filesystem 1024-blocks Free %Used Iused %Iused Mounted on
/dev/fslv02 15728640 15715508 1% 231 1% /mio
# lslv fslv02
LOGICAL VOLUME: fslv02 VOLUME GROUP: mio_vg
LV IDENTIFIER: 000b998d00004c00000000f17e5f50dd.2 PERMISSION: read/write
VG STATE: active/complete LV STATE: opened/syncd
TYPE: jfs2 WRITE VERIFY: off
MAX LPs: 512 PP SIZE: 32 megabyte(s)
COPIES: 1 SCHED POLICY: parallel
LPs: 480 PPs: 480
STALE PPs: 0 BB POLICY: relocatable
INTER-POLICY: minimum RELOCATABLE: yes
INTRA-POLICY: middle UPPER BOUND: 32
MOUNT POINT: /mio LABEL: /mio
MIRROR WRITE CONSISTENCY: on/ACTIVE
EACH LP COPY ON A SEPARATE PV ?: yes
Serialize IO ?: NO 用来分析应用程序 /mio/alot_buf 的 MIO 配置
setenv MIO_DEBUG " OPEN MODULES TIMESTAMP"
setenv MIO_FILES "* [ trace/stats/kbytes ]"
setenv MIO_STATS mio_analyze.stats
time /mio/alot_buf注: 对于 debug 数据和 trace 模块数据,输出诊断文件为 mio_analyze.stats 。 所有值都是以千字节为单位。
注: time 命令指示 MIO 发布命令执行时间。
分析结果
- 执行时间为 28:06。
- MIO 分析诊断输出文件为 mio_analyse.stats。
MIO statistics file : Thu May 26 17:32:22 2005
hostname=miohost : with Legacy aio available
Program=/mio/alot_buf
MIO library libmio.a 3.0.0.60 AIX 64 bit addressing built Apr 19 2005 15:07:35
MIO_INSTALL_PATH=
MIO_STATS =mio_analyze.stats
MIO_DEBUG = MATCH OPEN MODULES TIMESTAMP
MIO_FILES =* [ trace/stats/kbytes ]
MIO_DEFAULTS =
MIO_DEBUG OPEN =T
MIO_DEBUG MODULES =T
MIO_DEBUG TIMESTAMP =T
17:32:22
Opening file test.dat
modules[18]=trace/stats/kbytes
trace/stats={mioout}/noevents/kbytes/nointer
aix/nodebug/trunc/sector_size=0/einprogress=60
============================================================================
18:00:28
Trace close : program <-> aix : test.dat : (42000000/1513.95)=27741.92 kbytes/s
demand rate=24912.42 kbytes/s=42000000/(1685.92-0.01))
current size=14000000 max_size=14000000
mode =0640 FileSystemType=JFS2 sector size=4096
oflags =0x302=RDWR CREAT TRUNC
open 1 0.01
write 140000 238.16 14000000 14000000 102400 102400
read 280000 1275.79 28000000 28000000 102400 102400
seek 140003 11.45 average seek delta=-307192
fcntl 2 0.00
close 1 0.00
size 140000
============================================================================注意:
- 140000 次写操作,每次 102400 字节。
- 280000 次读操作,每次 102400 字节。
- 速率为每秒 27741.92 千字节。
用来提高 I/O 性能的 MIO 配置
setenv MIO_FILES "* [ trace/stats/kbytes | pf/cache=100m/page=2m/pref=4/stats/direct | trace/stats/kbytes ]"
setenv MIO_DEBUG "OPEN MODULES TIMESTAMP"
setenv MIO_STATS mio_pf.stats
time /mio/alot_buf- 分析应用程序 I/O 的一个好方法是使用
trace | pf | trace模块列表。 通过该方法,您可以获得应用程序从 pf 高速缓存得到的性能,还能获得 pf 高速缓存从操作系统得到的性能。 - pf 全局高速缓存的大小为 100 MB。 每页 2 MB。 预取的页数为 4。 pf 高速缓存执行异步直接 I/O 系统调用。
- 对于 debug 数据, trace 模块数据和 pf 模块数据,输出诊断文件为 mio_pf.stats 。 所有值都以千字节为单位。
性能测试结果
- 执行时间为 15:41。
- MIO 分析诊断输出文件为 mio_pf.stats。
MIO statistics file : Thu May 26 17:10:12 2005
hostname=uriage : with Legacy aio available
Program=/mio/alot_buf
MIO library libmio.a 3.0.0.60 AIX 64 bit addressing built Apr 19 2005 15:07:35
MIO_INSTALL_PATH=
MIO_STATS =mio_fs.stats
MIO_DEBUG = MATCH OPEN MODULES TIMESTAMP
MIO_FILES =* [ trace/stats/kbytes | pf/cache=100m/page=2m/pref=4/stats/direct | trace/stats/kbytes ]
MIO_DEFAULTS =
MIO_DEBUG OPEN =T
MIO_DEBUG MODULES =T
MIO_DEBUG TIMESTAMP =T
17:10:12
Opening file test.dat
modules[79]=trace/stats/kbytes|pf/cache=100m/page=2m/pref=4/stats/direct|trace/stats/kbytes
trace/stats={mioout}/noevents/kbytes/nointer
pf/nopffw/release/global=0/asynchronous/direct/bytes/cache_size=100m/page_size=2m/prefetch=4/st
ride=1/stats={mioout}/nointer/noretain/nolistio/notag/noscratch/passthru={0:0}
trace/stats={mioout}/noevents/kbytes/nointer
aix/nodebug/trunc/sector_size=0/einprogress=60
============================================================================
17:25:53
Trace close : pf <-> aix : test.dat : (41897728/619.76)=67603.08 kbytes/s
demand rate=44527.71 kbytes/s=41897728/(940.95-0.01))
current size=14000000 max_size=14000000
mode =0640 FileSystemType=JFS2 sector size=4096
oflags =0x8000302=RDWR CREAT TRUNC DIRECT
open 1 0.01
ill form 0 mem misaligned 0
write 1 0.21 1920 1920 1966080 1966080
awrite 6835 0.20 13998080 13998080 2097152 2097152
suspend 6835 219.01 63855.82 kbytes/s
read 3 1.72 6144 6144 2097152 2097152
aread 13619 1.02 27891584 27891584 1966080 2097152
suspend 13619 397.59 69972.07 kbytes/s
seek 20458 0.00 average seek delta=-2097036
fcntl 5 0.00
fstat 2 0.00
close 1 0.00
size 6836
17:25:53
pf close for test.dat
50 pages of 2097152 bytes 4096 bytes per sector
6840/6840 pages not preread for write
7 unused prefetches out of 20459 : prefetch=4
6835 write behinds
bytes transferred / Number of requests
program --> 14336000000/140000 --> pf --> 14336000000/6836 --> aix
program <-- 28672000000/280000 <-- pf <-- 28567273472/13622 <-- aix
17:25:53
pf close for global cache 0
50 pages of 2097152 bytes 4096 bytes per sector
6840/6840 pages not preread for write
7 unused prefetches out of 20459 : prefetch=0
6835 write behinds
bytes transferred / Number of requests
program --> 14336000000/140000 --> pf --> 14336000000/6836 --> aix
program <-- 28672000000/280000 <-- pf <-- 28567273472/13622 <-- aix
17:25:53
Trace close : program <-> pf : test.dat : (42000000/772.63)=54359.71 kbytes/s
demand rate=44636.36 kbytes/s=42000000/(940.95-0.01))
current size=14000000 max_size=14000000
mode =0640 FileSystemType=JFS2 sector size=4096
oflags =0x302=RDWR CREAT TRUNC
open 1 0.01
write 140000 288.88 14000000 14000000 102400 102400
read 280000 483.75 28000000 28000000 102400 102400
seek 140003 13.17 average seek delta=-307192
fcntl 2 0.00
close 1 0.00
size 140000
============================================================================
注: 程序执行 102 400 字节的 140 000 次写入和 102 400 字节的 280 000 次读取,但 pf 模块执行 2 097 152 字节的 6 836 次写入 (其中 6 835 是异步写入) ,并执行 2 097 152 字节的 13 622 次读取 (其中 13 619 是异步读取)。 速率为每秒 54359.71 千字节。