<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:38:30 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-2401] report error when connect to mongodb inside k8s</title>
                <link>https://jira.mongodb.org/browse/GODRIVER-2401</link>
                <project id="14289" key="GODRIVER">Go Driver</project>
                    <description>&lt;h4&gt;&lt;a name=&quot;Summary&quot;&gt;&lt;/a&gt;Summary&lt;/h4&gt;

&lt;p&gt;application write with go driver report error when connect to mongodb inside k8s, If change to directConnection=true will not report error but have performance issue.&lt;/p&gt;
&lt;h4&gt;&lt;a name=&quot;Pleaseprovidetheversionofthedriver.Ifapplicable%2CpleaseprovidetheMongoDBserverversionandtopology%28standalone%2Creplicaset%2Corshardedcluster%29.&quot;&gt;&lt;/a&gt;Please provide the version of the driver. If applicable, please provide the MongoDB server version and topology (standalone, replica set, or sharded cluster).&lt;/h4&gt;

&lt;p&gt;go 1.18&lt;/p&gt;

&lt;p&gt;require (&lt;br/&gt;
&#160; &#160; github.com/urfave/cli/v2 v2.5.0&lt;br/&gt;
&#160; &#160; go.mongodb.org/mongo-driver v1.9.0&lt;br/&gt;
)&lt;/p&gt;

&lt;p&gt;MongoDB server version: 5.0.6&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;
&lt;h4&gt;&lt;a name=&quot;HowtoReproduce&quot;&gt;&lt;/a&gt;How to Reproduce&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;Steps to reproduce. If possible, please include a &lt;a href=&quot;http://sscce.org/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;Short, Self Contained, Correct (Compilable), Example&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;We setup Mongodb&apos;s stand-alone architecture in k8s, and then used the&lt;/em&gt;&lt;br/&gt;
&lt;em&gt;golang application to connect to mongodb, but found a problem.&lt;/em&gt;&lt;br/&gt;
&lt;em&gt;If you connect directly to mongodb, an error will be reported. The&lt;/em&gt;&lt;br/&gt;
&lt;em&gt;error message is as follows:&lt;/em&gt;&lt;br/&gt;
&lt;em&gt;````&lt;/em&gt;&lt;br/&gt;
&lt;em&gt;2022/04/14 09:30:00 server selection error: context deadline exceeded,&lt;/em&gt;&lt;br/&gt;
_current topology: { Type: ReplicaSetNoPrimary, Servers: [&lt;/p&gt;
{ Addr:_
_mongo-a9f01-replica0-0-0.mongo-a9f01-replica0-headless._
_qfusion-admin:27017, Type: Unknown, Last error: connection() error_
_occurred during connection handshake: dial tcp: lookup_
_mongo-a9f01-replica0-0-0.mongo-a9f01-replica0-headless.qfusion-admin_
_on 192.168. 65.5:53: no such host }
&lt;p&gt;, ] }_&lt;br/&gt;
&lt;em&gt;````&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The&#160;&lt;a href=&quot;http://192.168.65.5:53/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;192.168.65.5:53&lt;/a&gt;&#160;here is the dns address inside k8s, and the&lt;/em&gt;&lt;br/&gt;
&lt;em&gt;outside application should not be able to connect, so require address&lt;/em&gt;&lt;br/&gt;
&lt;em&gt;from&#160;&lt;a href=&quot;http://192.168.65.5:53/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;192.168.65.5:53&lt;/a&gt;&#160;to get domain name&#160; of&lt;/em&gt;&lt;br/&gt;
&lt;em&gt;mongo-a9f01-replica0-0-0.mongo-a9f01-replica0-headless.qfusion-admin&lt;/em&gt;&lt;br/&gt;
&lt;em&gt;will report an error.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;I googled for a solution, and verified that using&lt;/em&gt;&lt;br/&gt;
&lt;em&gt;directConnection=true can solve this problem without reporting an&lt;/em&gt;&lt;br/&gt;
&lt;em&gt;error.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;However, when I am doing multiple concurrent data acquisition or data&lt;/em&gt;&lt;br/&gt;
&lt;em&gt;insertion, I found that increasing the concurrent threads has no&lt;/em&gt;&lt;br/&gt;
&lt;em&gt;effect, and the performance does not improve. I use the same&lt;/em&gt;&lt;br/&gt;
&lt;em&gt;application to connect to non-k8s, and the performance can reach 600M&lt;/em&gt;&lt;br/&gt;
&lt;em&gt;without direct, but when connected with directConnect=true, the&lt;/em&gt;&lt;br/&gt;
&lt;em&gt;performance drops to only 100M.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;I also tested c driver, no error will be reported without directConnect=true&lt;/em&gt;&lt;/p&gt;
&lt;h4&gt;&lt;a name=&quot;AdditionalBackground&quot;&gt;&lt;/a&gt;Additional Background&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;Please provide any additional background information that may be helpful in diagnosing the bug.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;programs to test connect and performance issue&#160;&lt;/p&gt;

