Context: I'm writing a script that calculates a service's I/O usage from atop history for the last 2 minutes (where atop's sampling is configured to be per 1 minute). I'm using the following command to generate the history file:
atop -P DSK,PRD -b [time] -e [time] -r > somefile_to_read_from
atop's parseable output option (
-P) and the labels
atop's manual page, it says this about
For every logical volume/multiple device/hard disk one line is shown. Subsequent fields: name, number of milliseconds spent for I/O, number of reads issued, number of sectors transferred for reads, number of writes issued, and number of sectors transferred for write.
PRD it says:
For every process one line is shown. Subsequent fields: PID, name (between brackets), state, obsoleted kernel patch installed ('n'), standard io statistics used ('y' or 'n'), number of reads on disk, cumulative number of sectors read, number of writes on disk, cumulative number of sectors written, cancelled number of written sectors, TGID (group number of related tasks/threads) and is_process (y/n).
I assumed they would be the same thing. However, I almost always get values way above 100% for the I/O usage (for example when running
ab for apache). I thought that it would be a problem coming from my programming logic and algorithm, however, I banged my head in the wall for hours and couldn't think of a mistake I might've done, tried a lot of different ways to calculate it, still getting the same results.
So then I opened and started reading the history file I generated line by line after filtering it to show me only the process that I've monitored to have such I/O usage (apache in this case, since I ran benchmarks on it). And I noticed something, that was the fact, that
DSK's numbers of writes issued was way lower than the sum of all the apache's
PRD lines' number of writes on disk.
I'm not sure if I've understood something wrong or what am I doing wrong. The history file is too large to show, however, I can upload it to something like pastebin if needed.
My questions is, what does
DSK's numbers of writes/reads issued refer to, isn't it the same as
PRD's number of reads/writes on disk? And if not, what would be a way to calculate the I/O usage for a single process by using atop's history?