Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

iostat busy value calculation

16 views
Skip to first unread message

Miroslav Lachman

unread,
Jun 20, 2018, 11:10:33 AM6/20/18
to
I would like to know how the value of disk "busy" is calculated?

I want to use values from iostat in the monitoring (zabbix).
iostat shows averages by default and the last column is "busy %", but
the first output contains averages from the system boot til now.

# iostat -x -t da
extended device statistics
device r/s w/s kr/s kw/s qlen svc_t %b
ada0 2.5 13.8 49.0 287.9 0 45.7 2
ada1 2.6 13.8 51.7 287.9 0 39.6 2

I don't want to use "iostat -x -t da -w 20" to get averages of the last
20 seconds because it means monitoring needs to wait 20 seconds on each run.

I can use absolute values from iostat. This output is without any delay
and the monitoring SW can calculate averages between two runs. But the
last column is no busy %, it is sb/i.

# iostat -I -x -t da
extended device statistics
device r/i w/i kr/i kw/i qlen
tsvc_t/i sb/i
ada0 7403218.0 40825749.0 144647824.0 849655694.0 0
2204904.2 73121.8
ada1 7537423.0 40825749.0 152643874.5 849655694.0 0
1914301.0 69996.5

So the question is - If I want to plot "busy %" in the graph - how the
"busy" value in the first example is calculated?
Is it possible to calculate it from the numbers that I have from "iostat
-I -x" and the know time interval between two runs?

Miroslav Lachman
_______________________________________________
freebsd...@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stabl...@freebsd.org"

Holger Kipp

unread,
Jun 20, 2018, 11:41:41 AM6/20/18
to
Dear Miroslav,

looking at the manpage for iostat I see:

%b % of time the device had one or more outstanding transactions
tsvc_t/i
total duration of transactions per time period, in seconds
sb/i total time the device had one or more outstanding transac-
tions per time period, in seconds

So calculating the percentage using sb/i should be fairly easy.

Best regards,
Holger

Warner Losh

unread,
Jun 20, 2018, 12:17:56 PM6/20/18
to
On Wed, Jun 20, 2018 at 8:55 AM, Miroslav Lachman <000....@quip.cz> wrote:

> I would like to know how the value of disk "busy" is calculated?
>
> I want to use values from iostat in the monitoring (zabbix).
> iostat shows averages by default and the last column is "busy %", but the
> first output contains averages from the system boot til now.
>

%busy comes from the devstat layer. It's defined as the percent of the time
over the polling interval in which at least one transaction was awaiting
completion by the lower layers. It's an imperfect measure of how busy the
drives are (in ye-olden days, before tagged queuing and NCQ, it was OK
because you had THE transaction pending and it was a good measure of how
utilized things were. Now with concurrent I/O in flash devices, it's only
an imperfect approximation).

Warner

Miroslav Lachman

unread,
Jun 20, 2018, 1:39:43 PM6/20/18
to
Holger Kipp wrote on 2018/06/20 17:37:
> Dear Miroslav,
>
> looking at the manpage for iostat I see:
>
> %b % of time the device had one or more outstanding transactions
> tsvc_t/i
> total duration of transactions per time period, in seconds
> sb/i total time the device had one or more outstanding transac-
> tions per time period, in seconds
>
> So calculating the percentage using sb/i should be fairly easy.

If I understand it correctly, then it cannot be calculated from numbers
between two independent runs of "iostat -I -x" because it gives me sb/i
average from the boot time, so the calculated %b will be overall average
instead of average between two runs after 60 seconds.
The only possible way to calculated is to run "iostat -I -x -c 2 -w 60"
where the sb/i value of the second line will be average of these last 60
seconds. But it also means monitoring probe will wait 60 seconds to get
this value (each time) so it is the same problem as I described in my
original post with "iostat -x".

Miroslav Lachman


