<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:39:36 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-15984] Monitoring and performance improvement</title>
                <link>https://jira.mongodb.org/browse/SERVER-15984</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Dear team,&lt;/p&gt;

&lt;p&gt;We are using MongoDB as a backend for Cube for logging streaming events. We are facing some performance issues while querying the DB. When firing several queries I can see the queries get executed almost serially and the CPU usage pretty high.&lt;br/&gt;
Since we are using an existing product, would like to know if there is some diagnostics we could run that will help us identify any specific indexes that need to be created or tuning any parameters. In essence, something to help us hint at what could be choking the system. Please let me know if any additional information from my side would help.&lt;/p&gt;

&lt;p&gt;Any pointers would be greatly appreciated. &lt;/p&gt;

&lt;p&gt;Regards,&lt;br/&gt;
Ritesh&lt;/p&gt;</description>
                <environment></environment>
        <key id="167634">SERVER-15984</key>
            <summary>Monitoring and performance improvement</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="9">Done</resolution>
                                        <assignee username="ramon.fernandez@mongodb.com">Ramon Fernandez Marina</assignee>
                                    <reporter username="ritesh.gupta@techvedika.com">Ritesh Gupta</reporter>
                        <labels>
                    </labels>
                <created>Thu, 6 Nov 2014 06:55:28 +0000</created>
                <updated>Wed, 3 Dec 2014 20:27:04 +0000</updated>
                            <resolved>Wed, 3 Dec 2014 20:27:04 +0000</resolved>
                                                                    <component>Diagnostics</component>
                    <component>Index Maintenance</component>
                    <component>Performance</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="777754" author="ramon.fernandez" created="Wed, 3 Dec 2014 20:26:46 +0000"  >&lt;p&gt;Please see &lt;a href=&quot;http://docs.mongodb.org/v2.4/reference/operator/meta/query/#query&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;the documentation for &lt;tt&gt;$query&lt;/tt&gt;&lt;/a&gt;, which shows how to use &lt;tt&gt;explain()&lt;/tt&gt;. In particular:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Do not mix query forms. If you use the $query format, do not append cursor methods to the find(). To modify the query use the meta-query operators, such as $explain.&lt;/p&gt;

&lt;p&gt;Therefore, the following two operations are equivalent:&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;   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;db.collection.find( { $query: { age : 25 }, $explain: true } )&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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-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;db.collection.find( { age : 25 } ).explain()&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;/blockquote&gt;
&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-6767&quot; title=&quot;Interpret $query as special so you can copy profiler/logged queries into shell&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-6767&quot;&gt;&lt;del&gt;SERVER-6767&lt;/del&gt;&lt;/a&gt; is opened to allow the use &lt;tt&gt;$query&lt;/tt&gt; with &lt;tt&gt;explain()&lt;/tt&gt;, feel free to vote for it if you&apos;re interested.&lt;/p&gt;

&lt;p&gt;I also see that you&apos;re using a 2.4 version. Somewhere along the 2.6 series the logging was greatly improved, and slow queries now contain additional information:&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;2014-12-03T15:08:30.462-0500 [conn6] query test.foo query: { $query: { x: 4131479.0 } } planSummary: IXSCAN { x: 1.0 } ntoreturn:0 ntoskip:0 nscanned:1 nscannedObjects:1 keyUpdates:0 numYields:0 locks(micros) r:265 nreturned:1 reslen:70 0ms&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;The query logged above shows an index scan of the {&lt;tt&gt;x:1&lt;/tt&gt;} index for example. You may want to try 2.6.5 in a test environment if you find this useful.&lt;/p&gt;

&lt;p&gt;Finally, note that the SERVER project is for reporting bugs or feature suggestions for the MongoDB server. For MongoDB-related support discussion please post on the &lt;a href=&quot;http://groups.google.com/group/mongodb-user&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;mongodb-user group&lt;/a&gt; or &lt;a href=&quot;http://stackoverflow.com/questions/tagged/mongodb&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;Stack Overflow with the &lt;tt&gt;mongodb&lt;/tt&gt; tag&lt;/a&gt;, where your question will reach a larger audience. A question like this involving more discussion would be best posted on the &lt;a href=&quot;http://groups.google.com/group/mongodb-user&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;mongodb-user group&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="758756" author="ritesh.gupta@techvedika.com" created="Fri, 7 Nov 2014 13:55:11 +0000"  >&lt;p&gt;Hi Ramon,&lt;/p&gt;

&lt;p&gt;Thanks for your inputs. We turned on the profiler with a 100ms query slow time. There is a weird observation. We are using Cube and therefore there is a NodeJS front-end which is making calls to MongoDB. Here is what I find in logs:&lt;/p&gt;

&lt;p&gt;Fri Nov  7 13:38:12.152 &lt;span class=&quot;error&quot;&gt;&amp;#91;conn217&amp;#93;&lt;/span&gt; query cube_development.pl_info_metrics query: { $query: { i: false, _id.e: &quot;median(pl_info(pageloadTime).eq(domain,&apos;ritesh.com&apos;).eq(geography,&apos;AG&apos;))&quot;, _id.l: 86400000, _id.t: &lt;/p&gt;
{ $gte: new Date(1414713600000), $lt: new Date(1415404800000) }
&lt;p&gt; }, orderby: &lt;/p&gt;
{ _id.t: 1 }
&lt;p&gt; } ntoreturn:1000 ntoskip:0 nscanned:558326 scanAndOrder:1 keyUpdates:0 numYields: 4 locks(micros) r:2659501 nreturned:0 reslen:20 1372ms &lt;/p&gt;

