<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:06: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-44574] Queries Taking more then expected time for small collection</title>
                <link>https://jira.mongodb.org/browse/SERVER-44574</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;We have a collection on production environment and it is having only 126 records, but it is taking maximum 6 seconds for a single findOne operation.&#160;&lt;/p&gt;

&lt;p&gt;We are using mongodb version 3.4 , and it is having very slow response time for even smaller find operations. All the find operations are using IXSCAN with proper index utilisation, and all read and write operations are taking more than 1 second even with smaller document size having 10-12 fields.&lt;/p&gt;

&lt;p&gt;We have 37GB of data and our production environment having 3 member replica set with primary, secondary, secondary configuration.&lt;/p&gt;

&lt;p&gt;Please update us with possible optimisation methods.&lt;/p&gt;</description>
                <environment></environment>
        <key id="998836">SERVER-44574</key>
            <summary>Queries Taking more then expected time for small collection</summary>
                <type id="6" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14720&amp;avatarType=issuetype">Question</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="13202">Works as Designed</resolution>
                                        <assignee username="dmitry.agranat@mongodb.com">Dmitry Agranat</assignee>
                                    <reporter username="pratiksha.gupta38@gmail.com">Pratiksha Aggarwal</reporter>
                        <labels>
                    </labels>
                <created>Tue, 12 Nov 2019 09:36:46 +0000</created>
                <updated>Fri, 27 Oct 2023 13:53:00 +0000</updated>
                            <resolved>Tue, 19 Nov 2019 11:50:18 +0000</resolved>
                                    <version>3.4.23</version>
                                                                        <votes>0</votes>
                                    <watches>5</watches>
                                                                                                                <comments>
                            <comment id="2548777" author="dmitry.agranat" created="Tue, 19 Nov 2019 11:49:59 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=pragupta&quot; class=&quot;user-hover&quot; rel=&quot;pragupta&quot;&gt;pragupta&lt;/a&gt;, those write operations are coming from the Primary member, being replicated in batches to your secondary members. In case there is a read operation directed to one of your secondaries (for example, the query you&apos;ve mentioned) and we need to replicate a batch of write operations from Primary, we will give priority to replicating this batch (while that read operation will have to wait until the write batch is fully replicated). So this is expected behavior before MongoDB 4.0.x.&lt;/p&gt;

&lt;p&gt;If you see the same behavior after upgrading to MongoDB 4.x, please open a new ticket and we&apos;d be happy to take a look.&lt;/p&gt;

&lt;p&gt;Regards,&lt;br/&gt;
Dima&lt;/p&gt;</comment>
                            <comment id="2548747" author="pratiksha.gupta38@gmail.com" created="Tue, 19 Nov 2019 11:16:12 +0000"  >&lt;p&gt;Hi @Dmitry Agranat&lt;/p&gt;

&lt;p&gt;Our countryMapping collection is static collection which don&apos;t includes any write operation, only read is done in every 15min on 126 documents. So ideally 2-3 seconds is large time which makes the output slow for end user.&#160; &#160;&lt;/p&gt;</comment>
                            <comment id="2548650" author="dmitry.agranat" created="Tue, 19 Nov 2019 09:55:48 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=pragupta&quot; class=&quot;user-hover&quot; rel=&quot;pragupta&quot;&gt;pragupta&lt;/a&gt;, thanks for uploading the requested information. &lt;/p&gt;

&lt;p&gt;This is a well-known issue of secondary queries where oplog application prevents reads in order to ensure a consistent view of the data. On secondary nodes, we apply writes in batches, because applying them sequentially would likely cause secondaries to fall behind the primary. When writes are applied in batches, we must block reads so that applications cannot see data applied in the &quot;wrong&quot; order. This is why when reading from secondaries, periodically the readers have to wait for replication batches to be applied. &lt;/p&gt;

