<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:06:50 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[SERVER-4740] Use monotonic clock sources for Timer</title>
                <link>https://jira.mongodb.org/browse/SERVER-4740</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Mongo currently uses gettimeofday() for all posix interval metrics.  As this function is not monotonic, we may see anomalies under certain conditions; e.g. VMM live migration, some SMP process migrations, system sleep/suspend/hibernate, NTP or system date changes, TSC-related kernel or VMM bugs, etc.&lt;/p&gt;

&lt;p&gt;The FineClock class (src/mongo/db/stats/fine_clock.h) implements a monotonic clock source, however the code is currently Linux specific and unused.  The goal here would be to make this class fully functional on all platforms and ensure performance is &amp;gt;= gettimeofday().  It may also be worth migrating the win32 code from boost::xtime to &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/windows/desktop/ms644904(v=vs.85).aspx&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;QueryPerformanceCounter()&lt;/a&gt; or similar as boost::xtime has been deprecated.&lt;/p&gt;</description>
                <environment></environment>
        <key id="28815">SERVER-4740</key>
            <summary>Use monotonic clock sources for Timer</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="9">Done</resolution>
                                        <assignee username="backlog-server-servicearch">Backlog - Service Architecture</assignee>
                                    <reporter username="benjamin.becker">Ben Becker</reporter>
                        <labels>
                            <label>PM-733</label>
                            <label>performance</label>
                            <label>profiling</label>
                            <label>stats</label>
                    </labels>
                <created>Sun, 22 Jan 2012 05:06:02 +0000</created>
                <updated>Tue, 6 Dec 2022 05:37:37 +0000</updated>
                            <resolved>Wed, 18 Dec 2019 15:21:45 +0000</resolved>
                                                                    <component>Performance</component>
                                        <votes>8</votes>
                                    <watches>17</watches>
                                                                                                                <comments>
                            <comment id="2643475" author="schwerin" created="Wed, 18 Dec 2019 15:21:45 +0000"  >&lt;p&gt;The types and implementations referred to in this ticket are now gone.&lt;/p&gt;</comment>
                            <comment id="1375535" author="mansuro" created="Fri, 2 Sep 2016 13:15:06 +0000"  >&lt;p&gt;What is the status of this issue?&lt;/p&gt;</comment>
                            <comment id="918238" author="eitan.klein" created="Tue, 19 May 2015 18:28:52 +0000"  >&lt;p&gt;OK, I will create a new one for the windows issue &lt;/p&gt;</comment>
                            <comment id="917945" author="eitan.klein" created="Tue, 19 May 2015 14:52:49 +0000"  >&lt;p&gt;YCSB load phase push the 16 CORE to 100% CPU due to the high resolution timer in windows, See the profiler output in the attached bitmap&lt;/p&gt;</comment>
                            <comment id="598890" author="xgen-internal-githook" created="Tue, 27 May 2014 23:14:15 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;RedBeard0531&apos;, u&apos;name&apos;: u&apos;Mathias Stearn&apos;, u&apos;email&apos;: u&apos;mathias@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-4740&quot; title=&quot;Use monotonic clock sources for Timer&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-4740&quot;&gt;&lt;del&gt;SERVER-4740&lt;/del&gt;&lt;/a&gt; Don&apos;t use unsigned for time deltas&lt;/p&gt;

&lt;p&gt;Leads to weird bugs when time goes backwards.&lt;/p&gt;

&lt;p&gt;This commit doesn&apos;t resolve &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-4740&quot; title=&quot;Use monotonic clock sources for Timer&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-4740&quot;&gt;&lt;del&gt;SERVER-4740&lt;/del&gt;&lt;/a&gt; (Use monotonic clock sources for&lt;br/&gt;
Timer) but lessens the impact of using a non-monotonic clock.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/00b9a481e421ee720a6b4274012dc14e244aa5e2&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/00b9a481e421ee720a6b4274012dc14e244aa5e2&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="598889" author="xgen-internal-githook" created="Tue, 27 May 2014 23:14:13 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;RedBeard0531&apos;, u&apos;name&apos;: u&apos;Mathias Stearn&apos;, u&apos;email&apos;: u&apos;mathias@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-4740&quot; title=&quot;Use monotonic clock sources for Timer&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-4740&quot;&gt;&lt;del&gt;SERVER-4740&lt;/del&gt;&lt;/a&gt; Don&apos;t use unsigned for time deltas&lt;/p&gt;

&lt;p&gt;Leads to weird bugs when time goes backwards.&lt;/p&gt;

&lt;p&gt;This commit doesn&apos;t resolve &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-4740&quot; title=&quot;Use monotonic clock sources for Timer&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-4740&quot;&gt;&lt;del&gt;SERVER-4740&lt;/del&gt;&lt;/a&gt; (Use monotonic clock sources for&lt;br/&gt;
Timer) but lessens the impact of using a non-monotonic clock.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/00b9a481e421ee720a6b4274012dc14e244aa5e2&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/00b9a481e421ee720a6b4274012dc14e244aa5e2&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="81860" author="benjamin.becker" created="Tue, 24 Jan 2012 01:16:57 +0000"  >&lt;h3&gt;&lt;a name=&quot;Afewgeneralcomments%3A&quot;&gt;&lt;/a&gt;A few general comments:&lt;/h3&gt;
&lt;p&gt;The core issue with functions like gettimeofday() and boost::xtime() is that timing information can be obtained from multiple sources (generally HPET, TSC, PIT, RTC or ACPI/PM), and these sources are not standardized.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;PM Timer&lt;/b&gt; is likely the most accurate source for measuring time intervals.  Most hypervisors guarantee monotonically increasing values from the PM timer within a guest&apos;s vcpu.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;TSC&lt;/b&gt; is a monotonically increasing counter tied to a single physical core.  While generally fast and reliable on uniprocessor systems, it is not synchronized across cores and is especially problematic with multiprocessor speed-scaling chips.  These issues can easily be seen by running a thread that repeatedly prints the results of the RDTSC instruction and watching the results as the thread is migrated across cores (or simply print the results from multiple threads).  Details of TSC-based profiling are available in the &apos;Intel 64 and IA-32 Architectures Software Developer&apos;s Manual&apos;, Volume 3, Chapter 17.12. &lt;/p&gt;

