<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:52:19 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>[JAVA-452] allow to modify the connection timeout for the maintenance thread</title>
                <link>https://jira.mongodb.org/browse/JAVA-452</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;&lt;a href=&quot;http://groups.google.com/group/mongodb-user/browse_thread/thread/edc5445822ca5f4c&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://groups.google.com/group/mongodb-user/browse_thread/thread/edc5445822ca5f4c&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;right now it&apos;s set to 20s and cannot be modified.&lt;br/&gt;
This may be too long for large replica sets.&lt;br/&gt;
Servers are tested sequentially and if a few are unreachable it can delay master failover etc.&lt;br/&gt;
Could be set by java property or do min(10s, MongoOptions.timeout)&lt;/p&gt;</description>
                <environment></environment>
        <key id="23762">JAVA-452</key>
            <summary>allow to modify the connection timeout for the maintenance thread</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="4" iconUrl="https://jira.mongodb.org/images/icons/priorities/minor.svg">Minor - P4</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="9">Done</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="antoine">Antoine Girbal</reporter>
                        <labels>
                    </labels>
                <created>Tue, 18 Oct 2011 16:36:47 +0000</created>
                <updated>Sun, 18 Aug 2013 17:14:05 +0000</updated>
                            <resolved>Sun, 18 Aug 2013 17:14:05 +0000</resolved>
                                                                    <component>Cluster Management</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="405760" author="jeff.yemin" created="Sun, 18 Aug 2013 17:14:05 +0000"  >&lt;p&gt;A system property was added for this a long time ago.&lt;/p&gt;</comment>
                            <comment id="97547" author="jeff.yemin" created="Sat, 10 Mar 2012 20:39:25 +0000"  >&lt;p&gt;Examined the source code a bit more closely, and it looks like you can control the timeouts for the replica set maintenance thread:&lt;/p&gt;

&lt;p&gt;    _mongoOptionsDefaults.connectTimeout = Integer.parseInt(System.getProperty(&quot;com.mongodb.updaterConnectTimeoutMS&quot;, &quot;20000&quot;));&lt;br/&gt;
    _mongoOptionsDefaults.socketTimeout = Integer.parseInt(System.getProperty(&quot;com.mongodb.updaterSocketTimeoutMS&quot;, &quot;20000&quot;));&lt;/p&gt;

&lt;p&gt;This is not the circuit breaker that you described, but it gives you some control at least.&lt;/p&gt;</comment>
                            <comment id="61176" author="antoine" created="Tue, 18 Oct 2011 17:28:47 +0000"  >&lt;p&gt;The maintenance thread runs in the background, so regular queries do not wait on it unless it&apos;s the 1st query ever to the driver.&lt;br/&gt;
Other queries will use valid master / slaves as detected by the maintenance thread.&lt;br/&gt;
So really the issue here is how long it can take to detect changes in server status, if some of the servers are not reachable.&lt;/p&gt;

&lt;p&gt;That being said I would not be surprised if some of our error handling code still try to update the master themselves, which could trigger a thread buildup as you describe.&lt;/p&gt;</comment>
                            <comment id="61172" author="fornellas" created="Tue, 18 Oct 2011 17:20:36 +0000"  >&lt;p&gt;Hello,&lt;/p&gt;

&lt;p&gt;The root problem I see, is that if you have some MongoDB unavailability (let&apos;s say due to a network issue), your queries will go from a couple tenths of milliseconds (eg. 20ms), to a few seconds (eg. 2s timeout). Since your QPS will be the same (users accessing the site), your concurrent connections will also be multiplied by the same factor (Little&apos;s law), in this case, by 100x. This will usually break all thread limits, from load balancer, Apache, Jetty, etc, and make the whole app unavailable. If you use an aggressive timeout, you might drop legit requests, since some small % of them will be slower at regular operation.&lt;/p&gt;

&lt;p&gt;Michael Nygard at his book &quot;Release It&quot; describe a way to fix this: implement a circuit breaker. This is, if the external resoruce is out, you fail fast, and give an immediate error. Even during an outage, you won&apos;t be slower, in fact, you will be faster. This avoids reaching the thread limits.&lt;/p&gt;

&lt;p&gt;Implementing a configurable timeout is better than having a 10s default, but might not holt the app up during an outage.&lt;/p&gt;

&lt;p&gt;Cheers.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrg2yf:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>7381</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>