<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:34:07 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>[GODRIVER-392] Best way to connect to sharded cluster</title>
                <link>https://jira.mongodb.org/browse/GODRIVER-392</link>
                <project id="14289" key="GODRIVER">Go Driver</project>
                    <description>&lt;p&gt;Going to move from mgo to this Go driver. Having a sharded cluster with replica sets for each shard.&lt;/p&gt;

&lt;p&gt;What I did with mgo (and in C++ implementations as well): Connecting directly to every single replica set member without mongos to have better control of my connections and load of each node.&lt;/p&gt;

&lt;p&gt;I&apos;m wondering if this is a good approach or there is a better best practise. Thought about connecting to shards and let the driver handle the replica sets. But I will lose some of the control with this.&lt;/p&gt;</description>
                <environment></environment>
        <key id="536353">GODRIVER-392</key>
            <summary>Best way to connect to sharded cluster</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</type>
                                            <priority id="5" iconUrl="https://jira.mongodb.org/images/icons/priorities/trivial.svg">Trivial - P5</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="13202">Works as Designed</resolution>
                                        <assignee username="jeff.yemin@mongodb.com">Jeffrey Yemin</assignee>
                                    <reporter username="sebastianbauer">Sebastian Bauer</reporter>
                        <labels>
                    </labels>
                <created>Mon, 30 Apr 2018 13:58:27 +0000</created>
                <updated>Fri, 27 Oct 2023 13:16:39 +0000</updated>
                            <resolved>Wed, 2 May 2018 13:28:54 +0000</resolved>
                                                                    <component>Connections</component>
                    <component>Documentation</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="1880270" author="sebastianbauer" created="Wed, 2 May 2018 14:17:55 +0000"  >&lt;p&gt;You are right. Regarding mongos this is a general question and I asked on Stack Overflow (for reference):&#160;&lt;a href=&quot;https://stackoverflow.com/questions/50136885/speedup-broadcast-finds-with-mongos&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://stackoverflow.com/questions/50136885/speedup-broadcast-finds-with-mongos&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1880172" author="jeff.yemin" created="Wed, 2 May 2018 13:28:46 +0000"  >&lt;p&gt;Hi Sebastian.  It seems your question is no longer really about the Go driver but about how to get the performance you need out of a sharded cluster regardless of which driver you happen to be using.  If that&apos;s the case, the best place to ask questions about general MongoDB usage is either the &lt;a href=&quot;https://groups.google.com/forum/#!forum/mongodb-user&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;mongodb-user Google Group&lt;/a&gt; or  &lt;a href=&quot;http://stackoverflow.com/questions/tagged/mongodb&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;Stack Overflow&lt;/a&gt; as public discussion there can help others learn and resolve similar issues. &lt;/p&gt;

&lt;p&gt;That said, I&apos;m going to close this issue, but feel free to comment back if you feel I&apos;ve mischaracterized your question.&lt;/p&gt;</comment>
                            <comment id="1880043" author="sebastianbauer" created="Wed, 2 May 2018 10:29:06 +0000"  >&lt;p&gt;Since we are reading millions of records the mongos approach is pretty slow compared to direct connections. It&apos;s not 100% clear to me if mongos is caching before sending the result. Connection is with secondaryPreferred on a local mongos.&lt;/p&gt;

&lt;p&gt;Using mongos would be pretty cool regarding client complexity. But performance seems to be a problem.&lt;/p&gt;</comment>
                            <comment id="1878029" author="sebastianbauer" created="Mon, 30 Apr 2018 16:20:40 +0000"  >&lt;p&gt;Thank you, Jeff, for your feedback. I&apos;m a bit concerned using mongos for all this traffic. We are talking about a setup with more than 40 shards.&lt;/p&gt;

&lt;p&gt;To use all available replica set members, there is no read preference like &quot;round robin&quot;. Even better would be to balance to the nodes that has most free resources. That&apos;s why we are using this manual approach right now.&lt;/p&gt;

&lt;p&gt;Most queries will be broadcast operations. I will check if there are performance impacts with big results.&lt;/p&gt;</comment>
                            <comment id="1877734" author="jeff.yemin" created="Mon, 30 Apr 2018 14:41:13 +0000"  >&lt;p&gt;Our advice is to connect only to mongos routers in a sharded cluster for CRUD operations.&#160; Any other usage pattern is not supported.&#160; See &lt;a href=&quot;https://docs.mongodb.com/manual/core/sharded-cluster-query-router/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://docs.mongodb.com/manual/core/sharded-cluster-query-router/&lt;/a&gt;&#160;for details.&#160;&#160;&lt;/p&gt;

&lt;p&gt;Which driver your application happens to use is not really relevant to this decision.&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|htnuin:</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>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>