zalando / pg_view

Get a detailed, real-time view of your PostgreSQL database and system metrics
https://pypi.python.org/pypi/pg-view
Other
496 stars 49 forks source link

Units for await? #28

Closed btostevepritchard closed 8 years ago

btostevepritchard commented 9 years ago

I'm watching the values that pg_view displays in the 'await' column, and I'm seeing numbers as high as "465146.3". If I run "iostat -dx 1" at the same time, I'm typically seeing 0 - 50ms in the 'await' column, max 500ms.

What units does pg_view display 'await' in? Is it micro-seconds? If so, why? Why not display in milli-seconds the same as iostat?

I looked in "README.md", however this doesn't mention 'await' at all.

Steve Pritchard

alexeyklyukin commented 9 years ago

If you trigger the measurement units ('u') it will show this is in milliseconds. The value itself is taken from /proc/diskstats, and is a last (#14) field from this file, and #11 if you don't count name fields.

Here's how it is described in the Documentation/iostats.txt for the Kernel:

Field 11 -- weighted # of milliseconds spent doing I/Os This field is incremented at each I/O start, I/O completion, I/O merge, or read of these stats by the number of I/Os in progress (field 9) times the number of milliseconds spent doing I/O since the last update of this field. This can provide an easy measure of both I/O completion time and the backlog that may be accumulating

So basically, it's multiplied by the number of request, so you might be seeing quite huge numbers. There are some ideas in the comments to the article http://www.xaprb.com/blog/2010/01/09/how-linux-iostat-computes-its-results/ on how to calculate await values similar to those from iostat, so perhaps we'll go this route one day.