显示短时间内访问量最大的文件


8

因此,我的服务器在几次安装Wordpress的压力下都在挣扎。事物的缓存相对较好(无论如何我都打算进行改进),但是我可以很快看到磁盘IO很高。

我曾经iotop看到磁盘上主要是PHP鸣喇叭,但是我真的很想知道哪个文件。我认为,如果我知道这一点,我也许能够发现其他问题或发现可能扩大的瓶颈(将内容移至ram磁盘等)。

因此,我正在寻找一条命令,该命令将给我打开文件的列表,该文件按自命令开始以来的时间IO排名。或在设定的时间段(例如60秒)内起作用的内容。

注意:我在寻找的不仅仅是lsof-我需要按总IO吞吐量对输出进行排名。

Answers:


9

尝试inotifywatch

从手册页:

% inotifywatch -v -e access -e modify -t 60 -r ~/.beagle
Establishing watches...
Setting up watch(es) on /home/rohan/.beagle
OK, /home/rohan/.beagle is now being watched.
Total of 302 watches.
Finished establishing watches, now collecting statistics.
Will listen for events for 60 seconds.
total  access  modify  filename
1436   1074    362     /home/rohan/.beagle/Indexes/FileSystemIndex/PrimaryIndex/
1323   1053    270     /home/rohan/.beagle/Indexes/FileSystemIndex/SecondaryIndex/
303    116     187     /home/rohan/.beagle/Indexes/KMailIndex/PrimaryIndex/
261    74      187     /home/rohan/.beagle/TextCache/
206    0       206     /home/rohan/.beagle/Log/
42     0       42      /home/rohan/.beagle/Indexes/FileSystemIndex/Locks/
18     6       12      /home/rohan/.beagle/Indexes/FileSystemIndex/
12     0       12      /home/rohan/.beagle/Indexes/KMailIndex/Locks/
3      0       3       /home/rohan/.beagle/TextCache/54/
3      0       3       /home/rohan/.beagle/TextCache/bc/
3      0       3       /home/rohan/.beagle/TextCache/20/
3      0       3       /home/rohan/.beagle/TextCache/62/
2      2       0       /home/rohan/.beagle/Indexes/KMailIndex/SecondaryIndex/

1
我是个白痴-提出问题的第二天,我对这个问题的回答非常相似:)谢谢!欢迎来到Ask Ubuntu。
奥利(Oli)
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.