&lt;p&gt;```&lt;/p&gt;

&lt;p&gt;package main&lt;/p&gt;

&lt;p&gt;import (&lt;br/&gt;
&#160; &#160; &quot;flag&quot;&lt;br/&gt;
&#160; &#160; &quot;fmt&quot;&lt;br/&gt;
&#160; &#160; &quot;net/http&quot;&lt;br/&gt;
&#160; &#160; &quot;sync&quot;&lt;br/&gt;
&#160; &#160; &quot;time&quot;&lt;/p&gt;

&lt;p&gt;&#160; &#160; &quot;go.mongodb.org/mongo-driver/bson&quot;&lt;br/&gt;
&#160; &#160; &quot;go.mongodb.org/mongo-driver/mongo&quot;&lt;br/&gt;
&#160; &#160; &quot;go.mongodb.org/mongo-driver/mongo/options&quot;&lt;br/&gt;
)&lt;/p&gt;

&lt;p&gt;var (&lt;br/&gt;
&#160; &#160; srcUri &#160; &#160; &#160;string&lt;br/&gt;
&#160; &#160; srcDb &#160; &#160; &#160; string&lt;br/&gt;
&#160; &#160; srcColl &#160; &#160; string&lt;br/&gt;
&#160; &#160; threadCount int&lt;br/&gt;
&#160; &#160; docCount &#160; &#160;int&lt;br/&gt;
&#160; &#160; batchSize &#160; int&lt;br/&gt;
&#160; &#160; pprof &#160; &#160; &#160; bool&lt;br/&gt;
)&lt;/p&gt;

&lt;p&gt;func init() &lt;/p&gt;
{
&#160; &#160; flag.StringVar(&amp;amp;srcUri, &quot;srcuri&quot;, &quot;mongodb://root:dbmotion#123@10.10.150.207:27717&quot;, &quot;source mongodb uri&quot;)
&#160; &#160; flag.StringVar(&amp;amp;srcDb, &quot;srcdb&quot;, &quot;db1&quot;, &quot;srouce db&quot;)
&#160; &#160; flag.StringVar(&amp;amp;srcColl, &quot;srccoll&quot;, &quot;t1&quot;, &quot;srouce collection&quot;)
&#160; &#160; flag.IntVar(&amp;amp;threadCount, &quot;nt&quot;, 1, &quot;goroutine count&quot;)
&#160; &#160; flag.IntVar(&amp;amp;docCount, &quot;ndoc&quot;, 1000000, &quot;total docs to be inserted&quot;)
&#160; &#160; flag.IntVar(&amp;amp;batchSize, &quot;batch&quot;, 512, &quot;insert batch size&quot;)
&#160; &#160; flag.BoolVar(&amp;amp;pprof, &quot;pprof&quot;, false, &quot;start net/http/pprof&quot;)
}

&lt;p&gt;func main() {&lt;br/&gt;
&#160; &#160; flag.Parse()&lt;/p&gt;

&lt;p&gt;&#160; &#160; fmt.Printf(&quot;%s %d threads insert into %s/%s.%s %d docs, batch size: %d\n&quot;,&lt;br/&gt;
&#160; &#160; &#160; &#160; nowStr(), threadCount, srcUri, srcDb, srcColl, docCount, batchSize)&lt;/p&gt;

&lt;p&gt;&#160; &#160; connOpt := options.Client().ApplyURI(srcUri)&lt;br/&gt;
&#160; &#160; conn, err := mongo.Connect(nil, connOpt)&lt;br/&gt;
&#160; &#160; if err != nil &lt;/p&gt;
{
&#160; &#160; &#160; &#160; fmt.Println(err)
&#160; &#160; &#160; &#160; return
&#160; &#160; }&lt;br/&gt;
&#160; &#160; defer conn.Disconnect(nil)&lt;br/&gt;
&lt;br/&gt;
&#160; &#160; if err := conn.Ping(nil, nil); err != nil {
&#160; &#160; &#160; &#160; fmt.Println(err)
&#160; &#160; &#160; &#160; return
&#160; &#160; }

&lt;p&gt;&#160; &#160; if err := conn.Database(srcDb).Collection(srcColl).Drop(nil); err != nil &lt;/p&gt;
{
&#160; &#160; &#160; &#160; fmt.Println(err)
&#160; &#160; &#160; &#160; return
&#160; &#160; }

&lt;p&gt;&#160; &#160; begin := time.Now()&lt;/p&gt;

&lt;p&gt;&#160; &#160; nDoc := docCount / threadCount&lt;br/&gt;
&#160; &#160; nIns := make([]int, threadCount)&lt;/p&gt;

&lt;p&gt;&#160; &#160; var wg sync.WaitGroup&lt;br/&gt;
&#160; &#160; wg.Add(threadCount)&lt;/p&gt;

&lt;p&gt;&#160; &#160; for i := 0; i &amp;lt; threadCount; i++ {&lt;br/&gt;
&#160; &#160; &#160; &#160; pRs := &amp;amp;nIns&lt;span class=&quot;error&quot;&gt;&amp;#91;i&amp;#93;&lt;/span&gt;&lt;br/&gt;
&#160; &#160; &#160; &#160; *pRs = 0&lt;br/&gt;
&#160; &#160; &#160; &#160; go func() &lt;/p&gt;
{
&#160; &#160; &#160; &#160; &#160; &#160; insert(conn, srcDb, srcColl, nDoc, batchSize, pRs)
&#160; &#160; &#160; &#160; &#160; &#160; wg.Done()
&#160; &#160; &#160; &#160; }
&lt;p&gt;()&lt;br/&gt;
&#160; &#160; }&lt;/p&gt;

&lt;p&gt;&#160; &#160; go printStat(nIns, 10)&lt;/p&gt;

&lt;p&gt;&#160; &#160; if pprof {&lt;br/&gt;
&#160; &#160; &#160; &#160; go func() &lt;/p&gt;
{
&#160; &#160; &#160; &#160; &#160; &#160; http.ListenAndServe(&quot;:6060&quot;, nil)
&#160; &#160; &#160; &#160; }
&lt;p&gt;()&lt;br/&gt;
&#160; &#160; &#160; &#160; fmt.Printf(&quot;pprof on :6060\n&quot;)&lt;br/&gt;
&#160; &#160; }&lt;br/&gt;
&#160; &#160; wg.Wait()&lt;/p&gt;

&lt;p&gt;&#160; &#160; elapse := time.Since(begin)&lt;br/&gt;
&#160; &#160; totalDoc := 0&lt;br/&gt;
&#160; &#160; for _, val := range nIns &lt;/p&gt;
{
&#160; &#160; &#160; &#160; totalDoc += val
&#160; &#160; }
&lt;p&gt;&#160; &#160; totalMB := 1.0 * float64(totalDoc) * 10 / 1024&lt;br/&gt;
&#160; &#160; fmt.Printf(&quot;%s total insert %d docs, %3.f doc/s, %.3f MB/s\n&quot;, nowStr(),&lt;br/&gt;
&#160; &#160; &#160; &#160; totalDoc, float64(totalDoc)/elapse.Seconds(), totalMB/elapse.Seconds())&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;func insert(conn *mongo.Client, dbName string, collName string, nDoc int, batchSize int, nInserted *int) {&lt;br/&gt;
&#160; &#160; var binData []byte&lt;br/&gt;
&#160; &#160; for i := 0; i &amp;lt; 1024; i++ &lt;/p&gt;
{
&#160; &#160; &#160; &#160; binData = append(binData, byte(&apos;A&apos;+i%26))
&#160; &#160; }
&lt;p&gt;&#160; &#160; var doc bson.D&lt;br/&gt;
&#160; &#160; for i := 0; i &amp;lt; 10; i++ &lt;/p&gt;
{
&#160; &#160; &#160; &#160; colName := fmt.Sprintf(&quot;c%d&quot;, i)
&#160; &#160; &#160; &#160; doc = append(doc, bson.E\{Key: colName, Value: binData}
&lt;p&gt;)&lt;br/&gt;
&#160; &#160; }&lt;/p&gt;

&lt;p&gt;&#160; &#160; coll := conn.Database(dbName).Collection(collName)&lt;br/&gt;
&#160; &#160; optIns := options.InsertMany() //.SetBypassDocumentValidation(true)&lt;/p&gt;

&lt;p&gt;&#160; &#160; var docs []interface{}&lt;/p&gt;

&lt;p&gt;&#160; &#160; for i := 0; i &amp;lt; nDoc; i++ {&lt;br/&gt;
&#160; &#160; &#160; &#160; docs = append(docs, doc)&lt;br/&gt;
&#160; &#160; &#160; &#160; if len(docs) &amp;gt;= batchSize {&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; if _, err := coll.InsertMany(nil, docs, optIns); err != nil &lt;/p&gt;
{
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; fmt.Println(err)
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; return
&#160; &#160; &#160; &#160; &#160; &#160; }
&lt;p&gt;&#160; &#160; &#160; &#160; &#160; &#160; *nInserted += len(docs)&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; docs = nil&lt;br/&gt;
&#160; &#160; &#160; &#160; }&lt;br/&gt;
&#160; &#160; }&lt;/p&gt;

&lt;p&gt;&#160; &#160; if len(docs) &amp;gt;= batchSize {&lt;br/&gt;
&#160; &#160; &#160; &#160; if _, err := coll.InsertMany(nil, docs, optIns); err != nil &lt;/p&gt;
{
&#160; &#160; &#160; &#160; &#160; &#160; fmt.Println(err)
&#160; &#160; &#160; &#160; &#160; &#160; return
&#160; &#160; &#160; &#160; }
&lt;p&gt;&#160; &#160; &#160; &#160; *nInserted += len(docs)&lt;br/&gt;
&#160; &#160; }&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;func nowStr() string &lt;/p&gt;
{
&#160; &#160; return time.Now().Format(&quot;2006-01-02 15:04:05&quot;)
}

&lt;p&gt;func printStat(nIns []int, itvS int) {&lt;br/&gt;
&#160; &#160; old := make([]int, len(nIns))&lt;/p&gt;

&lt;p&gt;&#160; &#160; tiker := time.NewTicker(time.Duration(itvS) * time.Second)&lt;br/&gt;
&#160; &#160; for {&lt;br/&gt;
&#160; &#160; &#160; &#160; copy(old, nIns)&lt;br/&gt;
&#160; &#160; &#160; &#160; &amp;lt;-tiker.C&lt;/p&gt;

&lt;p&gt;&#160; &#160; &#160; &#160; totalDoc := 0&lt;br/&gt;
&#160; &#160; &#160; &#160; totalMB := 0.0&lt;br/&gt;
&#160; &#160; &#160; &#160; for i := 0; i &amp;lt; len(nIns); i++ &lt;/p&gt;
{
&#160; &#160; &#160; &#160; &#160; &#160; deltaIns := nIns[i] - old[i]
&#160; &#160; &#160; &#160; &#160; &#160; deltaMB := float64(deltaIns * 10 / 1024)
&#160; &#160; &#160; &#160; &#160; &#160; totalDoc += deltaIns
&#160; &#160; &#160; &#160; &#160; &#160; totalMB += deltaMB
&#160; &#160; &#160; &#160; &#160; &#160; fmt.Printf(&quot;%s t-%d insert %d docs, %3.f doc/s, %.3f MB/s\n&quot;, nowStr(), i,
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; deltaIns, float64(deltaIns)/float64(itvS), deltaMB/float64(itvS))
&#160; &#160; &#160; &#160; }

&lt;p&gt;&#160; &#160; &#160; &#160; fmt.Printf(&quot;%s all insert %d docs, %3.f doc/s, %.3f MB/s\n&quot;, nowStr(),&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; totalDoc, float64(totalDoc)/float64(itvS), totalMB/float64(itvS))&lt;br/&gt;
&#160; &#160; }&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;```&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;run the programs with &apos;./insert -srcuri=&quot;mongodb://root:dbmotion#123@10.10.150.208:27717/?directConnection=false&quot; -nt 1 &#160;-trace&apos;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</description>
                <environment></environment>
        <key id="2036816">GODRIVER-2401</key>
            <summary>report error when connect to mongodb inside k8s</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</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="13203">Gone away</resolution>
                                        <assignee username="matt.dale@mongodb.com">Matt Dale</assignee>
                                    <reporter username="pickup112@gmail.com">pickup li</reporter>
                        <labels>
                            <label>kubernetes</label>
                    </labels>
                <created>Sat, 30 Apr 2022 03:07:17 +0000</created>
                <updated>Fri, 27 Oct 2023 20:01:12 +0000</updated>
                            <resolved>Tue, 25 Oct 2022 12:00:46 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="4925024" author="dbeng-pm-bot" created="Tue, 25 Oct 2022 12:00:48 +0000"  >&lt;p&gt;There hasn&apos;t been any recent activity on this ticket, so we&apos;re resolving it. Thanks for reaching out! Please feel free to comment on this if you&apos;re able to provide more information.&lt;/p&gt;</comment>
                            <comment id="4799669" author="JIRAUSER1268612" created="Sat, 3 Sep 2022 00:31:53 +0000"  >&lt;p&gt;Thanks very much.&lt;/p&gt;

