File tree 1 file changed +17
-0
lines changed 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -110,6 +110,11 @@ http.get({
110
110
### ` new Agent([options]) `
111
111
<!-- YAML
112
112
added: 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.
113
118
-->
114
119
115
120
* ` options ` {Object} Set of configurable options to set on the agent.
@@ -132,6 +137,18 @@ added: v0.3.4
132
137
* ` maxFreeSockets ` {number} Maximum number of sockets to leave open
133
138
in a free state. Only relevant if ` keepAlive ` is set to ` true ` .
134
139
** 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' ` .
135
152
* ` timeout ` {number} Socket timeout in milliseconds.
136
153
This will set the timeout when the socket is created.
137
154
You can’t perform that action at this time.
0 commit comments