&lt;p&gt;The best way would be to upgrade to the latest MongoDB 4.0.x, which introduced &lt;a href=&quot;https://www.mongodb.com/blog/post/secondary-reads-mongodb-40&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;non-blocking secondary reads&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Dima&lt;/p&gt;</comment>
                            <comment id="2546535" author="pratiksha.gupta38@gmail.com" created="Mon, 18 Nov 2019 11:23:44 +0000"  >&lt;p&gt;@Dmitry Agranat&#160; snippet is added now for our test environment on which queries are taking upto 2 seconds max, but on production they are taking 7seconds max, we have not uploaded production snippet&#160; because we can&apos;t share that but you can look the test&#160; environment logs which is equivalent to prod.&lt;/p&gt;</comment>
                            <comment id="2545267" author="dmitry.agranat" created="Sun, 17 Nov 2019 15:04:51 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=pragupta&quot; class=&quot;user-hover&quot; rel=&quot;pragupta&quot;&gt;pragupta&lt;/a&gt;, the file from the &lt;tt&gt;diagnostic.data&lt;/tt&gt; you&apos;ve uploaded only covers a few hours of November 10th, while the latest log snippet is from November 11th. Also, we&apos;ll need a full mongod log (instead of a single snippet) together with an archive of the &lt;tt&gt;diagnostic.data&lt;/tt&gt; directory.&lt;/p&gt;</comment>
                            <comment id="2542507" author="pratiksha.gupta38@gmail.com" created="Fri, 15 Nov 2019 09:04:43 +0000"  >&lt;p&gt;Hi @Dmitry Agranat,&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;Above shared logs are from mongod.log , please find more logs for the 11th november and we have shared diagnostic data on secure portal as well for the same date.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;2019-11-11T02:17:55.041+0000 I COMMAND &lt;span class=&quot;error&quot;&gt;&amp;#91;conn61586&amp;#93;&lt;/span&gt; command .countryMapping command: find { find: &quot;countryMapping&quot;, filter: { $or: [ &lt;/p&gt;
{ apFirmware.isoCode: &quot;356&quot; }
&lt;p&gt;, { isoCode: &quot;356&quot; } ] }, projection: { _id: 0, countryCode: 1 }, limit: 1, singleBatch: true } planSummary: COLLSCAN keysExamined:0 docsExamined:48 cursorExhausted:1 numYields:0 nreturned:1 reslen:148 locks:{ Global: { acquireCount: &lt;/p&gt;
{ r: 2 }
&lt;p&gt;, acquireWaitCount: { r: 1 }, timeAcquiringMicros: { r: 1222380 } }, Database: { acquireCount: &lt;/p&gt;
{ r: 1 }
&lt;p&gt; }, Collection: { acquireCount: &lt;/p&gt;
{ r: 1 }
&lt;p&gt; } } protocol:op_query 1223ms&lt;/p&gt;


&lt;p&gt;2019-11-11T17:43:19.952+0000 I COMMAND &lt;span class=&quot;error&quot;&gt;&amp;#91;conn239731&amp;#93;&lt;/span&gt; command countryMapping command: find { find: &quot;countryMapping&quot;, filter: { $or: [ &lt;/p&gt;
{ apFirmware.isoCode: &quot;840&quot; }
&lt;p&gt;, { isoCode: &quot;840&quot; } ] }, projection: { _id: 0, countryCode: 1 }, limit: 1, singleBatch: true } planSummary: COLLSCAN keysExamined:0 docsExamined:101 cursorExhausted:1 numYields:0 nreturned:1 reslen:148 locks:{ Global: { acquireCount: &lt;/p&gt;
{ r: 2 }
&lt;p&gt;, acquireWaitCount: { r: 1 }, timeAcquiringMicros: { r: 1055145 } }, Database: { acquireCount: &lt;/p&gt;
{ r: 1 }
&lt;p&gt; }, Collection: { acquireCount: &lt;/p&gt;
{ r: 1 }
&lt;p&gt; } } protocol:op_query 1058ms&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="2538647" author="dmitry.agranat" created="Wed, 13 Nov 2019 13:21:37 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=pragupta&quot; class=&quot;user-hover&quot; rel=&quot;pragupta&quot;&gt;pragupta&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;I did not find the requested mongod log and an archive of the &lt;tt&gt;diagnostic.data&lt;/tt&gt; directory from the server in question in our &lt;a href=&quot;https://10gen-httpsupload.s3.amazonaws.com/upload_forms/47761e92-3c7d-407d-b93f-098fb44dc50e.html&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;secure upload portal&lt;/a&gt;. Could you make sure it&apos;s uploaded and notify here when it&apos;s done?&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Dima&lt;/p&gt;</comment>
                            <comment id="2538571" author="pratiksha.gupta38@gmail.com" created="Wed, 13 Nov 2019 11:53:35 +0000"  >&lt;p&gt;Please find the slow query log, total number of records in &lt;b&gt;countryMapping&lt;/b&gt; collection are 126. This query is observed daily in logs in gap of every 2min on production environment.&lt;/p&gt;

