Filesystem statistics APIs/counters ?
To be able to compare software performance in different systems, I would like to periodically collect filesystem counters to see how much activity there is, e.g. in case I am running several hundred parallel activity processes, each doing their things in the filesystem (I am essentially using the filesystem as a database.)
I would like to know at least:
- Disk writes (requests and blocks)
- Disk reads
- i-node updates
- Directory accesses, modifications
- File accesses for read, read/write, write
- Counts of direct IOs
- Locking requests (internal, and application)
I don't think those counters need to be absolute truth, that is, they can be mere volatile, not atomic_t things.
I think unsigned 32 bits should always be enough, if things wrap around so that once a minute RRD polling can't keep up, then I need to poll quicker...
Reading 2.5 sources, I see that XFS has some performance counters. Are they shared by all XFS filesystems in the box, or one for each mounted system, that is unclear.
The /proc/stat shows a bit of disk_io: data, but that is low-level stuff of partition access.
Solaris 8 with "sar -A 10" shows this header:
17:21:31 %usr %sys %wio %idle
device %busy avque r+w/s blks/s avwait avserv
runq-sz %runocc swpq-sz %swpocc
bread/s lread/s %rcache bwrit/s lwrit/s %wcache pread/s pwrit/s swpin/s bswin/s swpot/s bswot/s pswch/s
scall/s sread/s swrit/s fork/s exec/s rchar/s wchar/s
iget/s namei/s dirbk/s
rawch/s canch/s outch/s rcvin/s xmtin/s mdmin/s
proc-sz ov inod-sz ov file-sz ov lock-sz
msg/s sema/s
atch/s pgin/s ppgin/s pflt/s vflt/s slock/s pgout/s ppgout/s pgfree/s pgscan/s %ufs_ipf
freemem freeswap
sml_mem alloc fail lg_mem alloc fail ovsz_alloc fail
Still this is far from what I really would like to have access to. (Directory IOPs data, etc.)
How to implement the access to these things per mounted filesystem ?
- Thru some fcntl()/ioctl() on any file handle in the system ? (e.g. opendir() -> dirfd() of mountpoint ?)
- Thru some magically named /proc/ objects ? E.g:
/proc/mount/<some-instance-token>/mountpoint (as symlink ?) /proc/mount/<some-instance-token>/fs-stats
etc. ? (recalling that we already have /proc/mounts "file".)
Any thoughts ?
/Matti Aarnio
Quoted 24 lines · Matti Aarnio
To be able to compare software performance in different systems, I would like to periodically collect filesystem counters to see how much activity there is, e.g. in case I am running several hundred parallel activity processes, each doing their things in the filesystem (I am essentially using the filesystem as a database.)
I would like to know at least:
- Disk writes (requests and blocks)
- Disk reads
- i-node updates
- Directory accesses, modifications
- File accesses for read, read/write, write
- Counts of direct IOs
- Locking requests (internal, and application)I don't think those counters need to be absolute truth, that is, they can be mere volatile, not
atomic_tthings.I think unsigned 32 bits should always be enough, if things wrap around so that once a minute RRD polling can't keep up, then I need to poll quicker...
Quoted 4 lines
Reading 2.5 sources, I see that XFS has some performance counters. Are they shared by all XFS filesystems in the box, or one for each mounted system, that is unclear.
They are across all filesystems, not per filesystem. There is a script in our commands tree called xfsstats.pl for dumping them formatted, and the pcp toolset lets you look at them and a lot of other things:
http://oss.sgi.com/projects/pcp/
Doing it per fs gets a little more expensive.
Steve