<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:16:21 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-8024] getLastError &gt;90 ms delay over mongos</title>
                <link>https://jira.mongodb.org/browse/SERVER-8024</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;I&apos;am trying to deploy shard cluster for tests.&lt;br/&gt;
Using docs &lt;a href=&quot;http://docs.mongodb.org/manual/tutorial/deploy-shard-cluster/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://docs.mongodb.org/manual/tutorial/deploy-shard-cluster/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And every time when execute update there is strange delay 90+ ms.&lt;/p&gt;

&lt;p&gt;mongos.log:&lt;/p&gt;

&lt;p&gt;Sun Dec 23 23:41:06 &lt;span class=&quot;error&quot;&gt;&amp;#91;conn1&amp;#93;&lt;/span&gt; Request::process begin ns: test.$cmd msg id: 2 op: 2004 attempt: 0&lt;br/&gt;
Sun Dec 23 23:41:06 &lt;span class=&quot;error&quot;&gt;&amp;#91;conn1&amp;#93;&lt;/span&gt; single query: test.$cmd  &lt;/p&gt;
{ getlasterror: 1 }
&lt;p&gt;  ntoreturn: -1 options : 0 0ms&lt;br/&gt;
Sun Dec 23 23:41:06 &lt;span class=&quot;error&quot;&gt;&amp;#91;conn1&amp;#93;&lt;/span&gt; gathering response for gle from: 127.0.0.1:20001&lt;br/&gt;
Sun Dec 23 23:41:06 &lt;span class=&quot;error&quot;&gt;&amp;#91;conn1&amp;#93;&lt;/span&gt; T1: 0ms&lt;br/&gt;
Sun Dec 23 23:41:06 &lt;span class=&quot;error&quot;&gt;&amp;#91;conn1&amp;#93;&lt;/span&gt; T2: 99ms&lt;br/&gt;
Sun Dec 23 23:41:06 &lt;span class=&quot;error&quot;&gt;&amp;#91;conn1&amp;#93;&lt;/span&gt; gathering writebacks from 3 hosts for gle (127.0.0.1:20001)&lt;br/&gt;
Sun Dec 23 23:41:06 &lt;span class=&quot;error&quot;&gt;&amp;#91;conn1&amp;#93;&lt;/span&gt; gathering writebacks for single-shard gle from: 127.0.0.1:20002&lt;br/&gt;
Sun Dec 23 23:41:06 &lt;span class=&quot;error&quot;&gt;&amp;#91;conn1&amp;#93;&lt;/span&gt; gathering writebacks for single-shard gle from: 127.0.0.1:20003&lt;br/&gt;
Sun Dec 23 23:41:06 &lt;span class=&quot;error&quot;&gt;&amp;#91;conn1&amp;#93;&lt;/span&gt; checking 0 writebacks for gle (127.0.0.1:20001)&lt;br/&gt;
Sun Dec 23 23:41:06 &lt;span class=&quot;error&quot;&gt;&amp;#91;conn1&amp;#93;&lt;/span&gt; Request::process end ns: test.$cmd msg id: 2 op: 2004 attempt: 0 99ms&lt;/p&gt;


&lt;p&gt;I add some debug information into: src/mongo/s/client_info.cpp (function ClientInfo::getLastError):&lt;/p&gt;


&lt;p&gt; Timer t;&lt;br/&gt;
  LOG(5) &amp;lt;&amp;lt; &quot;gathering response for gle from: &quot; &amp;lt;&amp;lt; theShard &amp;lt;&amp;lt; endl;&lt;/p&gt;

