Tooltip - Inotify-tools
A nifty tool which might be handy when getting to know a system or tracking down I/O usage is inotify-tools . It’s a lightweight interface to the kernel’s inotify function. It gives a quick overview over which files are accessed and how in any given directory and it’s subdirectories (if asked to). It can quickly give an overview of efficiency of caching, frequency of commits, and all sorts of useful information for a whole range of applications.
Here’s some example output from the inotifywatch utility during a mysqlslap run:
1 2 3 4 5 6 7 8 9 |
|
Granted - as far as MySQL is concerned - most information is accessible through SHOW GLOBAL STATUS
and/or SHOW ENGINE INNODB STATUS
commands. But if you for instance have an erratic fear of the key_read_requests
variable, you could always look at how often your MYI files are accessed. You catch my drift..
If you’re only interested in certain file operations, you can apply filters. If you for instance only have interest in file writes, your run would look like this:
1 2 3 4 5 6 7 8 9 |
|
You can monitor pretty much any file operation, so this tool can be used in a whole range of scenarios. Ever wondered just how many temp files your application creates or? Are you sure it doesn’t open and close the file handle for each operation? Do you want to know which file on your website is the most popular download at the moment but can’t wait until the webstats crontab has ran? I could go on…
inotify-tools come with another utility inotifywait. This tool looks for activity on a specified file or directory and instantly tells you which operation was performed. Nothing amazing, but I can see a few areas of use for that as well, though most of them have tools for that purpose already.