<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 06:45:49 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-81201] Limiting the memory usage during the cloning phase on the recipient shard</title>
                <link>https://jira.mongodb.org/browse/SERVER-81201</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;As part of PM-3014 (and its backports to 5.0/6.0 done under PM-3001) we changed the amount of memory used during the cloning phase on the recipient shard, going from a constant amount to a variable one that depends on the speed of fetching data (producer) and locally inserting it (consumer).&lt;/p&gt;

&lt;p&gt;Cloning a chunk of 80GB we saw spikes of memory of 52GB.&lt;/p&gt;</description>
                <environment></environment>
        <key id="2446089">SERVER-81201</key>
            <summary>Limiting the memory usage during the cloning phase on the recipient shard</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</type>
                                            <priority id="2" iconUrl="https://jira.mongodb.org/images/icons/priorities/critical.svg">Critical - P2</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="13201">Fixed</resolution>
                                        <assignee username="randolph@mongodb.com">Randolph Tan</assignee>
                                    <reporter username="sergi.mateo-bellido@mongodb.com">Sergi Mateo Bellido</reporter>
                        <labels>
                    </labels>
                <created>Tue, 19 Sep 2023 16:23:09 +0000</created>
                <updated>Thu, 9 Nov 2023 23:28:45 +0000</updated>
                            <resolved>Fri, 29 Sep 2023 21:22:35 +0000</resolved>
                                    <version>7.0.0</version>
                    <version>6.0.5</version>
                    <version>7.1.0-rc0</version>
                    <version>5.0.16</version>
                                    <fixVersion>7.1.1</fixVersion>
                    <fixVersion>7.2.0-rc0</fixVersion>
                    <fixVersion>5.0.22</fixVersion>
                    <fixVersion>7.0.3</fixVersion>
                    <fixVersion>6.0.12</fixVersion>
                                                        <votes>0</votes>
                                    <watches>9</watches>
                                                                                                                <comments>
                            <comment id="5793257" author="xgen-internal-githook" created="Fri, 20 Oct 2023 00:32:32 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;Randolph Tan&apos;, &apos;email&apos;: &apos;randolph@10gen.com&apos;, &apos;username&apos;: &apos;renctan&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-81201&quot; title=&quot;Limiting the memory usage during the cloning phase on the recipient shard&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-81201&quot;&gt;&lt;del&gt;SERVER-81201&lt;/del&gt;&lt;/a&gt; Add a way to limit the documents buffered by the MigrationBatchFetcher&lt;/p&gt;

&lt;p&gt;(cherry picked from commit 6d6506f4bad7bbb72e16c6f5fc3ca74475f66e2b)&lt;br/&gt;
Branch: v7.1&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/707cc90d9c4229867e08d04b77e382e656e01efb&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/707cc90d9c4229867e08d04b77e382e656e01efb&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="5778096" author="xgen-internal-githook" created="Fri, 13 Oct 2023 23:55:38 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;Randolph Tan&apos;, &apos;email&apos;: &apos;randolph@10gen.com&apos;, &apos;username&apos;: &apos;renctan&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-81201&quot; title=&quot;Limiting the memory usage during the cloning phase on the recipient shard&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-81201&quot;&gt;&lt;del&gt;SERVER-81201&lt;/del&gt;&lt;/a&gt; Add a way to limit the documents buffered by the MigrationBatchFetcher&lt;/p&gt;

&lt;p&gt;(cherry picked from commit cbef5c88d77886cb62b085f43d495a0c2af7b6af)&lt;br/&gt;
Branch: v5.0&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/14d6cb87c04646b9d009422b9ceac6c2fab03cc2&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/14d6cb87c04646b9d009422b9ceac6c2fab03cc2&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="5777853" author="xgen-internal-githook" created="Fri, 13 Oct 2023 20:50:47 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;Randolph Tan&apos;, &apos;email&apos;: &apos;randolph@10gen.com&apos;, &apos;username&apos;: &apos;renctan&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-81201&quot; title=&quot;Limiting the memory usage during the cloning phase on the recipient shard&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-81201&quot;&gt;&lt;del&gt;SERVER-81201&lt;/del&gt;&lt;/a&gt; Add a way to limit the documents buffered by the MigrationBatchFetcher&lt;/p&gt;

&lt;p&gt;(cherry picked from commit 957e3523d76a8ce45188021fa51a7fb28f2aecb7)&lt;br/&gt;
Branch: v6.0&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/cbef5c88d77886cb62b085f43d495a0c2af7b6af&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/cbef5c88d77886cb62b085f43d495a0c2af7b6af&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="5777402" author="xgen-internal-githook" created="Fri, 13 Oct 2023 18:01:16 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;Randolph Tan&apos;, &apos;email&apos;: &apos;randolph@10gen.com&apos;, &apos;username&apos;: &apos;renctan&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-81201&quot; title=&quot;Limiting the memory usage during the cloning phase on the recipient shard&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-81201&quot;&gt;&lt;del&gt;SERVER-81201&lt;/del&gt;&lt;/a&gt; Add a way to limit the documents buffered by the MigrationBatchFetcher&lt;/p&gt;