> Am 20.06.2018 um 16:55 schrieb Miroslav Lachman <000....@quip.cz<mailto:000....@quip.cz>>:
>
> I would like to know how the value of disk "busy" is calculated?
>
> I want to use values from iostat in the monitoring (zabbix).
> iostat shows averages by default and the last column is "busy %", but the first output contains averages from the system boot til now.
>
> # iostat -x -t da
> extended device statistics
> device r/s w/s kr/s kw/s qlen svc_t %b
> ada0 2.5 13.8 49.0 287.9 0 45.7 2
> ada1 2.6 13.8 51.7 287.9 0 39.6 2
>
> I don't want to use "iostat -x -t da -w 20" to get averages of the last 20 seconds because it means monitoring needs to wait 20 seconds on each run.
>
> I can use absolute values from iostat. This output is without any delay and the monitoring SW can calculate averages between two runs. But the last column is no busy %, it is sb/i.
>
> # iostat -I -x -t da
> extended device statistics
> device r/i w/i kr/i kw/i qlen tsvc_t/i sb/i
> ada0 7403218.0 40825749.0 144647824.0 849655694.0 0 2204904.2 73121.8
> ada1 7537423.0 40825749.0 152643874.5 849655694.0 0 1914301.0 69996.5
>
> So the question is - If I want to plot "busy %" in the graph - how the "busy" value in the first example is calculated?
> Is it possible to calculate it from the numbers that I have from "iostat -I -x" and the know time interval between two runs?


Miroslav Lachman

unread,
Jun 20, 2018, 1:44:22 PM6/20/18
to
Warner Losh wrote on 2018/06/20 18:13:
>
>
> On Wed, Jun 20, 2018 at 8:55 AM, Miroslav Lachman <000....@quip.cz
> <mailto:000....@quip.cz>> wrote:
>
> I would like to know how the value of disk "busy" is calculated?
>
> I want to use values from iostat in the monitoring (zabbix).
> iostat shows averages by default and the last column is "busy %",
> but the first output contains averages from the system boot til now.
>
>
> %busy comes from the devstat layer. It's defined as the percent of the
> time over the polling interval in which at least one transaction was
> awaiting completion by the lower layers. It's an imperfect measure of
> how busy the drives are (in ye-olden days, before tagged queuing and
> NCQ, it was OK because you had THE transaction pending and it was a good
> measure of how utilized things were. Now with concurrent I/O in flash
> devices, it's only an imperfect approximation).

Yes, I am aware of this issue. This percentage is just "is it slightly
loaded or heavily loaded" indicator.

Miroslav Lachman

Holger Kipp

unread,
Jun 21, 2018, 5:37:07 AM6/21/18
to
Dear Miroslav,

> Am 20.06.2018 um 19:35 schrieb Miroslav Lachman <000....@quip.cz>:
>
> Holger Kipp wrote on 2018/06/20 17:37:
>> Dear Miroslav,
>> looking at the manpage for iostat I see:
>> %b % of time the device had one or more outstanding transactions
>> tsvc_t/i
>> total duration of transactions per time period, in seconds
>> sb/i total time the device had one or more outstanding transac-
>> tions per time period, in seconds
>> So calculating the percentage using sb/i should be fairly easy.
>
> If I understand it correctly, then it cannot be calculated from numbers between two independent runs of "iostat -I -x" because it gives me sb/i average from the boot time, so the calculated %b will be overall average instead of average between two runs after 60 seconds.
> The only possible way to calculated is to run "iostat -I -x -c 2 -w 60" where the sb/i value of the second line will be average of these last 60 seconds. But it also means monitoring probe will wait 60 seconds to get this value (each time) so it is the same problem as I described in my original post with "iostat -x“


I haven’t thoroughly checked this myself (only a quick check), but with -I you should get the total values since boot. The man-page for OpenBSD states "The -I option causes iostat to print raw, unaveraged values.“

Eg. you have about 70.000 seconds where the devices ada0 and ada1 were busy, which equals 2%, so your system has an uptime of about 42 days.

Maybe you just check by getting values every 10 seconds, looking at sb/i and calculate the difference of two consecutive values, divide by the time period in seconds, multiply by 100 and have a percentage - with the downside of not being that accurate (as Warner Losh pointed out).

Best regards,
Holger

Slawa Olhovchenkov

unread,
Jun 22, 2018, 11:42:31 AM6/22/18
to
On Wed, Jun 20, 2018 at 07:37:20PM +0200, Miroslav Lachman wrote:

> > %busy comes from the devstat layer. It's defined as the percent of the
> > time over the polling interval in which at least one transaction was
> > awaiting completion by the lower layers. It's an imperfect measure of
> > how busy the drives are (in ye-olden days, before tagged queuing and
> > NCQ, it was OK because you had THE transaction pending and it was a good
> > measure of how utilized things were. Now with concurrent I/O in flash
> > devices, it's only an imperfect approximation).
>
> Yes, I am aware of this issue. This percentage is just "is it slightly
> loaded or heavily loaded" indicator.

for "heavily loaded" use average transaction time and average queue
length
0 new messages