<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 06:14:45 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-69905] Improve ServiceExecutorSynchronous worker threads</title>
                <link>https://jira.mongodb.org/browse/SERVER-69905</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;ServiceExecutorSynchronous creates worker threads when a client calls schedule on it to initiate a task chain. If the task calls schedule while it&apos;s executing, that task is enqueued to the worker thread. The worker stops when the queue is empty.&lt;/p&gt;

&lt;p&gt;Issues with this:&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;Uses pthread instead of stdx::thread, so we have two kinds of threads in the system. This is done to control the stack size, but we should be okay to just use the default stack size on 64-bit systems. The stack size is tweaked as a canary for finding deep stack usage in tests, but I think this benefit is very small and we could measure high water mark in other ways.&lt;/li&gt;
&lt;/ul&gt;


&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;Worker threads are detached, which makes synchronization and thread_local management very difficult. It also means they can run during process exit and can cause interference between unit test scenarios. Detached threads should be avoided if possible. We&apos;re already trying to synchronize on the end of these threads&apos; callable function in order to update stats and join the executor, so detaching is kind of pointless.&lt;/li&gt;
&lt;/ul&gt;


&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;(sub-task &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-70145&quot; title=&quot;reuse threads in ServiceExecutorSynchronous&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-70145&quot;&gt;&lt;del&gt;SERVER-70145&lt;/del&gt;&lt;/a&gt;) The biggest issue is that this executor makes a fresh thread for each toplevel task.  The contract of this scheduler is that a toplevel task gets a dedicated thread, but it is not promising a FRESH brand new thread, only a dedicated one. So when the toplevel task completes, the worker thread should be reusable. But we don&apos;t reuse it. We let it exit and just make new threads for each connection. This seems extremely wasteful and we should just pool these workers and hand out leases to them. Essentially this is not so different from an ordinary ThreadPool except that the threads are different kinds of objects from the stdx::thread objects managed by ThreadPool.&lt;/li&gt;
&lt;/ul&gt;


&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;We could be using boost::thread for the stack size control instead of raw pthreads.&lt;/li&gt;
&lt;/ul&gt;
</description>
                <environment></environment>
        <key id="2143424">SERVER-69905</key>
            <summary>Improve ServiceExecutorSynchronous worker threads</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-servicearch">Backlog - Service Architecture</assignee>
                                    <reporter username="billy.donahue@mongodb.com">Billy Donahue</reporter>
                        <labels>
                    </labels>
                <created>Thu, 22 Sep 2022 16:16:26 +0000</created>
                <updated>Fri, 20 Jan 2023 01:04:28 +0000</updated>
                                                                                                <votes>0</votes>
                                    <watches>6</watches>
                                                                                                                                                            <comments>
                            <comment id="5019115" author="billy.donahue" created="Wed, 30 Nov 2022 15:59:51 +0000"  >&lt;p&gt;The min and max worker bucket idea (subtask &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-70145&quot; title=&quot;reuse threads in ServiceExecutorSynchronous&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-70145&quot;&gt;&lt;del&gt;SERVER-70145&lt;/del&gt;&lt;/a&gt; ) was done as part of &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-70151&quot; title=&quot;ServiceExecutorSynchronous thread_local-related leaks (revert)&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-70151&quot;&gt;&lt;del&gt;SERVER-70151&lt;/del&gt;&lt;/a&gt;, because without it, that ticket is a net speed penalty. This optimization is easy to do and buys back the 2x slowdown with a 10X speedup, so net impact should be something like a 5X speedup.&lt;/p&gt;</comment>
                            <comment id="4942260" author="billy.donahue" created="Mon, 31 Oct 2022 21:37:24 +0000"  >&lt;p&gt;Consider the discussion about establishing a min and max worker bucket sizes for the SESynchronous from this code review for &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-70151&quot; title=&quot;ServiceExecutorSynchronous thread_local-related leaks (revert)&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-70151&quot;&gt;&lt;del&gt;SERVER-70151&lt;/del&gt;&lt;/a&gt;, which was left as follow-up work. &lt;a href=&quot;https://github.com/10gen/mongo/pull/7886#discussion_r1005397198&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/10gen/mongo/pull/7886#discussion_r1005397198&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="2149442">SERVER-70151</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="2003477">SERVER-64594</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="2003367">SERVER-64584</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="417978">SERVER-30738</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                            <subtask id="2149322">SERVER-70145</subtask>
                            <subtask id="2199607">SERVER-71760</subtask>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>6.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25132"><![CDATA[Service Arch]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        1 year, 10 weeks ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></customfieldvalue>


                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>dbeng-pm-bot</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            1 year, 10 weeks ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>backlog-server-servicearch</customfieldvalue>
            <customfieldvalue>billy.donahue@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i1be2n:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|i0ood0:</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_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="6160">Service Arch 2022-12-26</customfieldvalue>
    <customfieldvalue id="6575">Service Arch 2022-10-17</customfieldvalue>
    <customfieldvalue id="6577">Service Arch 2022-11-14</customfieldvalue>
    <customfieldvalue id="6578">Service Arch 2022-11-28</customfieldvalue>
    <customfieldvalue id="6746">Service Arch 2022-12-12</customfieldvalue>
    <customfieldvalue id="6747">Service Arch 2023-01-09</customfieldvalue>

                        </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|i1b07z:</customfieldvalue>

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