&lt;p&gt;I will test and check if it works&lt;/p&gt;</comment>
                            <comment id="4780385" author="JIRAUSER1259527" created="Fri, 26 Aug 2022 18:49:41 +0000"  >&lt;p&gt;Hey &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=pickup112%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;pickup112@gmail.com&quot;&gt;pickup112@gmail.com&lt;/a&gt;, thanks for the extra info! Based on that information, my theory about the server identifying itself as &lt;tt&gt;www-a1615-replica0-0-0.www-a1615-replica0-headless.qfusion-wcy-bm2:27017&lt;/tt&gt; is correct. Additionally, the topology appears to be a 3-node replica set and you are connecting directly to the &quot;primary&quot; node.&lt;/p&gt;

&lt;p&gt;MongoDB replica sets offer a configuration called &quot;replica set horizons&quot; that allow connecting to a MongoDB replica set using different DNS names. However, that feature is only supported when using one of the MongoDB Kubernetes Operators. See documentation for using replica set horizons with the the Enterprise operator &lt;a href=&quot;https://www.mongodb.com/docs/kubernetes-operator/stable/tutorial/connect-from-outside-k8s/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt; and with the Community operator &lt;a href=&quot;https://github.com/mongodb/mongodb-kubernetes-operator/blob/master/docs/external_access.md&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Are you using one of the MongoDB Kubernetes Operators to run MongoDB on Kubernetes? If so, are you able to update the MongoDB Kubernetes service definition to add a replica set horizon?&lt;/p&gt;</comment>
                            <comment id="4667749" author="JIRAUSER1268612" created="Sat, 9 Jul 2022 07:33:53 +0000"  >&lt;p&gt;Yes&#65292;use mongo&#160; to connect to the instance like this:&lt;/p&gt;

