mongodb - Connections pool in Go mgo package -


in article running-mongodb-queries-concurrently-with-go said mgo.dialwithinfo : create session maintains pool of socket connections mongodb, when looking in documentacion of function dialwithinfo not find talk me pool connection, find in dial function dial function said : method called once given cluster. further sessions same cluster established using new or copy methods on obtained session. make them share underlying cluster, , manage pool of connections appropriately.

  • can me how works pool connections on mgo , if possible set pool?
  • is true dialwithinfo create pool connection or dial function create pool?

thanks in advance

looking source code dial function calls, can see dial function calls dialwithtimeout function calls dialwithinfo function. answer question differences between functions, seems dial convenience wrapper dialwithtimeout, in turn convenience wrapper dialwithinfo, result in same connection pool.

as how manage connection pool, you've got right in question.

further sessions same cluster established using new or copy methods on obtained session. make them share underlying cluster, , manage pool of connections appropriately.

so single call dial or dialwithtimeout or dialwithinfo establish connection pool, if require more 1 session, use session.new() or session.copy() methods obtain session returned whichever dial function chose use.


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -