<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:49:59 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-60512] Do not need to use atomically ref-counted buffer for SharedBufferFragment</title>
                <link>https://jira.mongodb.org/browse/SERVER-60512</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;The &lt;a href=&quot;https://github.com/mongodb/mongo/blob/e9e18132e3342afd815033e7629041c37c07118b/src/mongo/util/shared_buffer_fragment.h#L94&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;SharedBufferFragmentBuilder&lt;/a&gt; is designed to be a per-thread memory pool for allocating temporary buffers. &lt;/p&gt;

&lt;p&gt;It does so using an atomically reference counted &lt;a href=&quot;https://github.com/mongodb/mongo/blob/e9e18132e3342afd815033e7629041c37c07118b/src/mongo/util/shared_buffer_fragment.h#L194&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;SharedBuffer&lt;/a&gt;. This shows up around 2% of the time spent building an index.&lt;/p&gt;

&lt;p&gt;Since this builder is designed to be used in a single-threaded context, we should consider redesigning this builder to not share ownership if possible.&lt;/p&gt;</description>
                <environment></environment>
        <key id="1892005">SERVER-60512</key>
            <summary>Do not need to use atomically ref-counted buffer for SharedBufferFragment</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</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-server-execution">Backlog - Storage Execution Team</assignee>
                                    <reporter username="louis.williams@mongodb.com">Louis Williams</reporter>
                        <labels>
                            <label>perf-improvement</label>
                            <label>techdebt</label>
                    </labels>
                <created>Wed, 6 Oct 2021 21:01:44 +0000</created>
                <updated>Tue, 3 Jan 2023 18:24:39 +0000</updated>
                                                                                                <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="4119606" author="acm" created="Tue, 12 Oct 2021 18:05:10 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=louis.williams&quot; class=&quot;user-hover&quot; rel=&quot;louis.williams&quot;&gt;louis.williams&lt;/a&gt; - Thanks for that clarification; what you described makes sense and removes my concerns.&lt;/p&gt;</comment>
                            <comment id="4119205" author="louis.williams" created="Tue, 12 Oct 2021 16:01:50 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=acm&quot; class=&quot;user-hover&quot; rel=&quot;acm&quot;&gt;acm&lt;/a&gt; the pool is &lt;a href=&quot;https://github.com/mongodb/mongo/blob/5b73e9d9102fc0c48d514ea43bfd0a8db9addc81/src/mongo/db/storage/execution_context.h#L56-L58&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;per-OperationContext&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You are correct that the memory is not bound to a thread with &quot;thread_local&quot;. The SharedBufferFragmentBuilder just allows an operation to reuse the same buffer without having to free and realloc when it&apos;s doing a lot of buffer construction. Also I realize now that the motivation in &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-47001&quot; title=&quot;Reduce number of small buffer allocations for index builds&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-47001&quot;&gt;&lt;del&gt;SERVER-47001&lt;/del&gt;&lt;/a&gt; does not reflect the outcome of the ticket, either. We do not generate one massive buffer and sort all of the keys inside that buffer. We only use the pool for the short-lived per-key generation.&lt;/p&gt;</comment>
                            <comment id="4118538" author="acm" created="Tue, 12 Oct 2021 13:23:31 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=louis.williams&quot; class=&quot;user-hover&quot; rel=&quot;louis.williams&quot;&gt;louis.williams&lt;/a&gt; - Perhaps I read to much into your use of &quot;per-thread&quot;, as, having looked through the commit for &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-47001&quot; title=&quot;Reduce number of small buffer allocations for index builds&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-47001&quot;&gt;&lt;del&gt;SERVER-47001&lt;/del&gt;&lt;/a&gt;, I don&apos;t immediately see anywhere that memory or a memory pool is being bound to a thread (e.g. with a `thread_local` or similar).  Can you confirm either way: are these pools actually &quot;per-thread&quot;?&lt;/p&gt;</comment>
                            <comment id="4110460" author="louis.williams" created="Thu, 7 Oct 2021 15:37:46 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=acm&quot; class=&quot;user-hover&quot; rel=&quot;acm&quot;&gt;acm&lt;/a&gt;, yeah this sped up our index build workload by 25%. See &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-47001&quot; title=&quot;Reduce number of small buffer allocations for index builds&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-47001&quot;&gt;&lt;del&gt;SERVER-47001&lt;/del&gt;&lt;/a&gt;. The problem is that even with tcmalloc, allocation is still not cheap. So we allocate one buffer and re-use it for key generation.&lt;/p&gt;</comment>
                            <comment id="4110428" author="acm" created="Thu, 7 Oct 2021 15:28:18 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=louis.williams&quot; class=&quot;user-hover&quot; rel=&quot;louis.williams&quot;&gt;louis.williams&lt;/a&gt; - I hadn&apos;t really focused on &lt;tt&gt;SharedBufferFragmentBuilder&lt;/tt&gt;, but the description of it raises some questions for me: in general, we already have per-thread caching of temporary buffers by way of tcmalloc. What was the motivation for adding yet another layer of per-thread buffer caching above that? Was a clear performance benefit demonstrated? Delegating responsibility for caching available buffers to the allocator is generally a better strategy, as it allows reuse across different roles, and also abstracts away the actual scope of caching. For instance, future versions of tcmalloc may do per-cpu caching, but if the &lt;tt&gt;SharedBufferFragmentAllocator&lt;/tt&gt; is still allocating per-thread, it will undermine the effectiveness of that strategy.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>5.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                <customfield id="customfield_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25136"><![CDATA[Storage Execution]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Thu, 7 Oct 2021 15:28:18 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        2 years, 17 weeks, 1 day 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>connie.chen@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            2 years, 17 weeks, 1 day ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>andrew.morrow@mongodb.com</customfieldvalue>
            <customfieldvalue>backlog-server-execution</customfieldvalue>
            <customfieldvalue>louis.williams@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i04mxb:</customfieldvalue>

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

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