<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:01:12 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-2793] Understanding memory/disk metrics</title>
                <link>https://jira.mongodb.org/browse/SERVER-2793</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;I&apos;m trying to delve deeper into MongoDB memory/disk usage patterns to both optimize my configuration and to identify warning signs for impending performance problems. I have some high level questions first:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;mongod resident memory: I generally don&apos;t see this go above half the available RAM. Any idea what causes resident memory size to grow vs pages just sticking in the OS file cache?&lt;/li&gt;
&lt;/ul&gt;


&lt;ul&gt;
	&lt;li&gt;Is there any way to distinguish between memory warming up and an actual memory crunch? Any metrics/ratios to look out for in tools like iostat, sar, vmstat, etc.?&lt;/li&gt;
&lt;/ul&gt;


&lt;ul&gt;
	&lt;li&gt;Are there any metrics you look at to indicate that RAM is nearly full? I&apos;m graphing most metrics in &quot;/proc/meminfo&quot; over time, however, when it appears I&apos;ve hit my RAM threshold, things like active RAM in /proc/meminfo is reported at only half of RAM. Inactive is the other half.&lt;/li&gt;
&lt;/ul&gt;


&lt;ul&gt;
	&lt;li&gt;Shouldn&apos;t the amount reported as &quot;Mapped&quot; in /proc/meminfo be a comprehensive number that indicates how much MongoDB has mapped and therefore how much memory it&apos;s using?&lt;/li&gt;
&lt;/ul&gt;
</description>
                <environment>Ubuntu 10.04</environment>
        <key id="15168">SERVER-2793</key>
            <summary>Understanding memory/disk metrics</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="gatesvp">Gaetan Voyer-Perrault</assignee>
                                    <reporter username="charso">charso</reporter>
                        <labels>
                    </labels>
                <created>Fri, 18 Mar 2011 07:38:10 +0000</created>
                <updated>Fri, 30 Mar 2012 14:26:56 +0000</updated>
                            <resolved>Fri, 1 Apr 2011 20:04:03 +0000</resolved>
                                    <version>1.6.5</version>
                                                    <component>Performance</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="27300" author="gatesvp" created="Wed, 30 Mar 2011 19:15:24 +0000"  >&lt;p&gt;Any additional follow-up required or are we ready to close this issue?&lt;/p&gt;</comment>
                            <comment id="26600" author="gatesvp" created="Wed, 23 Mar 2011 18:50:51 +0000"  >&lt;p&gt;Here&apos;s the simplest definition I can find for the &quot;mapped&apos; value of /proc/meminfo:&lt;/p&gt;

&lt;p&gt;Mapped &#8212; The total amount of memory, in kilobytes, which have been used to map devices, files, or libraries using the mmap command.&lt;/p&gt;

&lt;p&gt;Looking at your charts, that&apos;s the gold line.&lt;/p&gt;

&lt;p&gt;&amp;gt; the resident and mapped memory footprint is leveling off at half of available RAM?&lt;/p&gt;

&lt;p&gt;Based on the attached images, you re-started the mongo process just before midnight. At this point the gold line plummets to 0. Then the line shoots up to over 30GBs and hovers around 30GBs.&lt;/p&gt;

&lt;p&gt;However, if you follow the gold line prior to the restart it was clearly above half RAM. So it&apos;s quite possible to &quot;mmap&quot; more than half of the memory.&lt;/p&gt;

&lt;p&gt;&amp;gt; I&apos;m constantly adding data, so you&apos;d think if it still had half of available RAM left that resident/mapped would keep growing...&lt;/p&gt;

&lt;p&gt;Well, if you&apos;re constantly adding data, then MongoDB only needs to &quot;mmap&quot; two big things:&lt;br/&gt;
 1. The relevant part of the index&lt;br/&gt;
 2. The newly added data&lt;/p&gt;

&lt;p&gt;Notice how turning off MongoDB did not free all of the your memory (yellow stuff)?&lt;br/&gt;
Take a look at the &quot;cache&quot; section of your RAM. (that&apos;s the purple stuff)&lt;/p&gt;

&lt;p&gt;By your own charts you either have something else using up the RAM or the OS is doing some caching for you.&lt;/p&gt;

&lt;p&gt;At this point, I&apos;m not seeing anything clearly &quot;wrong&quot; here.&lt;/p&gt;

&lt;p&gt;Is there a documented performance issue here?&lt;/p&gt;</comment>
                            <comment id="26512" author="charso" created="Tue, 22 Mar 2011 20:04:10 +0000"  >&lt;ul&gt;
	&lt;li&gt;resident and mapped memory&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;I found this explanation about resident memory:&lt;/p&gt;

