RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1286278 - dmstats: improve statistics interval estimation
Summary: dmstats: improve statistics interval estimation
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: lvm2
Version: 7.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Bryn M. Reeves
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On:
Blocks: 1385242
TreeView+ depends on / blocked
 
Reported: 2015-11-27 17:51 UTC by Bryn M. Reeves
Modified: 2021-09-03 12:40 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-06-11 16:28:07 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Bryn M. Reeves 2015-11-27 17:51:40 UTC
Description of problem:
Currently a single estimate of the sample interval duration (updated when the cycle timer expires) is used as an approximation for all monitored statistics regions.

This is reasonable when the time spent obtaining data is small compared to the overall interval but in the case of large numbers of regions this becomes increasingly inaccurate.

Since each dm ioctl call can now optionally obtain a timestamp this can be used to obtain a more accurate per-region estimate of the actual interval duration:

commit 559ca8bc6593a9ef0b0b012ff0933b80f5d3e367
Author: Alasdair G Kergon <agk>
Date:   Wed Aug 5 08:28:35 2015 +0100

    dmsetup: Report timestamps of ioctls with -vvv.
    
    If enabled, record timestamp immediately after the ioctl() returns.

Version-Release number of selected component (if applicable):
lvm2-2.02.127-*.el7.x86_64

How reproducible:
100%

Steps to Reproduce: ** requires debug build **
1. dmstats create --alldevices
2. dmstats report --count 3 -vvv 2>&1 | grep Interval

Actual results:
Using timerfd for interval timekeeping.
Setting interval timer to: 1s 0ns
Beginning first interval
Interval     #1        time delta:   1000000000ns
Interval     #1       current err:            0ns
End interval #1          duration:   1000000000ns
Adjusted sample interval duration:   1000000000ns
Interval     #1        time delta:       151923ns
Adjusted sample interval duration:   1000000000ns
Interval     #1        time delta:       275569ns
Adjusted sample interval duration:   1000000000ns
Interval     #1        time delta:       417345ns
Adjusted sample interval duration:   1000000000ns
Interval     #1        time delta:       561245ns
Adjusted sample interval duration:   1000000000ns
Interval     #1        time delta:       684515ns
Adjusted sample interval duration:   1000000000ns
Interval     #1        time delta:       799198ns
Adjusted sample interval duration:   1000000000ns
Interval     #2        time delta:    999890331ns
Interval     #2       current err:      -109669ns
End interval #2          duration:    999890331ns
Adjusted sample interval duration:    999890331ns
Adjusted sample interval duration:    999890331ns
Adjusted sample interval duration:    999890331ns
Adjusted sample interval duration:    999890331ns
Adjusted sample interval duration:    999890331ns
Adjusted sample interval duration:    999890331ns
Adjusted sample interval duration:    999890331ns


Expected results:
* "Adjusted sample interval duration" messages should show a unique interval per region.

* A message indicating e.g. "Using per-region sample interval estimates" will also be added when the new feature is in use.

Additional info:

Comment 7 Jonathan Earl Brassow 2017-07-27 20:21:45 UTC
Bryn, is this bug already taken care of?

commit 886b4f755d7f33194f92dafbf2c22517db4de374
Author: Bryn M. Reeves <bmr>
Date:   Sun Dec 18 12:39:26 2016 +0000

    dmstats: use better interval estimate for usleep() timer

    Although the usleep() interval timer is not used if the Linux
    TIMERFD interface is available it should still provide reasonably
    good timing.

    Instead of trying to estimate the error from the duration of the
    last sleep, peg it to the start time of the program, and use the
    value of  ((start_time - now) % interval) to correct the current
    interval duration.

    This always pulls us back into sync at the end of each interval,
    rather than relying on trying to incrementally adjust the time
    duration at each interval start.

    This greatly reduces drift when the usleep() clock is used.

Comment 8 Bryn M. Reeves 2017-07-28 16:45:05 UTC
Not entirely - the patch in comment #7 improves the estimate accuracy for systems that do not support the TIMERFD interface (both RHEL and Fedora have this support already: it gives better control of interval drift and more reliable interval estimates than the sleep timer).

Currently though, both TIMERFD and usleep() when used by dmsetup/dmstats maintain a single interval duration estimate for all regions. This is simple to implement, and reasonable for fairly small numbers of regions (into the 100s).

The next step, which this bug seeks to address, is to use an individual (per-region) estimate: this greatly improves accuracy when scaling to very large numbers of regions (since at this point the time spent in each region's populate ioctl becomes significant).

The downside is that there is considerable extra bookkeeping for per-region timestamps. The plan is to hide this inside the library so that programs monitoring a number of regions simultaneously can have the library fill out interval estimates automatically.

I'm hoping to get to this upstream in the next 3-4 months assuming other priorities don't change in the meantime.

Comment 13 Bob Handlin 2017-12-04 15:04:04 UTC
I'm adding a PM ack because this seems to be being handled with appropriate urgency.


Note You need to log in before you can comment on or make changes to this bug.