mon: Do not truncate per-OSD iops before summing them #224
Reference in New Issue
Block a user
No description provided.
Delete Branch "koolkhel/vitastor:mon-iops-precision"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
When an image's I/O is spread over many OSDs and each OSD serves less than 1 op/s of it,
vitastor-cli ls -l,vitastor-cli df -landvitastor-cli statusshow 0 iops and 0 latency for it. Under more load they show too little, losing up to 1 op/s per OSD. For example, one image read at 40 op/s over 48 OSDs shows 11–17 iops; at 3 op/s it shows 0. Bytes per second are right.Cause:
derive_osd_stats()divides each OSD's op count by that OSD's report interval in BigInt integer arithmetic (mon/stats.js:20,29,38,55on master027ef85d).sum_op_stats()(mon/stats.js:76-108) andsum_inode_stats()(mon/stats.js:280-309) then add up the already truncated rates, and their latency average is weighted by them. An OSD reports everyetcd_stats_interval(30 s by default), so an OSD that served 29 ops of an image in that window adds 0. Summing rates rather than counters is right, because OSDs report at different moments, so the summing stays as it is.Fix: keep per-OSD iops in 1/1000 op/s and round each sum up once. The iops-weighted latency becomes right as well.
/statsand/inode/statskeep their format (integers).What changes for readers of these stats:
Overlap: #190 changes the counter parts of the same two functions,
sum_op_stats()andsum_inode_stats(); this PR changes only the rate parts. The two PRs do not depend on each other. Whichever is merged second needs a small rebase.Found: seen on a cluster, where an image's iops in
ls -lshowed 14–17 while fio read it at 40 op/s over 48 OSDs. The cause was found by reading the code and reproduced by feeding the same layout tosum_op_stats()andsum_inode_stats().Tested:
node mon/test-stats-iops.js(new; fails on master with0n == 39n),node mon/test-sticky-primaries.js.Contributor Name
Yury Luneff (MIND Software LLC, https://mindsw.io)
CLA