&lt;p&gt;```&lt;/p&gt;

&lt;p&gt;root@www-a1615-replica0-0-0:/# mongo --host 10.10.88.123 --port 2635 -u user1 &#160;-p &apos;User1-123&apos; --authenticationDatabase adminMongoDB shell version v4.4.13&lt;br/&gt;
connecting to: mongodb://10.10.88.123:2635/?authSource=admin&amp;amp;compressors=disabled&amp;amp;gssapiServiceName=mongodb&lt;br/&gt;
Implicit session: session { &quot;id&quot; : UUID(&quot;12692f3c-b030-44bf-8404-99c8c9055160&quot;) }&lt;br/&gt;
MongoDB server version: 4.4.13&lt;br/&gt;
www-a1615-replica0:PRIMARY&amp;gt; show databases;&lt;br/&gt;
admin &#160; 0.000GB&lt;br/&gt;
config &#160;0.000GB&lt;br/&gt;
local &#160; 0.011GB&lt;/p&gt;

&lt;p&gt;```&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;and db.runCommand({hello:1}) return&#65306;&lt;/p&gt;

&lt;p&gt;```&lt;/p&gt;

&lt;p&gt;www-a1615-replica0:PRIMARY&amp;gt; db.runCommand({hello:1})&lt;br/&gt;
{&lt;br/&gt;
&#160; &#160; &#160; &#160; &quot;topologyVersion&quot; : &lt;/p&gt;
{
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &quot;processId&quot; : ObjectId(&quot;628b49eb018f658f59f96596&quot;),
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &quot;counter&quot; : NumberLong(6)
&#160; &#160; &#160; &#160; }
&lt;p&gt;,&lt;br/&gt;
&#160; &#160; &#160; &#160; &quot;hosts&quot; : [&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &quot;www-a1615-replica0-0-0.www-a1615-replica0-headless.qfusion-wcy-bm2:27017&quot;,&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &quot;www-a1615-replica0-1-0.www-a1615-replica0-headless.qfusion-wcy-bm2:27017&quot;,&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &quot;www-a1615-replica0-2-0.www-a1615-replica0-headless.qfusion-wcy-bm2:27017&quot;&lt;br/&gt;
&#160; &#160; &#160; &#160; ],&lt;br/&gt;
&#160; &#160; &#160; &#160; &quot;setName&quot; : &quot;www-a1615-replica0&quot;,&lt;br/&gt;
&#160; &#160; &#160; &#160; &quot;setVersion&quot; : 1,&lt;br/&gt;
&#160; &#160; &#160; &#160; &quot;isWritablePrimary&quot; : true,&lt;br/&gt;
&#160; &#160; &#160; &#160; &quot;secondary&quot; : false,&lt;br/&gt;
&#160; &#160; &#160; &#160; &quot;primary&quot; : &quot;www-a1615-replica0-0-0.www-a1615-replica0-headless.qfusion-wcy-bm2:27017&quot;,&lt;br/&gt;
&#160; &#160; &#160; &#160; &quot;me&quot; : &quot;www-a1615-replica0-0-0.www-a1615-replica0-headless.qfusion-wcy-bm2:27017&quot;,&lt;br/&gt;
&#160; &#160; &#160; &#160; &quot;electionId&quot; : ObjectId(&quot;7fffffff0000000000000001&quot;),&lt;br/&gt;
&#160; &#160; &#160; &#160; &quot;lastWrite&quot; : {&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &quot;opTime&quot; : &lt;/p&gt;
{
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &quot;ts&quot; : Timestamp(1657351209, 1),
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &quot;t&quot; : NumberLong(1)
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; }
&lt;p&gt;,&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &quot;lastWriteDate&quot; : ISODate(&quot;2022-07-09T07:20:09Z&quot;),&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &quot;majorityOpTime&quot; : &lt;/p&gt;
{
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &quot;ts&quot; : Timestamp(1657351209, 1),
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &quot;t&quot; : NumberLong(1)
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; }
&lt;p&gt;,&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &quot;majorityWriteDate&quot; : ISODate(&quot;2022-07-09T07:20:09Z&quot;)&lt;br/&gt;
&#160; &#160; &#160; &#160; },&lt;br/&gt;
&#160; &#160; &#160; &#160; &quot;maxBsonObjectSize&quot; : 16777216,&lt;br/&gt;
&#160; &#160; &#160; &#160; &quot;maxMessageSizeBytes&quot; : 48000000,&lt;br/&gt;
&#160; &#160; &#160; &#160; &quot;maxWriteBatchSize&quot; : 100000,&lt;br/&gt;
&#160; &#160; &#160; &#160; &quot;localTime&quot; : ISODate(&quot;2022-07-09T07:20:10.069Z&quot;),&lt;br/&gt;
&#160; &#160; &#160; &#160; &quot;logicalSessionTimeoutMinutes&quot; : 30,&lt;br/&gt;
&#160; &#160; &#160; &#160; &quot;connectionId&quot; : 423114,&lt;br/&gt;
&#160; &#160; &#160; &#160; &quot;minWireVersion&quot; : 0,&lt;br/&gt;
&#160; &#160; &#160; &#160; &quot;maxWireVersion&quot; : 9,&lt;br/&gt;
&#160; &#160; &#160; &#160; &quot;readOnly&quot; : false,&lt;br/&gt;
&#160; &#160; &#160; &#160; &quot;ok&quot; : 1,&lt;br/&gt;
&#160; &#160; &#160; &#160; &quot;$clusterTime&quot; : {&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &quot;clusterTime&quot; : Timestamp(1657351209, 1),&lt;br/&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &quot;signature&quot; : &lt;/p&gt;
{
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &quot;hash&quot; : BinData(0,&quot;e2hF8xF4rQpHPl1no5226X2odBE=&quot;),
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &quot;keyId&quot; : NumberLong(&quot;7100850609930108932&quot;)
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; }
&lt;p&gt;&#160; &#160; &#160; &#160; },&lt;br/&gt;
&#160; &#160; &#160; &#160; &quot;operationTime&quot; : Timestamp(1657351209, 1)&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;```&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="4667719" author="JIRAUSER1259527" created="Sat, 9 Jul 2022 04:03:54 +0000"  >&lt;p&gt;Hey &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=pickup112%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;pickup112@gmail.com&quot;&gt;pickup112@gmail.com&lt;/a&gt;, are you able to connect to your MongoDB instance running in Kubernetes using either the &lt;a href=&quot;https://www.mongodb.com/docs/mongodb-shell/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;mongosh&lt;/a&gt; command line tool or the legacy &lt;a href=&quot;https://www.mongodb.com/docs/manual/reference/program/mongo/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;mongo&lt;/a&gt; command line tool? If so, please connect and run the following command and paste the output here:&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;db.runCommand({hello:1})&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;As you noted earlier, the connection issue doesn&apos;t seem to be isolated to just the Go Driver, so I believe this is actually an issue with server configuration, not the Go Driver. Configuring MongoDB servers to run in Kubernetes is outside of my area of expertise, so if I&apos;m not able to help you, I&apos;ll reassign this ticket. Thanks for your patience so far!&lt;/p&gt;</comment>
                            <comment id="4619620" author="JIRAUSER1268612" created="Thu, 16 Jun 2022 03:13:33 +0000"  >&lt;p&gt;Thanks for response.&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;I have my application run on a host not running in Kubernetes&lt;/li&gt;
	&lt;li&gt;I used a custom pod definition&lt;/li&gt;
