可以監控指定進程的文件IO操作:pt-ioprofile

y37f 9年前發布 | 30K 次閱讀 系統監控 pt-ioprofile

pt-ioprofile,可以監控指定進程的文件IO操作,統計出讀寫文件的次數、大小和耗時。當使用iotop發現某進程有超出預期的大量IO操作,可以用這個腳本定位具體訪問的文件。

Usage

pt-ioprofile [OPTIONS] [FILE] 
</div>

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.

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.

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:

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

項目主頁:http://www.baiduhome.net/lib/view/home/1426412292646

 本文由用戶 y37f 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!