&lt;p&gt;As you can see the query is wrapped in a key $query. When I run an explain with the $query - I see a BasicCursor used and when I run the same query removing the $query - I see a BTreeCursor used. So essentially my index usage is getting affected with this. Is this a bug with NodeJS? Are you aware of any such issues with NodeJS and MongoDB?&lt;/p&gt;

&lt;p&gt;Here is the output from the explain plan steps I ran above:&lt;br/&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt; db.coll.find({ $query: { t: &lt;/p&gt;
{ $gte: new Date(1412726400000), $lt: new Date(1413331200000) }
&lt;p&gt;, &quot;d.domain&quot;: &quot;ritesh.com&quot;, &quot;d.geography&quot;: &quot;AW&quot;, &quot;d.pageloadTime&quot;: &lt;/p&gt;
{ $exists: true }
&lt;p&gt; }, orderby: &lt;/p&gt;
{ t: 1 }
&lt;p&gt; }).explain()&lt;br/&gt;
{&lt;br/&gt;
	&quot;cursor&quot; : &quot;BasicCursor&quot;,&lt;br/&gt;
	&quot;isMultiKey&quot; : false,&lt;br/&gt;
	&quot;n&quot; : 0,&lt;br/&gt;
	&quot;nscannedObjects&quot; : 1554725,&lt;br/&gt;
	&quot;nscanned&quot; : 1554725,&lt;br/&gt;
	&quot;nscannedObjectsAllPlans&quot; : 1554725,&lt;br/&gt;
	&quot;nscannedAllPlans&quot; : 1554725,&lt;br/&gt;
	&quot;scanAndOrder&quot; : false,&lt;br/&gt;
	&quot;indexOnly&quot; : false,&lt;br/&gt;
	&quot;nYields&quot; : 1,&lt;br/&gt;
	&quot;nChunkSkips&quot; : 0,&lt;br/&gt;
	&quot;millis&quot; : 1015,&lt;br/&gt;
	&quot;indexBounds&quot; : {&lt;/p&gt;

&lt;p&gt;	},&lt;br/&gt;
	&quot;server&quot; : &quot;ip-172:27017&quot;&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;db.pl_info_events.find({ t: &lt;/p&gt;
{ $gte: new Date(1412726400000), $lt: new Date(1413331200000) }
&lt;p&gt;, &quot;d.domain&quot;: &quot;ritesh.com&quot;, &quot;d.geography&quot;: &quot;AW&quot;, &quot;d.pageloadTime&quot;: &lt;/p&gt;
{ $exists: true }
&lt;p&gt;, orderby: &lt;/p&gt;
{ t: 1 }
&lt;p&gt; }).explain()&lt;br/&gt;
{&lt;br/&gt;
	&quot;cursor&quot; : &quot;BtreeCursor d.geography_1&quot;,&lt;br/&gt;
	&quot;isMultiKey&quot; : false,&lt;br/&gt;
	&quot;n&quot; : 0,&lt;br/&gt;
	&quot;nscannedObjects&quot; : 38,&lt;br/&gt;
	&quot;nscanned&quot; : 38,&lt;br/&gt;
	&quot;nscannedObjectsAllPlans&quot; : 154,&lt;br/&gt;
	&quot;nscannedAllPlans&quot; : 154,&lt;br/&gt;
	&quot;scanAndOrder&quot; : false,&lt;br/&gt;
	&quot;indexOnly&quot; : false,&lt;br/&gt;
	&quot;nYields&quot; : 0,&lt;br/&gt;
	&quot;nChunkSkips&quot; : 0,&lt;br/&gt;
	&quot;millis&quot; : 0,&lt;br/&gt;
	&quot;indexBounds&quot; : &lt;/p&gt;
{
		&quot;d.geography&quot; : [
			[
				&quot;AW&quot;,
				&quot;AW&quot;
			]
		]
	}
&lt;p&gt;,&lt;br/&gt;
	&quot;server&quot; : &quot;ip-172:27017&quot;&lt;br/&gt;
}&lt;/p&gt;</comment>
                            <comment id="758083" author="ramon.fernandez" created="Thu, 6 Nov 2014 19:28:22 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=ritesh.gupta%40techvedika.com&quot; class=&quot;user-hover&quot; rel=&quot;ritesh.gupta@techvedika.com&quot;&gt;ritesh.gupta@techvedika.com&lt;/a&gt;, by default all queries taking longer than 100ms should appear in the logs, you can see what &lt;tt&gt;mongod&lt;/tt&gt; reports as &quot;slow&quot;. You may want to play with &lt;a href=&quot;http://docs.mongodb.org/manual/reference/configuration-options/#operationProfiling.slowOpThresholdMs&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;slowOpThresholdMS&lt;/a&gt; values to get a better idea, or perhaps enable &lt;a href=&quot;http://docs.mongodb.org/manual/reference/method/db.setProfilingLevel/#db-setprofilinglevel&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;the profiler&lt;/a&gt;.&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>3.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Thu, 6 Nov 2014 19:28:22 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        9 years, 11 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>ian@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            9 years, 11 weeks ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>ramon.fernandez@mongodb.com</customfieldvalue>
            <customfieldvalue>ritesh.gupta@techvedika.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrlju7:</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>146547</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>
                                

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

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