&lt;p&gt;number of megabytes resident. It is typical over time, on a dedicated database server, for this number to approach the amount of physical ram on the box.&lt;br/&gt;
&lt;a href=&quot;http://www.mongodb.org/display/DOCS/serverStatus&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://www.mongodb.org/display/DOCS/serverStatus&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;However, this doesn&apos;t explain why, in my configuration which data and index exceeding RAM, the resident and mapped memory footprint is leveling off at half of available RAM.  I&apos;m constantly adding data, so you&apos;d think if it still had half of available RAM left that resident/mapped would keep growing, but it isn&apos;t. I&apos;m looking for thoughts around why it levels off at half of RAM.&lt;/p&gt;</comment>
                            <comment id="26511" author="charso" created="Tue, 22 Mar 2011 19:56:31 +0000"  >&lt;p&gt;I became busy dealing with CS-415. I&apos;m looking at this now and will follow-up soon.&lt;/p&gt;</comment>
                            <comment id="26453" author="gatesvp" created="Tue, 22 Mar 2011 00:42:52 +0000"  >&lt;p&gt;Is there any additional follow-up required?&lt;/p&gt;</comment>
                            <comment id="26262" author="gatesvp" created="Fri, 18 Mar 2011 20:31:21 +0000"  >&lt;p&gt;Lots of questions here, however, it looks like we have documents for much of this.&lt;/p&gt;

&lt;p&gt;&amp;gt;  Any idea what causes resident memory size to grow vs pages just sticking in the OS file cache?&lt;br/&gt;
&amp;gt; Is there any way to distinguish between memory warming up and an actual memory crunch? &lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.mongodb.org/display/DOCS/Monitoring+and+Diagnostics&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://www.mongodb.org/display/DOCS/Monitoring+and+Diagnostics&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&amp;gt; Any metrics/ratios to look out for in tools like iostat, sar, vmstat, etc.?&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.mongodb.org/display/DOCS/iostat&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://www.mongodb.org/display/DOCS/iostat&lt;/a&gt;&lt;br/&gt;
&lt;a href=&quot;http://www.mongodb.org/display/DOCS/mongostat&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://www.mongodb.org/display/DOCS/mongostat&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Is there something specific missing from those docs?&lt;/p&gt;</comment>
                            <comment id="26245" author="gatesvp" created="Fri, 18 Mar 2011 17:57:20 +0000"  >&lt;p&gt;So the first thing that jumps at me is that these are not equal shards. It looks like shard1 has two additional collections and a few extra indexes.&lt;/p&gt;

&lt;p&gt;Can you clarify the difference in collections?&lt;/p&gt;</comment>
                            <comment id="26208" author="charso" created="Fri, 18 Mar 2011 07:43:18 +0000"  >&lt;p&gt;Attached is an example of the memory usage on two different shard primaries. This example illustrates some of my questions. Note that only the last few hours are relevant; previous to that there was a repair.&lt;/p&gt;

&lt;p&gt;Shard1 happens to be doing a lot of read IO, whereas Shard2 has very little IO. The only discrepancy I can see is the difference between inactive and mapped memory. Here are the associated db stats:&lt;/p&gt;

&lt;p&gt;Shard1&lt;br/&gt;
&quot;Fri Mar 18 2011 07:39:37 GMT+0000 (UTC)&quot;&lt;br/&gt;
&amp;gt; prod.stats();&lt;br/&gt;
{&lt;br/&gt;
        &quot;collections&quot; : 7,&lt;br/&gt;
        &quot;objects&quot; : 248997611,&lt;br/&gt;
        &quot;avgObjSize&quot; : 195.65127450158548,&lt;br/&gt;
        &quot;dataSize&quot; : 48716699940,&lt;br/&gt;
        &quot;storageSize&quot; : 55574353408,&lt;br/&gt;
        &quot;numExtents&quot; : 120,&lt;br/&gt;
        &quot;indexes&quot; : 8,&lt;br/&gt;
        &quot;indexSize&quot; : 29139508896,&lt;br/&gt;
        &quot;fileSize&quot; : 105109258240,&lt;br/&gt;
        &quot;ok&quot; : 1&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;Shard2&lt;br/&gt;
&quot;Fri Mar 18 2011 07:39:49 GMT+0000 (UTC)&quot;&lt;br/&gt;
&amp;gt; prod.stats();&lt;br/&gt;
{&lt;br/&gt;
        &quot;collections&quot; : 5,&lt;br/&gt;
        &quot;objects&quot; : 227033080,&lt;br/&gt;
        &quot;avgObjSize&quot; : 195.37059565064263,&lt;br/&gt;
        &quot;dataSize&quot; : 44355588072,&lt;br/&gt;
        &quot;storageSize&quot; : 49278558976,&lt;br/&gt;
        &quot;numExtents&quot; : 111,&lt;br/&gt;
        &quot;indexes&quot; : 5,&lt;br/&gt;
        &quot;indexSize&quot; : 27489705632,&lt;br/&gt;
        &quot;fileSize&quot; : 92230647808,&lt;br/&gt;
        &quot;ok&quot; : 1&lt;br/&gt;
}&lt;/p&gt;
</comment>
                    </comments>
                    <attachments>
                            <attachment id="11114" name="memory-mongodb-shard1-primary-2011-03-18.png" size="33593" author="charso" created="Fri, 18 Mar 2011 07:43:18 +0000"/>
                            <attachment id="11115" name="memory-mongodb-shard2-primary-2011-03-18.png" size="33295" author="charso" created="Fri, 18 Mar 2011 07:43:18 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>8.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Fri, 18 Mar 2011 17:57:20 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        12 years, 47 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>
                            12 years, 47 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>charso</customfieldvalue>
            <customfieldvalue>gatesvp</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrp37j:</customfieldvalue>

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

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

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