File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -110,6 +110,11 @@ http.get({
110110### ` new Agent([options]) `
111111<!-- YAML
112112added: v0.3.4
113+ changes:
114+ - version: REPLACEME
115+ pr-url: https://github.com/nodejs/node/pull/33278
116+ description: Add `scheduling` option to specify the free socket
117+ scheduling strategy.
113118-->
114119
115120* ` options ` {Object} Set of configurable options to set on the agent.
@@ -132,6 +137,18 @@ added: v0.3.4
132137 * ` maxFreeSockets ` {number} Maximum number of sockets to leave open
133138 in a free state. Only relevant if ` keepAlive ` is set to ` true ` .
134139 ** Default:** ` 256 ` .
140+ * ` scheduling ` {string} Scheduling strategy to apply when picking
141+ the next free socket to use. It can be ` 'fifo' ` or ` 'lifo' ` .
142+ The main difference between the two scheduling strategies is that ` 'lifo' `
143+ selects the most recently used socket, while ` 'fifo' ` selects
144+ the least recently used socket.
145+ In case of a low rate of request per second, the ` 'lifo' ` scheduling
146+ will lower the risk of picking a socket that might have been closed
147+ by the server due to inactivity.
148+ In case of a high rate of request per second,
149+ the ` 'fifo' ` scheduling will maximize the number of open sockets,
150+ while the ` 'lifo' ` scheduling will keep it as low as possible.
151+ ** Default:** ` 'fifo' ` .
135152 * ` timeout ` {number} Socket timeout in milliseconds.
136153 This will set the timeout when the socket is created.
137154
You can’t perform that action at this time.
0 commit comments