<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 06:37:03 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-77942] Performance regressions in $graphLookup due to makePipeline</title>
                <link>https://jira.mongodb.org/browse/SERVER-77942</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Mongo-perf shows +15% in the LookupViaGraphLookup test between 6.0 and 7.0 and I believe it to be caused by various slowdowns under mongo::pipeline::makePipeline. Notably, 7.0 spends more time under mongo::getExecutor and dealing with AutoGetCollectionForReadCommandMaybeLockFree but, unfortunately, there is no single point of regression.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/BF-28421&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/BF-28421&lt;/a&gt; concerns some other Lookup related benchmarks but claims them to be not representative of real use cases. I don&apos;t think the same reasoning would apply to LookupViaGraphLookup as I can repro the regression on a collection that represents a binary tree via a parent link, trying to output direct children of each node &#8211; a typical scenario in hierarchical datasets.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/BF-28050&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/BF-28050&lt;/a&gt; is another ticket related to regressions in Lookup. It&apos;s not marked as 7.0 blocker (because the regression isn&apos;t severe anymore after &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-75853&quot; title=&quot;Have hasOnlyRenameableMatchExpressionChildren() examine renames would succeed&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-75853&quot;&gt;&lt;del&gt;SERVER-75853&lt;/del&gt;&lt;/a&gt;?) and doesn&apos;t look like it has been investigated beyond &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-75853&quot; title=&quot;Have hasOnlyRenameableMatchExpressionChildren() examine renames would succeed&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-75853&quot;&gt;&lt;del&gt;SERVER-75853&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;GraphLookup is sensitive to slowdowns under makePipeline() because it might call the method a lot: (per my observations, I haven&apos;t spend much time reading the implementation) as many times as there are matched unique values for the &quot;connectFromField&quot; in local collection plus as many documents in local that don&apos;t match to anything.&lt;/p&gt;

&lt;p&gt;Relevant tests in mongo-perf:&lt;/p&gt;
&lt;div class=&apos;table-wrap&apos;&gt;
&lt;table class=&apos;confluenceTable&apos;&gt;&lt;tbody&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;Aggregation.LookupViaGraphLookup&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;Aggregation.GraphLookupNeighbors&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;Aggregation.IdentityView.LookupViaGraphLookup&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;Aggregation.IdentityView.GraphLookupNeighbors&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;Aggregation.GraphLookupSocialite&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;Aggregation.IdentityView.GraphLookupSocialite&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;