&lt;p&gt;(cherry picked from commit 6d6506f4bad7bbb72e16c6f5fc3ca74475f66e2b)&lt;br/&gt;
Branch: v7.0&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/957e3523d76a8ce45188021fa51a7fb28f2aecb7&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/957e3523d76a8ce45188021fa51a7fb28f2aecb7&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="5750124" author="garaudy.etienne" created="Tue, 3 Oct 2023 20:58:21 +0000"  >&lt;p&gt;are we backporting this?&lt;/p&gt;</comment>
                            <comment id="5742081" author="xgen-internal-githook" created="Fri, 29 Sep 2023 21:19:40 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;Randolph Tan&apos;, &apos;email&apos;: &apos;randolph@10gen.com&apos;, &apos;username&apos;: &apos;renctan&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-81201&quot; title=&quot;Limiting the memory usage during the cloning phase on the recipient shard&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-81201&quot;&gt;&lt;del&gt;SERVER-81201&lt;/del&gt;&lt;/a&gt; Add a way to limit the documents buffered by the MigrationBatchFetcher&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/6d6506f4bad7bbb72e16c6f5fc3ca74475f66e2b&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/6d6506f4bad7bbb72e16c6f5fc3ca74475f66e2b&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="5716675" author="max.hirschhorn@10gen.com" created="Wed, 20 Sep 2023 00:24:22 +0000"  >&lt;p&gt;In MongoDB 4.4 and in versions of MongoDB prior to &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-67183&quot; title=&quot;Higher throughput Chunk Migration - reimplement for fetching and insertion&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-67183&quot;&gt;&lt;del&gt;SERVER-67183&lt;/del&gt;&lt;/a&gt;, &lt;a href=&quot;https://github.com/mongodb/mongo/blob/r4.4.24/src/mongo/db/s/migration_destination_manager.cpp#L481&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;the MigrationDestinationManager would its configure &lt;tt&gt;maxQueueDepth == 1&lt;/tt&gt;&lt;/a&gt; and would limit the number of &amp;#95;migrateClone batches kept in memory on the recipient shard. More specifically, &lt;tt&gt;maxQueueDepth == 1&lt;/tt&gt; means:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;at most 1 &amp;#95;migrateClone command pending on the donor shard / being received by the recipient shard,&lt;/li&gt;
	&lt;li&gt;at most 1 &amp;#95;migrateClone result buffered in the queue,&lt;/li&gt;
	&lt;li&gt;at most 1 &amp;#95;migrateClone result popped from the queue and being inserted (there&apos;s only 1 insert thread in MongoDB 4.4 and in versions of MongoDB prior to &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-67183&quot; title=&quot;Higher throughput Chunk Migration - reimplement for fetching and insertion&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-67183&quot;&gt;&lt;del&gt;SERVER-67183&lt;/del&gt;&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Given how the &amp;#95;migrateClone result is a standard command response of at most 16MB, there can in total be at most 3&amp;#42;16MB == 48MB used on the recipient shard to represent the &amp;#95;migrateClone results.&lt;/p&gt;

&lt;p&gt;The MigrationBatchFetcher doesn&apos;t have an equivalent to limiting the number of &amp;#95;migrateClone results buffered in the queue. This leads &lt;a href=&quot;https://github.com/mongodb/mongo/blob/7caff9c00c6bc56b55107b1ef1b10a14c2f50516/src/mongo/db/s/migration_batch_fetcher.cpp#L163&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;the MigrationBatchFetcher to run &amp;#95;migrateClone as quickly as possible&lt;/a&gt; against the donor shard and hold many more &amp;#95;migrateClone results than before in memory at once.&lt;/p&gt;

&lt;p&gt;When running with &lt;tt&gt;chunkMigrationConcurrency == 1&lt;/tt&gt; we can reasonably expect fetching the documents to insert to outpace the rate of inserting documents. But at &lt;tt&gt;chunkMigrationConcurrency &amp;gt; 1&lt;/tt&gt; we may want to have multiple &amp;#95;migrateClone results buffered in the queue. We should define some limit for the memory usage of the MigrationBatchFetcher and MigrationBatchInserter to avoid overwhelming the recipient shard.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10420">
                    <name>Backports</name>
                                            <outwardlinks description="backported by">
                                                        </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10520">
                    <name>Problem/Incident</name>
                                                                <inwardlinks description="is caused by">
                                                        </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="2439642">SERVER-80977</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="2066034">SERVER-67183</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </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_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25134"><![CDATA[Sharding NYC]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12450" key="com.atlassian.jira.plugin.system.customfieldtypes:multicheckboxes">
                        <customfieldname>Backport Requested</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25578"><![CDATA[v7.0]]></customfieldvalue>
    <customfieldvalue key="23470"><![CDATA[v6.0]]></customfieldvalue>
    <customfieldvalue key="21777"><![CDATA[v5.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>Wed, 20 Sep 2023 00:24:22 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        15 weeks, 6 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_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>maria.prinus@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            15 weeks, 6 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>garaudy.etienne@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>max.hirschhorn@mongodb.com</customfieldvalue>
            <customfieldvalue>randolph@mongodb.com</customfieldvalue>
            <customfieldvalue>sergi.mateo-bellido@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i2r7hr:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|i295uc:</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_22250" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Special Downgrade Instructions Required</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="23343"><![CDATA[Not Needed]]></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|i2qtn3:</customfieldvalue>

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