Loading... <p>LINUX时经常会遇到系统IO占用很高,系统IO占用可以使用iostat -x 1查看 <br />但很多时候知道磁盘IO负载高,但并不知道是什么程序占用的,是PHP,还是MYSQL,还是其它的,这就不好查看了。iotop工具可以实现 <br />以ubuntu为例: <br />安装 <br />root@ubuntu:~# apt-get install iotop <br />安装完成后 <br />执行iotop <br />就可以看到类似top一样的显示 <br /><img src="http://www.yunvm.com/blog/usr/uploads/2013/04/%E6%9C%AA%E5%91%BD%E5%90%8D.jpg" /> <br />iotop 详细参数:</p> <p>root@ubuntu:~# iotop -h <br />unable to set locale, falling back to the default locale <br />Usage: /usr/bin/iotop [OPTIONS]</p> <p>DISK READ and DISK WRITE are the block I/O bandwidth used during the sampling <br />period. SWAPIN and IO are the percentages of time the thread spent respectively <br />while swapping in and waiting on I/O more generally. PRIO is the I/O priority at <br />which the thread is running (set using the ionice command).</p> <p>Controls: left and right arrows to change the sorting column, r to invert the <br />sorting order, o to toggle the –only option, p to toggle the –processes <br />option, a to toggle the –accumulated option, q to quit, any other key to force <br />a refresh.</p> <p>Options: <br />–version show program’s version number and exit <br />-h, –help show this help message and exit <br />-o, –only only show processes or threads actually doing I/O <br />-b, –batch non-interactive mode <br />-n NUM, –iter=NUM number of iterations before ending [infinite] <br />-d SEC, –delay=SEC delay between iterations [1 second] <br />-p PID, –pid=PID processes/threads to monitor [all] <br />-u USER, –user=USER users to monitor [all] <br />-P, –processes only show processes, not all threads <br />-a, –accumulated show accumulated I/O instead of bandwidth <br />-k, –kilobytes use kilobytes instead of a human friendly unit <br />-t, –time add a timestamp on each line (implies –batch) <br />-q, –quiet suppress some lines of header (implies –batch)</p> <p>-p 指定进程ID,显示该进程的IO情况 <br />-u 指定用户名,显示该用户所有的进程IO情况</p> Last modification:October 6, 2023 © Allow specification reprint Support Appreciate the author AliPayWeChat Like 如果觉得我的文章对你有用,请随意赞赏