&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;2019-10-24T05:01:51.395+0000 I COMMAND [conn31403628] command countryMapping command: find { find: &quot;countryMapping&quot;, filter: { $or: [{ apFirmware.isoCode: &quot;840&quot; }, \{ isoCode: &quot;840&quot; } ] }, projection: \{ _id: 0, countryCode: 1 }, limit: 1, singleBatch: true } planSummary: COLLSCAN keysExamined:0 docsExamined:89 cursorExhausted:1 keyUpdates:0 writeConflicts:0 numYields:0 nreturned:1 reslen:166 locks:{ Global: { acquireCount: { r: 2 }, acquireWaitCount: \{ r: 1 }, timeAcquiringMicros: \{ r: 6784024 } }, Database: { acquireCount: { r: 1 }}, Collection: { acquireCount: { r: 1 }} } protocol:op_query 6808ms&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;


&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;2019-10-24T05:33:17.376+0000 I COMMAND [conn29565004] command countryMapping command: find { find: &quot;countryMapping&quot;, filter: { timezoneDetails.apCode: &quot;262&quot; }, projection: \{ timezoneDetails.$: 1 } } planSummary: IXSCAN \{ timezoneDetails.apCode: 1.0 } keysExamined:1 docsExamined:1 cursorExhausted:1 keyUpdates:0 writeConflicts:0 numYields:0 nreturned:1 reslen:358 locks:{ Global: { acquireCount: { r: 2 } , acquireWaitCount: \{ r: 1 }, timeAcquiringMicros: \{ r: 2959573 } }, Database: { acquireCount: { r: 1 }}, Collection: { acquireCount: { r: 1 }} } protocol:op_query 2995ms&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="2537043" author="dmitry.agranat" created="Tue, 12 Nov 2019 17:52:12 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=pragupta&quot; class=&quot;user-hover&quot; rel=&quot;pragupta&quot;&gt;pragupta&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Would you please upload the mongod log and an archive of the &lt;tt&gt;diagnostic.data&lt;/tt&gt; directory (the contents are described &lt;a href=&quot;https://docs.mongodb.com/manual/administration/analyzing-mongodb-performance/#full-time-diagnostic-data-capture&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;) in your dbpath to this &lt;a href=&quot;https://10gen-httpsupload.s3.amazonaws.com/upload_forms/47761e92-3c7d-407d-b93f-098fb44dc50e.html&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;secure upload portal&lt;/a&gt; that is only visible to MongoDB employees?&lt;/p&gt;

&lt;p&gt;Please also note the time and the time zone of any slow operations you&apos;d like us to investigate.&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Dima&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_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10038"><![CDATA[Fully Compatible]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Tue, 12 Nov 2019 17:52:12 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        4 years, 12 weeks, 1 day 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_17050" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Downstream Team Attention</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="16941"><![CDATA[Not Needed]]></customfieldvalue>

                        </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>luke.bonanomi@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            4 years, 12 weeks, 1 day ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>dmitry.agranat@mongodb.com</customfieldvalue>
            <customfieldvalue>pratiksha.gupta38@gmail.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hw23fj:</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</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_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>
                                    <customfieldvalue><![CDATA[dmitry.agranat@mongodb.com]]></customfieldvalue>
    

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

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