Skip to content

Commit 666aaa1

Browse files
committed
rm feedback
1 parent 962a813 commit 666aaa1

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

source/connect/connection-options/connection-pools.txt

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ pools open sockets on demand. These sockets support concurrent MongoDB
4040
operations, or `goroutines <https://go.dev/tour/concurrency/1>`__, in
4141
your application.
4242

43-
Each ``Client`` instance opens two more sockets per server in your MongoDB
44-
topology for monitoring the server's state.
43+
When a new ``Client`` instance is instatiated, it opens two sockets per server
44+
in your MongoDB topology for monitoring the server's state.
4545

4646
For example, a client connected to a three-node replica set opens six monitoring
4747
sockets. If the application uses the default setting for ``maxPoolSize`` and
@@ -50,8 +50,9 @@ sockets and ``100`` connections in the connection pool. If the application uses
5050
a :ref:`read preference <golang-read-pref>` to query the secondary nodes, their
5151
pools also grow and there can be ``306`` total connections.
5252

53-
Create a client once for each process, and reuse it for all operations. Avoid
54-
creating a new client for each request, as this is inefficient.
53+
For efficiency, create a client once for each process, and reuse it for all
54+
operations. Avoid creating a new client for each request because this will
55+
increase latency.
5556

5657
Configure a Connection Pool
5758
---------------------------
@@ -105,6 +106,9 @@ connection pool:
105106

106107
*Default*: ``0`` (no limit)
107108

109+
Example
110+
~~~~~~~
111+
108112
The following code creates a client with a maximum connection pool size of
109113
``50``, a minimum pool size of ``10``, and a maximum idle time of
110114
``30000`` milliseconds (30 seconds):
@@ -128,9 +132,9 @@ Any new goroutine stops waiting in the following cases:
128132
on connection creation.
129133

130134
The driver does not limit the number of operations that can wait for sockets to
131-
become available and it is the application's responsibility to limit the size of
132-
its pool to bound queuing during a load spike. Operations can wait for any length of time
133-
unless you define the ``waitQueueTimeoutMS`` option.
135+
become available, so it is the application's responsibility to manage its
136+
operation queue. Operations can wait for any length of time unless you define
137+
the ``waitQueueTimeoutMS`` option.
134138

135139
An operation that waits more than the length of time defined by
136140
``waitQueueTimeoutMS`` for a socket raises a connection error. Use this option
@@ -141,7 +145,7 @@ Disconnecting
141145
-------------
142146

143147
When you call ``Client.Disconnect()`` from any goroutine, the driver closes all
144-
idle sockets and closes all sockets in use as they are returned to the pool.
148+
idle sockets, and then closes all sockets as they are returned to the pool.
145149

146150
Additional Information
147151
----------------------

0 commit comments

Comments
 (0)