Operating System - HP-UX
1833271 Members
3365 Online
110051 Solutions
New Discussion

Tracking disk IO by PID or user

 
SOLVED
Go to solution
Steven Sauve
New Member

Tracking disk IO by PID or user

Having used sar to track disk IO, I'm now trying to find out who/what processes are causing it. I know that glance has a real time "most active process" line, but I'm looking for something I can dump into a file so I can play with it a bit. Does anyone know of a command that will give me IO by process or even the top ~10 processes (IO wise)?
Thanks
Steve
3 REPLIES 3
Anthony Goonetilleke
Esteemed Contributor

Re: Tracking disk IO by PID or user

It can be a bit messy but you can start of by doing something like this

fuser /dev/vg00/lvol1

this gives you all the pid's on that lv you can use this to check the IO utilisation of each proccess and then use perl or something to do a bit of math..
Minimum effort maximum output!
Andy Monks
Honored Contributor

Re: Tracking disk IO by PID or user

Measureware can do that. It's runs all the time (uses the midaemon glance uses) and captures the data for later analyses.

It's a purchasable product however.

The only other way, is to write your own code using pstat() calls.
Jim Welch
Respected Contributor
Solution

Re: Tracking disk IO by PID or user

If you want to use glance, you could use it in adviser mode. For example, create a file /tmp/proc.adviser containing:
PhysIoThreshold=0
FirstTime=FirstTime
if FirstTime == 0 then
{
print " "
FirstTime=1
print " Phys"
print " Proc Proc IO"
print " Date Time Interval Name ID Rate"
print "------------------------------------------------------------"
}
process loop
{
if (PROC_DISK_PHYS_IO_RATE > PhysIoThreshold) then
{
print GBL_STATDATE," ",GBL_STATTIME," ",GBL_INTERVAL," ", PROC_PROC_NAME," ", PROC_PROC_ID," ",PROC_DISK_PHYS_IO_RATE
}
}

(note that last print statement is all one long line)
Then run glance like:
/opt/perf/bin/glance -adviser_only -syntax /tmp/proc.adviser -j 30 -iterations 10 > /tmp/proc.out

If your glance thresholds are set correctly, you should see something like the following in the proc.out file:


Phys
Proc Proc IO
Date Time Interval Name ID Rate
------------------------------------------------------------
06/13/00 21:02:35 5.0 glance 8159 0.2
06/13/00 21:02:50 5.0 vx_iflush_thread 28 0.2
06/13/00 21:02:50 5.0 glance 8159 0.2
06/13/00 21:02:55 5.0 vx_delxwri_threa 31 0.2
06/13/00 21:02:55 5.0 rpcd 833 0.2
06/13/00 21:02:55 5.0 vi 7948 1.0

(my system is pretty idle and I used a shorter interval and a 0 threshold so I could get some data).

You can set the threshold variable to cut down on the data if you like and you can
add more PROC_DISK_* metrics to the print statement depending on what you are trying to capture... see the /opt/perf/paperdocs/gp/C/metrics.pdf file for metric info and the adviser.pdf file for info on using adviser mode. Also note that the first interval is usually a short one while glance is initializing. I usually ignore the first interval and wait for one with something closer to the requested interval.
Any sufficiently advanced technology is indistinguishable from Magic - Arthur C. Clarke