<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:58:34 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-21837] MongoD memory usage higher than wiredTigerCacheSizeGB for primary in replica set</title>
                <link>https://jira.mongodb.org/browse/SERVER-21837</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;I&apos;ve been watching mongod memory fairly closely (&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-20991&quot; title=&quot;WiredTiger caching strategy needs improvement on Windows&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-20991&quot;&gt;&lt;del&gt;SERVER-20991&lt;/del&gt;&lt;/a&gt;, &lt;br/&gt;
&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-20104&quot; title=&quot;WT high memory usage due to high amount of free memory accumulated by TCMalloc&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-20104&quot;&gt;&lt;del&gt;SERVER-20104&lt;/del&gt;&lt;/a&gt; etc). With 3.2, memory usage on my non-replica-set deployment is excellent and it is well within expectations for the given wiredTigerCacheSizeGB.&lt;/p&gt;

&lt;p&gt;Testing a replica-set with the same workload, the memory appears to push past this limit significantly: using a 4GB argument, actual memory usage is at 6.5 GB fairly quickly after kicking off the run.&lt;/p&gt;

&lt;p&gt;I haven&apos;t done a full run yet, but will attempt to do so to see if memory keeps climbing or if it levels off.&lt;/p&gt;</description>
                <environment></environment>
        <key id="243162">SERVER-21837</key>
            <summary>MongoD memory usage higher than wiredTigerCacheSizeGB for primary in replica set</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="3">Duplicate</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="nick@innsenroute.com">Nick Judson</reporter>
                        <labels>
                    </labels>
                <created>Thu, 10 Dec 2015 04:02:54 +0000</created>
                <updated>Mon, 25 Jan 2016 16:53:37 +0000</updated>
                            <resolved>Mon, 25 Jan 2016 16:53:37 +0000</resolved>
                                                                    <component>Replication</component>
                                        <votes>0</votes>
                                    <watches>11</watches>
                                                                                                                <comments>
                            <comment id="1152783" author="ramon.fernandez" created="Mon, 25 Jan 2016 16:53:37 +0000"  >&lt;p&gt;Closing as a duplicate of &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-20306&quot; title=&quot;75% excess memory usage under WiredTiger during stress test&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-20306&quot;&gt;&lt;del&gt;SERVER-20306&lt;/del&gt;&lt;/a&gt; after Bruce&apos;s analysis above.&lt;/p&gt;</comment>
                            <comment id="1116414" author="nick@innsenroute.com" created="Wed, 16 Dec 2015 20:13:08 +0000"  >&lt;p&gt;Great - thanks for the analysis.&lt;/p&gt;</comment>
                            <comment id="1116376" author="bruce.lucas@10gen.com" created="Wed, 16 Dec 2015 19:47:09 +0000"  >&lt;p&gt;Thanks Nick. Here&apos;s what we see in the stats:&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;image-wrap&quot; style=&quot;&quot;&gt;&lt;img src=&quot;https://jira.mongodb.org/secure/attachment/102529/102529_memory.png&quot; width=&quot;800&quot; style=&quot;border: 0px solid black&quot; /&gt;&lt;/span&gt;&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;virtual memory fairly quickly climbs to about 6.5 GB and levels off&lt;/li&gt;
	&lt;li&gt;of that about 6 GB or so is in the tcmalloc heap, of which
	&lt;ul&gt;
		&lt;li&gt;the amount currently allocated ranges from 3-4 GB, mostly memory in the WT cache&lt;/li&gt;
		&lt;li&gt;the remaining 2-3 GB is in one of two tcmalloc free areas (central cache and pageheap)&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Zooming in on an early part of the run:&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;image-wrap&quot; style=&quot;&quot;&gt;&lt;img src=&quot;https://jira.mongodb.org/secure/attachment/102530/102530_memory-early.png&quot; width=&quot;800&quot; style=&quot;border: 0px solid black&quot; /&gt;&lt;/span&gt;&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;up until about A we mostly see a well-behaved allocation arena: the heap size isn&apos;t much above the highwater mark of allocated memory, meaning we are effectively recycling freed memory.&lt;/li&gt;
	&lt;li&gt;starting around A, we see current allocated bytes remain about constant, because the cache is full, limiting the amount of memory that needs to be allocated.&lt;/li&gt;
	&lt;li&gt;but starting at about A, then especially at B, even though the amount of allocated memory is remaining constant, we see the tcmalloc heap size increase, which is accounted for by the free memory.&lt;/li&gt;
	&lt;li&gt;coinciding with this we see data being read into the cache.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;This I believe is a sign of memory fragmentation: as memory is freed to evict data from the cache in order to make room to read new data in, the blocks that are freed aren&apos;t usable for the data being read in, so they remain on the free list and new memory is obtained. This appears to be to be an instance of &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-20306&quot; title=&quot;75% excess memory usage under WiredTiger during stress test&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-20306&quot;&gt;&lt;del&gt;SERVER-20306&lt;/del&gt;&lt;/a&gt; (which is currently planned to be addressed in 3.4). In this case the data being read into the cache is for the oplog, which explains why you see this behavior with a replica set but not standalone.&lt;/p&gt;

