<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:16:52 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-8224] when lots of web server,   there is too many connections</title>
                <link>https://jira.mongodb.org/browse/SERVER-8224</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;I hava 100 web server, each use nginx and php-fpm.&lt;br/&gt;
create 200 php-cgi process per web server.&lt;/p&gt;

&lt;p&gt;when i use persistent connection to mongos, there is 2w connections to mongos. &lt;br/&gt;
because mongos keep last connection, use avail(shard_version.cpp, shardconnection.cpp),&lt;/p&gt;

&lt;p&gt;there will be 2w connection from mongos to shard server. &lt;/p&gt;
</description>
                <environment>Linux  sharded cluster</environment>
        <key id="62526">SERVER-8224</key>
            <summary>when lots of web server,   there is too many connections</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</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="3">Duplicate</resolution>
                                        <assignee username="jmikola@mongodb.com">Jeremy Mikola</assignee>
                                    <reporter username="peanutgyz">peanutgyz</reporter>
                        <labels>
                    </labels>
                <created>Fri, 18 Jan 2013 02:30:15 +0000</created>
                <updated>Wed, 10 Dec 2014 23:05:53 +0000</updated>
                            <resolved>Fri, 22 Mar 2013 17:46:39 +0000</resolved>
                                    <version>2.2.2</version>
                                                    <component>Networking</component>
                    <component>Sharding</component>
                    <component>Usability</component>
                                        <votes>0</votes>
                                    <watches>5</watches>
                                                                                                                <comments>
                            <comment id="296019" author="jmikola@gmail.com" created="Fri, 22 Mar 2013 17:50:00 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=peanutgyz&quot; class=&quot;user-hover&quot; rel=&quot;peanutgyz&quot;&gt;peanutgyz&lt;/a&gt;: Just to follow up, there have been some recent improvements to mongos for releasing connections back to the pool (&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-9022&quot; title=&quot;Enable mongos mode which releases ShardConnections to the pool after read ops&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-9022&quot;&gt;&lt;del&gt;SERVER-9022&lt;/del&gt;&lt;/a&gt;). While PHP and its app server environment is still going to require more connections than other languages which implement pooling (e.g. Java, Python), you may see an improvement with this feature.&lt;/p&gt;</comment>
                            <comment id="247985" author="jmikola@gmail.com" created="Wed, 23 Jan 2013 21:03:27 +0000"  >&lt;p&gt;Within the scope of this issue, there is nothing to fix in mongos. As far as it&apos;s concerned, the connections are active and cannot be shared with other sessions. Once a PHP worker dies and releases its mongos connection, the mongod connections in mongos do return to the pool to be used again.&lt;/p&gt;

&lt;p&gt;Manually closing connections in the PHP driver is unlikely yield any improvement and may very well reduce performance, since the driver will not be able to re-use connections across the worker&apos;s lifetime. Each web request would correspond to a new mongos connection in that case, and at peak usage you may still see N connections to mongos where N is the number of PHP workers. The solution is to either reduce the number of worker processes, or redesign your application such that each web request does not require its own database connection (e.g. with caching).&lt;/p&gt;</comment>
                            <comment id="247440" author="peanutgyz" created="Wed, 23 Jan 2013 10:36:39 +0000"  >&lt;p&gt;i have more than 20000 php-fpm worker, so if php-fpm worker use persistent connection to mongos  there will be too many connections on mongod. &lt;/p&gt;

&lt;p&gt;should i close connnection in my php-wroker each time ?? &lt;/p&gt;

&lt;p&gt;Is there a plan to change mongos code,  so mongos can put connections back to  pool ? &lt;/p&gt;</comment>
                            <comment id="246740" author="jmikola@gmail.com" created="Tue, 22 Jan 2013 18:07:24 +0000"  >&lt;p&gt;While mongos does maintain a connection pool for mongod connections, those connections are utilized by a single mongos client connection until it is closed (i.e. by the PHP process/worker). Therefore, if you have 20,000 simultaneous web server connections, you can expect 20,000 connections for the mongod processes through all of the mongos processes combined. There will likely be a few more connections from mongos to each mongod, for sharding overhead and things like balancing.&lt;/p&gt;

&lt;p&gt;Limiting the worker processes, or abstracting your connections to mongos (e.g. application-level caching) will be necessary to keep under the 20,000 limit.&lt;/p&gt;</comment>
                            <comment id="245232" author="peanutgyz" created="Mon, 21 Jan 2013 02:35:01 +0000"  >&lt;p&gt; &quot;use avail(shard_version.cpp, shardconnection.cpp)&quot;   &lt;/p&gt;


&lt;p&gt;in source code, shardconnection.cpp,   each ShardConnection variable has one DBClientBase* avail,  which used to keep last connection to the shard. &lt;/p&gt;

&lt;p&gt;when client use persistent connection to mongos ,  mongos doesn&apos;t put last connection to mongod back to connection pool, just keep it.&lt;br/&gt;
So if there is 1000 persistent connection to mongos, then there is 1000 connections from mongos to mongod.&lt;/p&gt;


&lt;p&gt;When i use 100 web server, per server has 200 php-fpm worker,  running mongos instantce on each web server,  then there will be 200 connection to each mongos , &lt;/p&gt;

&lt;p&gt; and 200 connection from each mongos to mongod.  there will also will be 20000 connection on mongod.&lt;/p&gt;

&lt;p&gt;My problem is if hava too many fpm worker, then i will come right to 20000 limit on mongod.&lt;/p&gt;</comment>
                            <comment id="243624" author="jmikola@gmail.com" created="Fri, 18 Jan 2013 16:29:36 +0000"  >&lt;p&gt;Can you clarify what &quot;2w&quot; is, and what you meant by &quot;use avail(shard_version.cpp, shardconnection.cpp)&quot;?&lt;/p&gt;

&lt;p&gt;Are you receiving connection limit errors in the mongos or mongod logs? If so, can you share relevant segments of those log files?&lt;/p&gt;

&lt;p&gt;Based on your web server topology, you would come right to the limit of 20,000 connections if all FPM workers connect to the same mongos instance. Have you considered running a mongos instance on each application server? That, or alternatively with having several mongos instances behind a load balancer, are typically advised for &lt;a href=&quot;http://docs.mongodb.org/manual/administration/sharding-architectures/#deploying-a-production-cluster&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;production deployments&lt;/a&gt;.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                            <outwardlinks description="depends on">
                                        <issuelink>
            <issuekey id="12973">SERVER-1714</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="68991">SERVER-9022</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>6.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Fri, 18 Jan 2013 16:29:36 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        10 years, 47 weeks, 5 days ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[<s><a href='https://jira.mongodb.org/browse/SERVER-1714'>SERVER-1714</a></s>]]></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>false</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>ramon.fernandez@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            10 years, 47 weeks, 5 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Old_Backport</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10000"><![CDATA[No]]></customfieldvalue>

                        </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>jmikola@mongodb.com</customfieldvalue>
            <customfieldvalue>peanutgyz</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrnb3z:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrlotb:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>40073</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_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|hssd4v:</customfieldvalue>

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