Skip to content

Commit 385d0df

Browse files
PoojaDurgadtargos
authored andcommittedMay 1, 2021
doc: clarify maxSockets option of http.Agent
PR-URL: #36941 Fixes: #36463 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 792bea4 commit 385d0df

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed
 

‎doc/api/http.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,14 @@ changes:
139139
the [initial delay](net.md#net_socket_setkeepalive_enable_initialdelay)
140140
for TCP Keep-Alive packets. Ignored when the
141141
`keepAlive` option is `false` or `undefined`. **Default:** `1000`.
142-
* `maxSockets` {number} Maximum number of sockets to allow per
143-
host. Each request will use a new socket until the maximum is reached.
142+
* `maxSockets` {number} Maximum number of sockets to allow per host.
143+
If the same host opens multiple concurrent connections, each request
144+
will use new socket until the `maxSockets` value is reached.
145+
If the host attempts to open more connections than `maxSockets`,
146+
the additional requests will enter into a pending request queue, and
147+
will enter active connection state when an existing connection terminates.
148+
This makes sure there are at most `maxSockets` active connections at
149+
any point in time, from a given host.
144150
**Default:** `Infinity`.
145151
* `maxTotalSockets` {number} Maximum number of sockets allowed for
146152
all hosts in total. Each request will use a new socket

0 commit comments

Comments
 (0)