&lt;/ul&gt;
</comment>
                            <comment id="4619414" author="JIRAUSER1259527" created="Thu, 16 Jun 2022 00:10:10 +0000"  >&lt;p&gt;Hey &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=pickup112%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;pickup112@gmail.com&quot;&gt;pickup112@gmail.com&lt;/a&gt;, thanks for the question and sorry about the slow response! I believe the problem is related to how MongoDB drivers update the server names based on the information in the initial server handshake. In this case, it seems like the server is identifying itself as &lt;em&gt;mongo-a9f01-replica0-0-0.mongo-a9f01-replica0-headless.qfusion-admin:27017&lt;/em&gt;, so that&apos;s what the driver attempts to connect to. However, it also seems like that DNS name is not resolvable from the host where the client application is running. In &lt;tt&gt;directConnection=true&lt;/tt&gt; mode, I believe that server name rewrite is not performed. I&apos;m not sure why the performance is different when &lt;tt&gt;directConnection=true&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;I have some questions to help me understand more about what&apos;s going on:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Where is your client application running? For example, are you trying to connect to the MongoDB server from a host in the same Kubernetes cluster as the MongoDB server, or a different Kubernetes cluster, or a host not running in Kubernetes?&lt;/li&gt;
	&lt;li&gt;How are you running the MongoDB standalone instance in Kubernetes? Are you using the &lt;a href=&quot;https://github.com/mongodb/mongodb-kubernetes-operator&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;MongoDB Community Kubernetes Operator&lt;/a&gt;, the &lt;a href=&quot;https://github.com/mongodb/mongodb-enterprise-kubernetes&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;MongoDB Enterprise Kubernetes Operator&lt;/a&gt;, or a custom pod definition?&lt;/li&gt;
&lt;/ul&gt;
</comment>
                            <comment id="4527494" author="JIRAUSER1268612" created="Thu, 5 May 2022 01:33:34 +0000"  >&lt;p&gt;I also tested the performance with the driver of c and java. Using directConnection=true, the single-thread performance will drop from 120MB/s to 60MB/s, and the 8-thread performance will drop from 600MB/s to 120MB/s&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|i0c4f4:</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>