Skip to content

Commit 7ea374b

Browse files
PoojaDurgadruyadorno
authored andcommitted
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 f3637d5 commit 7ea374b

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

0 commit comments

Comments
 (0)