&lt;p&gt;Bruce&lt;/p&gt;</comment>
                            <comment id="1116194" author="nick@innsenroute.com" created="Wed, 16 Dec 2015 16:36:35 +0000"  >&lt;p&gt;Here is the result of half of my test run. WT configured for 4GB, mongod &amp;gt; 6.&lt;/p&gt;</comment>
                            <comment id="1110865" author="bruce.lucas@10gen.com" created="Thu, 10 Dec 2015 16:36:29 +0000"  >&lt;p&gt;Hi Nick,&lt;/p&gt;

&lt;p&gt;Can you please tar and attach to this ticket the $dbpath/diagnostic.data directory from the instance that showed the issue? This will contain data that will help us understand the reason for the excess memory usage.&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Bruce&lt;/p&gt;</comment>
                            <comment id="1110853" author="nick@innsenroute.com" created="Thu, 10 Dec 2015 16:29:13 +0000"  >&lt;p&gt;Hi Wan,&lt;/p&gt;

&lt;p&gt;Imagine I&apos;m provisioning a system which contains my software and Mongo (using WT). Let&apos;s say this system has 8G RAM and I need to leave 1GB for the OS, and 4GB for my application. This means I need to cap WT to around 3G. Running mongo as a stand-alone, I can do this, but running as part of a replica set, it appears I need to account for some extra usage. Is there a way to reasonably calculate this extra usage?&lt;/p&gt;

&lt;p&gt;I&apos;m not saying the --wiredTigerCacheSizeGB should account for everything (clearly it is WT only), but it would be nice to have a guide/docs for this scenario.&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;W2012&lt;/li&gt;
	&lt;li&gt;Measured in task mgr.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Nick.&lt;/p&gt;</comment>
                            <comment id="1110444" author="wan.bachtiar" created="Thu, 10 Dec 2015 07:41:24 +0000"  >&lt;p&gt;Hi Nick, &lt;/p&gt;

&lt;p&gt;As noted in MongoDB documentation, the &lt;a href=&quot;https://docs.mongodb.org/manual/reference/program/mongod/#cmdoption--wiredTigerCacheSizeGB&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;--wiredTigerCacheSizeGB&lt;/tt&gt;&lt;/a&gt; only limits the size of the WiredTiger cache, not the total amount of memory used by &lt;tt&gt;mongod&lt;/tt&gt;. The WiredTiger cache is only one component of the RAM used by MongoDB. &lt;/p&gt;

&lt;p&gt;To better understand your test: &lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;What is the specific Windows version ?&lt;/li&gt;
	&lt;li&gt;How do you measure the memory usage ? i.e. RAMMap, etc.&lt;/li&gt;
&lt;/ul&gt;



&lt;p&gt;Kind regards, &lt;br/&gt;
Wan&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                        <issuelink>
            <issuekey id="228592">SERVER-20306</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="102530" name="memory-early.png" size="170823" author="bruce.lucas@mongodb.com" created="Wed, 16 Dec 2015 19:45:23 +0000"/>
                            <attachment id="102529" name="memory.png" size="177761" author="bruce.lucas@mongodb.com" created="Wed, 16 Dec 2015 19:45:23 +0000"/>
                            <attachment id="102476" name="metrics.2015-12-16T05-49-34Z-00000" size="9907935" author="nick@innsenroute.com" created="Wed, 16 Dec 2015 16:36:34 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>7.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Thu, 10 Dec 2015 07:41:24 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        8 years, 3 weeks, 2 days 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>
                            8 years, 3 weeks, 2 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <customfield id="customfield_10032" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Operating System</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10026"><![CDATA[ALL]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>bruce.lucas@mongodb.com</customfieldvalue>
            <customfieldvalue>nick@innsenroute.com</customfieldvalue>
            <customfieldvalue>ramon.fernandez@mongodb.com</customfieldvalue>
            <customfieldvalue>wan.bachtiar@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrkml3:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hsewkf:</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_10750" key="com.atlassian.jira.plugin.system.customfieldtypes:textarea">
                        <customfieldname>Steps To Reproduce</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>&lt;p&gt;3 node replica set on Windows (2 replicas and one arb).&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|hrj04f:</customfieldvalue>

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