&lt;p&gt;&lt;b&gt;HPET&lt;/b&gt; is a newer hardware timer that replaced the PIT around 2005.  It has a very slow setup time and thus is generally only used for firing short-interval interrupts (e.g. multimedia timers).&lt;/p&gt;

&lt;p&gt;&lt;b&gt;RTC&lt;/b&gt; The real time clock is used for wall-clock measurements and is subject to drifting and skewing (e.g. NTP sync, VMM sync, etc).&lt;/p&gt;

&lt;h3&gt;&lt;a name=&quot;Toelaboratemoreonsomeplatformspecificissues%3A&quot;&gt;&lt;/a&gt;To elaborate more on some platform specific issues:&lt;/h3&gt;

&lt;p&gt;&lt;b&gt;VMMs:&lt;/b&gt;&lt;br/&gt;
Virtual Machine Managers (hypervisors) like Xen, KVM, Hyper-V, VirtualBox or EC2 generally provide multiple time sources, but the implementations vary.  For example, Hyper-V implementes &apos;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/windows/hardware/ff542537(v=vs.85).aspx&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;partition reference time enlightenment&lt;/a&gt;&apos; which emulates the TSC, thus providing reliable TSC counts while the underlying hardware may not.  Xen also provides a similar mechanism.  KVM&apos;s kvmclock() is the main source for time data, however there have been many bugs over the past few years, primarily related to TSC values.  There have also been several &lt;a href=&quot;https://bugs.launchpad.net/ubuntu/+source/linux/+bug/727459&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;timing-related bugs&lt;/a&gt; in Linux guest VM kernels running under EC2 (and Xen).&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Win32:&lt;/b&gt;&lt;br/&gt;
Older versions of windows (&amp;lt;= win2k3/winxp) may require the /USEPMTIMER boot.ini parameter to ensure QueryPerformanceCounter() returns reliable results (See: &lt;a href=&quot;http://support.microsoft.com/kb/895980&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://support.microsoft.com/kb/895980&lt;/a&gt;).  A comprehensive (but older) article on implementing an accurate high-precision timer on win32 is here: &lt;a href=&quot;http://msdn.microsoft.com/en-us/magazine/cc163996.aspx&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://msdn.microsoft.com/en-us/magazine/cc163996.aspx&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Linux:&lt;/b&gt;&lt;br/&gt;
Most linux distributions come with librt, the POSIX advanced real time library.  This lib implements &lt;/p&gt;
{clock_gettime()}
&lt;p&gt; which is likely to be the most accurate method of collecting monotonic timing data.  It uses vsyscalls which are faster than normal syscalls on native (and HVM?) systems, however Xen&apos;s pvclock does not appear to support this feature as a vsyscall (and may actually incur a VMEXIT).  See &lt;a href=&quot;http://xen.1045712.n5.nabble.com/pvclock-PV-and-HVM-and-vsyscall-td3213970.html&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://xen.1045712.n5.nabble.com/pvclock-PV-and-HVM-and-vsyscall-td3213970.html&lt;/a&gt; and &lt;a href=&quot;http://lwn.net/Articles/388188/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://lwn.net/Articles/388188/&lt;/a&gt; for more details.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;BSD:&lt;/b&gt;  Most BSD platforms also seem to support librt.  Needs testing.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Solaris:&lt;/b&gt; Recent releases (&amp;gt;=2.6) appear to support librt, however clock_gettime() was originally in a library called libposix4.  Needs further investigation and testing.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;OS X/Darwin:&lt;/b&gt;  Mac OS X does not support librt, however there are some time-related functions in LibSystem that may work.  Needs further investigation and testing.&lt;/p&gt;
</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="44149">SERVER-6444</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="45025">SERVER-6550</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="15426">SERVER-2886</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="87011">SERVER-10603</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="30310">SERVER-4924</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="44212">SERVER-6452</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="177446">SERVER-16763</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="205231">SERVER-18562</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="28568">SERVER-4709</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="156075">SERVER-15122</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="74868" name="YCSB-Load.png" size="146104" author="eitan.klein" created="Tue, 19 May 2015 14:52:49 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>7.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                <customfield id="customfield_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25132"><![CDATA[Service Arch]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Tue, 24 Jan 2012 01:02:56 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        4 years, 8 weeks ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></customfieldvalue>


                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>false</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>alexander.golin@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            4 years, 8 weeks ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Old_Backport</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10000"><![CDATA[No]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>Mansuro</customfieldvalue>
            <customfieldvalue>schwerin@mongodb.com</customfieldvalue>
            <customfieldvalue>backlog-server-servicearch</customfieldvalue>
            <customfieldvalue>benjamin.becker</customfieldvalue>
            <customfieldvalue>eitan.klein</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrog4f:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr9hrz:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>5984</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10053" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>Time In Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_22870" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Triagers</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hs2hgv:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                    </customfields>
    </item>
</channel>
</rss>