&lt;p&gt;                ShardConnection conn( theShard , &quot;&quot; );&lt;br/&gt;
                try &lt;/p&gt;
{
                    LOG(5) &amp;lt;&amp;lt; &quot;T1: &quot; &amp;lt;&amp;lt;  t.millis() &amp;lt;&amp;lt; &quot;ms&quot; &amp;lt;&amp;lt; endl;
                    ok = conn-&amp;gt;runCommand( dbName , options , res );
                    LOG(5) &amp;lt;&amp;lt; &quot;T2: &quot; &amp;lt;&amp;lt;  t.millis() &amp;lt;&amp;lt; &quot;ms&quot; &amp;lt;&amp;lt; endl;
                }</description>
                <environment>FreeBSD 8.2 / 9.0 / 9.1 PRERELEASE</environment>
        <key id="60267">SERVER-8024</key>
            <summary>getLastError &gt;90 ms delay over mongos</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</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="4">Incomplete</resolution>
                                        <assignee username="ramon.fernandez@mongodb.com">Ramon Fernandez Marina</assignee>
                                    <reporter username="belov">Konstantin Belov</reporter>
                        <labels>
                            <label>freebsd</label>
                            <label>sharding</label>
                    </labels>
                <created>Sun, 23 Dec 2012 22:23:57 +0000</created>
                <updated>Thu, 25 Jun 2015 18:28:55 +0000</updated>
                            <resolved>Wed, 23 Jul 2014 14:47:25 +0000</resolved>
                                    <version>2.0.6</version>
                    <version>2.2.0</version>
                    <version>2.2.2</version>
                                                    <component>Sharding</component>
                                        <votes>0</votes>
                                    <watches>6</watches>
                                                                                                                <comments>
                            <comment id="668766" author="ramon.fernandez" created="Wed, 23 Jul 2014 14:46:45 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=belov&quot; class=&quot;user-hover&quot; rel=&quot;belov&quot;&gt;belov&lt;/a&gt;, we haven&apos;t heard back from you for some time, so we&apos;re going to mark this ticket as resolved. If this is still an issue for you, feel free to reopen the ticket and provide further information.&lt;/p&gt;

&lt;p&gt;Regards,&lt;br/&gt;
Ram&#243;n.&lt;/p&gt;</comment>
                            <comment id="658524" author="ramon.fernandez" created="Mon, 14 Jul 2014 20:58:22 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=belov&quot; class=&quot;user-hover&quot; rel=&quot;belov&quot;&gt;belov&lt;/a&gt;, can you please let us know whether you&apos;re still seeing the 90ms delay? If the answer is yes, is that on 2.0/2.2 or in a newer version?&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Ram&#243;n.&lt;/p&gt;</comment>
                            <comment id="636665" author="ramon.fernandez" created="Fri, 27 Jun 2014 18:13:56 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=belov&quot; class=&quot;user-hover&quot; rel=&quot;belov&quot;&gt;belov&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;apologies for the late reply, seems we let this one fall through the cracks. Are you still on 2.0/2.2? If you have upgraded to 2.4/2.6, can you please let us know if you are still seeing this 90ms delay?&lt;/p&gt;</comment>
                            <comment id="254848" author="sam.helman@10gen.com" created="Thu, 31 Jan 2013 17:20:16 +0000"  >&lt;p&gt;Hello,&lt;/p&gt;

&lt;p&gt;We have had some historical issues with freebsd and MongoDB related to performance - additionally, since there are relatively few freebsd deployments, it is easier to run into edge cases which have not yet been discovered.  If general, we recommend not using freebsd for deployment.  Is this a possibility for you?&lt;/p&gt;

&lt;p&gt;There are some threads related to performance on freebsd linked here: &lt;a href=&quot;http://serverfault.com/questions/401659/mongodb-on-freebsd&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://serverfault.com/questions/401659/mongodb-on-freebsd&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;</comment>
                            <comment id="249492" author="belov" created="Fri, 25 Jan 2013 10:52:14 +0000"  >&lt;p&gt;Sam, hello!&lt;/p&gt;

&lt;p&gt;Please read my previous post. Under freebsd problem caused by socket implementation (mongo/util/net/sock.cpp)&lt;br/&gt;
We use amd64 kernel, may be we need to tune some sysctl net parameters. &lt;/p&gt;


&lt;p&gt;About config:&lt;br/&gt;
We test two setups:&lt;br/&gt;
1. mongod, mongod+cfg and mongos on the same machine running under freebsd 8.2 &lt;br/&gt;
2. mongos (the same setup) on another machine running under Ubuntu but connecting to mongod on the first machine.&lt;/p&gt;


&lt;p&gt;If we make query direct to mongod (using mongo shell) or via linux mongos - delay is 0 ms. If we make query via freebsd mongos - delay is ALWAYS 90+ ms. I don&apos;t know why under freebsd when we read first four bytes from socket we get ~90 ms timeout &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/sad.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                            <comment id="249071" author="sam.helman@10gen.com" created="Thu, 24 Jan 2013 22:14:19 +0000"  >&lt;p&gt;Hello,&lt;/p&gt;

&lt;p&gt;When you say that you tried on another machine under linux, do you mean that you tried the same setup on a different machine and had no issues?  Are there additional processes (besides mongod) running on the slower machine that might be causing a general I/O slowdown?&lt;/p&gt;

&lt;p&gt;Are there any operations besides inserts which are causing the 90ms delay?&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;</comment>
                            <comment id="248697" author="belov" created="Thu, 24 Jan 2013 15:11:42 +0000"  >&lt;p&gt;Hello again!&lt;/p&gt;