&lt;p&gt;&lt;a href=&quot;https://evergreen.mongodb.com/task/sys_perf_6.0_linux_microbenchmarks_standalone_intel.2023_01_aggregation_read_commands_3b9ef88e5a613a7f5c62fb2d0c847482c6a5d85a_23_06_02_14_06_07&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://evergreen.mongodb.com/task/sys_perf_6.0_linux_microbenchmarks_standalone_intel.2023_01_aggregation_read_commands_3b9ef88e5a613a7f5c62fb2d0c847482c6a5d85a_23_06_02_14_06_07&lt;/a&gt;&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/455234/455234_image-2023-06-09-06-46-19-142.png&quot; height=&quot;428&quot; width=&quot;1139&quot; style=&quot;border: 0px solid black&quot; /&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://evergreen.mongodb.com/task/sys_perf_7.0_linux_microbenchmarks_standalone_intel.2023_01_aggregation_read_commands_e54a7ebb88c7c922e9f817e7c23a4b16fcf288af_23_06_02_20_31_12&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://evergreen.mongodb.com/task/sys_perf_7.0_linux_microbenchmarks_standalone_intel.2023_01_aggregation_read_commands_e54a7ebb88c7c922e9f817e7c23a4b16fcf288af_23_06_02_20_31_12&lt;/a&gt;&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/455232/455232_image-2023-06-09-06-45-27-383.png&quot; height=&quot;476&quot; width=&quot;1209&quot; style=&quot;border: 0px solid black&quot; /&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</description>
                <environment></environment>
        <key id="2363943">SERVER-77942</key>
            <summary>Performance regressions in $graphLookup due to makePipeline</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="10038" iconUrl="https://jira.mongodb.org/images/icons/subtask.gif" description="">Backlog</status>
                    <statusCategory id="2" key="new" colorName="default"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="backlog-query-execution">Backlog - Query Execution</assignee>
                                    <reporter username="irina.yatsenko@mongodb.com">Irina Yatsenko</reporter>
                        <labels>
                            <label>qe-perf-90</label>
                    </labels>
                <created>Fri, 9 Jun 2023 13:41:49 +0000</created>
                <updated>Thu, 18 Jan 2024 21:52:55 +0000</updated>
                                                                                                <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="5487997" author="JIRAUSER1259274" created="Fri, 9 Jun 2023 14:03:08 +0000"  >&lt;p&gt;Profiled &quot;for(let i = 0; i &amp;lt; 250; i++) {res = db.l.aggregate(&lt;span class=&quot;error&quot;&gt;&amp;#91;{$graphLookup: {from: &amp;quot;f&amp;quot;, startWith: &amp;quot;$fkey&amp;quot;, connectFromField: &amp;quot;fkey&amp;quot;, connectToField: &amp;quot;_id&amp;quot;, as: &amp;quot;match&amp;quot;}}&amp;#93;&lt;/span&gt;).toArray();}&quot; (where &quot;l&quot; consists of {_id: i, fkey: i} and f &#8211; of {_id: i}, both with 100 docs like in the mongo-perf benchmark, i increments from 0 to 99):&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;6.0&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;Samples: 19K of event &apos;cpu-cycles&apos;&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;57.89% &#160; &#160;57.89% &#160; &#160; &#160; &#160; 10727 &#160;mongod &#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;error&quot;&gt;&amp;#91;.&amp;#93;&lt;/span&gt; mongo::Pipeline::makePipeline&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; 6.53% &#160; &#160; 6.53% &#160; &#160; &#160; &#160; &#160;1206 &#160;mongod &#160; &#160; &#160; &#160; &#160; &#160; &#160;&lt;span class=&quot;error&quot;&gt;&amp;#91;.&amp;#93;&lt;/span&gt; mongo::Pipeline::parseCommon&amp;lt;mongo::BSONObj&amp;gt;&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; 1.54% &#160; &#160; 1.54% &#160; &#160; &#160; &#160; &#160; 284 &#160;mongod &#160; &#160; &#160; &#160; &#160; &#160; &#160;&lt;span class=&quot;error&quot;&gt;&amp;#91;.&amp;#93;&lt;/span&gt; mongo::Pipeline::optimizePipeline&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; 32.70% &#160; &#160;32.70% &#160; &#160; &#160; &#160; &#160; 6065 &#160;mongod &#160; &#160; &#160; &#160; &#160; &#160; &#160;&lt;span class=&quot;error&quot;&gt;&amp;#91;.&amp;#93;&lt;/span&gt; mongo::PipelineD::buildInnerQueryExecutorGeneric&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; &#160; 25.22% &#160; &#160;25.22% &#160; &#160; &#160; &#160; &#160;4681 &#160;mongod &#160; &#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;error&quot;&gt;&amp;#91;.&amp;#93;&lt;/span&gt; mongo::getExecutor&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; &#160; &#160; 13.66% &#160; &#160;13.66% &#160; &#160; &#160; &#160; &#160;2532 &#160;mongod &#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;error&quot;&gt;&amp;#91;.&amp;#93;&lt;/span&gt; mongo::QueryPlanner::plan&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; &#160; 4.26% &#160; &#160; 4.26% &#160; &#160; &#160; &#160; &#160; 788 &#160;mongod &#160; &#160; &#160; &#160; &#160; &#160; &#160;&lt;span class=&quot;error&quot;&gt;&amp;#91;.&amp;#93;&lt;/span&gt; mongo::CanonicalQuery::canonicalize&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; 8.97% &#160; &#160; 8.97% &#160; &#160; &#160; &#160; &#160;1661 &#160;mongod &#160; &#160; &#160; &#160; &#160; &#160; &#160;&lt;span class=&quot;error&quot;&gt;&amp;#91;.&amp;#93;&lt;/span&gt; mongo::AutoGetCollectionForReadCommandMaybeLockFree::AutoGetCollectionForReadCommandMaybeLockFree&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; 2.77% &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;mongod &#160; &#160; &#160; &#160; &#160; &#160; &#160;&lt;span class=&quot;error&quot;&gt;&amp;#91;.&amp;#93;&lt;/span&gt; mongo::AutoGetCollectionForReadCommandMaybeLockFree::~AutoGetCollectionForReadCommandMaybeLockFree&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;7.0&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;Samples: 25K of event &apos;cpu-cycles&apos;&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;59.07% &#160; &#160;59.07% &#160; &#160; &#160; &#160; 14565 &#160;mongod &#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;error&quot;&gt;&amp;#91;.&amp;#93;&lt;/span&gt; mongo::Pipeline::makePipeline // +3838 samples&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; 5.96% &#160; &#160; 5.96% &#160; &#160; &#160; &#160; &#160;1482 &#160;mongod &#160; &#160; &#160; &#160; &#160; &#160; &#160;&lt;span class=&quot;error&quot;&gt;&amp;#91;.&amp;#93;&lt;/span&gt; mongo::Pipeline::parseCommon&amp;lt;mongo::BSONObj&amp;gt; // +276&#160;&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; 1.73% &#160; &#160; 1.73% &#160; &#160; &#160; &#160; &#160; 426 &#160;mongod &#160; &#160; &#160; &#160; &#160; &#160; &#160;&lt;span class=&quot;error&quot;&gt;&amp;#91;.&amp;#93;&lt;/span&gt; mongo::Pipeline::optimizePipeline // +142&#160;&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; 32.30% &#160; &#160;32.30% &#160; &#160; &#160; &#160; &#160;7968 &#160;mongod &#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;error&quot;&gt;&amp;#91;.&amp;#93;&lt;/span&gt; mongo::PipelineD::buildInnerQueryExecutorGeneric // +1903 &#160;&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; &#160; 24.26% &#160; &#160;24.26% &#160; &#160; &#160; &#160; 5990 &#160;mongod &#160; &#160; &#160; &#160; &#160; &#160; &#160;&lt;span class=&quot;error&quot;&gt;&amp;#91;.&amp;#93;&lt;/span&gt; mongo::getExecutor // +1309&#160;&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; &#160; &#160; 13.24% &#160; &#160;13.24% &#160; &#160; &#160; &#160; 3259 &#160;mongod &#160; &#160; &#160; &#160; &#160; &#160; &#160;&lt;span class=&quot;error&quot;&gt;&amp;#91;.&amp;#93;&lt;/span&gt; mongo::QueryPlanner::plan // +727&#160;&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; &#160; 4.81% &#160; &#160; 4.81% &#160; &#160; &#160; &#160; &#160;1180 &#160;mongod &#160; &#160; &#160; &#160; &#160; &#160; &#160;&lt;span class=&quot;error&quot;&gt;&amp;#91;.&amp;#93;&lt;/span&gt; mongo::CanonicalQuery::canonicalize // +392&#160;&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; 9.75% &#160; &#160; 9.75% &#160; &#160; &#160; &#160; &#160;2407 &#160;mongod &#160; &#160; &#160; &#160; &#160; &#160; &#160;&lt;span class=&quot;error&quot;&gt;&amp;#91;.&amp;#93;&lt;/span&gt; mongo::AutoGetCollectionForReadCommandMaybeLockFree::AutoGetColl&#8230; // +746&#160;&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;&#160; 3.56% &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;mongod &#160; &#160; &#160; &#160; &#160; &#160; &#160;&lt;span class=&quot;error&quot;&gt;&amp;#91;.&amp;#93;&lt;/span&gt; boost::optional_detail::optional_base&amp;lt;mongo::AutoGetCollectionForReadCommandMaybeLockFree&amp;gt;::destroy_impl&lt;/tt&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10620">
                    <name>Issue split</name>
                                                                <inwardlinks description="split from">
                                                        </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="2453567">SERVER-81521</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                                        </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="455232" name="image-2023-06-09-06-45-27-383.png" size="54277" author="irina.yatsenko@mongodb.com" created="Fri, 9 Jun 2023 13:45:28 +0000"/>
                            <attachment id="455234" name="image-2023-06-09-06-46-19-142.png" size="48564" author="irina.yatsenko@mongodb.com" created="Fri, 9 Jun 2023 13:46:20 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                <customfield id="customfield_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25125"><![CDATA[Query Execution]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        34 weeks, 5 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_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>PM-3621</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>chris.hutchinson@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            34 weeks, 5 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>backlog-query-execution</customfieldvalue>
            <customfieldvalue>irina.yatsenko@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i2d4wn:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|i1vcts:</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_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|i2cr1z:</customfieldvalue>

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