可以监控指定进程的文件IO操作:pt-ioprofile
y37f
10年前
pt-ioprofile,可以监控指定进程的文件IO操作,统计出读写文件的次数、大小和耗时。当使用iotop发现某进程有超出预期的大量IO操作,可以用这个脚本定位具体访问的文件。
Usage
pt-ioprofile [OPTIONS] [FILE]
pt-ioprofile does two things: 1) get lsof+strace for -s seconds, 2) aggregate the result. If you specify a FILE, then step 1) is not performed.
</div>RISKS
WARNING: pt-ioprofile freezes the server and may crash the process, or make it perform badly after detaching, or leave it in a sleeping state! Before using this tool, please:
- Read the tool’s documentation
- Review the tool’s known “BUGS”
- Test the tool on a non-production server
- Backup your production server and verify the backups
pt-ioprofile should be considered an intrusive tool, and should not be used on production servers unless you understand and accept the risks.</blockquote> </div>DESCRIPTION
pt-ioprofile usesstraceandlsofto watch a process’s IO and print out a table of files and I/O activity. By default, it watches the mysqld process for 30 seconds. The output is like:
</div>Tue Dec 27 15:33:57 PST 2011 Tracing process ID 1833 total read write lseek ftruncate filename 0.000150 0.000029 0.000068 0.000038 0.000015 /tmp/ibBE5opS