&lt;p&gt;This timeout problem exists not only with command &quot;getLastError&quot;, i add debug information into: &quot;util/net/sock.cpp&quot; at line 774 in function &quot;unsafe_recv&quot;:&lt;/p&gt;

&lt;p&gt;int Socket::unsafe_recv( char *buf, int max )&lt;/p&gt;

&lt;p&gt;mongos.log:&lt;br/&gt;
...&lt;br/&gt;
Thu Jan 24 18:48:10 &lt;span class=&quot;error&quot;&gt;&amp;#91;Balancer&amp;#93;&lt;/span&gt; Socket::recv() len = 4&lt;br/&gt;
Thu Jan 24 18:48:10 &lt;span class=&quot;error&quot;&gt;&amp;#91;Balancer&amp;#93;&lt;/span&gt; Socket::recv(), unsafe_recv done in 90 ms&lt;br/&gt;
...&lt;br/&gt;
Thu Jan 24 18:50:01 &lt;span class=&quot;error&quot;&gt;&amp;#91;conn3&amp;#93;&lt;/span&gt; Socket::recv() len = 4&lt;br/&gt;
Thu Jan 24 18:50:01 &lt;span class=&quot;error&quot;&gt;&amp;#91;conn3&amp;#93;&lt;/span&gt; Socket::recv(), unsafe_recv done in 90 ms&lt;br/&gt;
Thu Jan 24 18:50:01 &lt;span class=&quot;error&quot;&gt;&amp;#91;conn3&amp;#93;&lt;/span&gt; Socket::recv() len = 97&lt;br/&gt;
Thu Jan 24 18:50:01 &lt;span class=&quot;error&quot;&gt;&amp;#91;conn3&amp;#93;&lt;/span&gt; Socket::recv(), unsafe_recv done in 0 ms&lt;br/&gt;
Thu Jan 24 18:50:01 &lt;span class=&quot;error&quot;&gt;&amp;#91;conn3&amp;#93;&lt;/span&gt; psock-&amp;gt;recv()&lt;/p&gt;


&lt;p&gt;So when we read first four bytes from socket we get ~90 ms timeout, why? o_O&lt;/p&gt;</comment>
                            <comment id="244459" author="belov" created="Sat, 19 Jan 2013 17:30:51 +0000"  >&lt;p&gt;Hello!&lt;/p&gt;

&lt;p&gt;We use php driver 1.3.2, write concern = 1, in collections we have only one index - &quot;_id&quot;.&lt;br/&gt;
But if we run mongos on another machine under linux (mongod still on freebsd) - there is no delay!! &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/sad.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                            <comment id="241649" author="sam.helman@10gen.com" created="Wed, 16 Jan 2013 18:05:09 +0000"  >&lt;p&gt;Hello,&lt;/p&gt;

&lt;p&gt;The 90 ms delay could have a number of causes.  If your insert is causing an index to be updated, this could create a delay since the index is updated on all shards.  What write concern are you using, and which version of the php driver?  Do you have any indexes on the collection?&lt;/p&gt;

&lt;p&gt;Thank you  &lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Wed, 16 Jan 2013 18:05:09 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        9 years, 30 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>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>ramon.fernandez@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            9 years, 30 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_10032" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Operating System</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10024"><![CDATA[FreeBSD]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>belov</customfieldvalue>
            <customfieldvalue>ramon.fernandez@mongodb.com</customfieldvalue>
            <customfieldvalue>sam.helman@10gen.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrndiv:</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>37729</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_23361" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Requested By</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10750" key="com.atlassian.jira.plugin.system.customfieldtypes:textarea">
                        <customfieldname>Steps To Reproduce</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>&lt;p&gt;Simple php script:&lt;/p&gt;

&lt;p&gt;&amp;lt;?php&lt;br/&gt;
// connecting to mongos&lt;br/&gt;
$m = new MongoClient(&apos;mongodb://127.0.0.1:20027&apos;);&lt;br/&gt;
$db = $m-&amp;gt;selectDB(&apos;test&apos;);&lt;/p&gt;

&lt;p&gt;$collection = new MongoCollection($db, &apos;c1&apos;);&lt;/p&gt;

&lt;p&gt;$mt = microtime(true);&lt;br/&gt;
$r = $collection-&amp;gt;insert(array(&apos;n&apos; =&amp;gt; 1));&lt;br/&gt;
echo round( (microtime(true) - $mt) * 1000), &quot;\n&quot;;&lt;/p&gt;</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|hsztpr:</customfieldvalue>

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