-
-
Notifications
You must be signed in to change notification settings - Fork 62
Config maxSockets not passed down in registry request #109
Comments
oh huh! I'll totally take a patch for this. Another thing that you might wanna do is patch npm to divvy up the maxSockets by the number of subprocesses spawned during |
I'll have a look this week. |
hi @tgandrews , @zkat , is this related to the problems below? npm 5 opens too many connection to a proxy server when it is configured with
I've observed that with one package, installing with a clean cache folder using npm@3 creates ~160 connections to the proxy while exactly the same setup with npm@5 collapses after bombarding over 600 connections. pacote is version 6.0.2 I'd be glad to help, just need some basic guidance here .. thank you |
It may be. I was finding a similar issue and hence ended up looking and adding it so the value for maxSockets was passed down and whilst it does help it is a multiple of the number of the workers as mentioned by @zkat Does setting the value to one in the npm config reduce the number of connections being made? |
hi @tgandrews, reducing the maxsockets npm config does not help. the default is 50 but the issue still reproduces even with a limit of 5 or less. can it be that the CONNECT requests that are sent to https proxies before the actual TLS/SSL handshakse are initiated prematurely ? |
IIRC I think you could change the way spawning is done in npm to reduce it to just one worked then combining it with a maxSockets of 1 you should get one connection. |
For low maxSockets numbers, you might even need to limit the number of concurrent extract subprocesses. A user-defined concurrency limit would be nice, too; it might help run/debug npm with restricted memory use. |
In case of maxSockets=1, that seems to be the only (and obvious) solution. For medium and high values, there should be better performance balances than fully serial. |
Currently it seems as if maxSockets is not being passed down to
make-fetch-happen
when making a registry requestpacote/lib/fetchers/registry/fetch.js
Lines 14 to 35 in 10c9248
So this means it gets defaulted to 15
https://github.com/zkat/make-fetch-happen/blob/800a8e54581e1b84e53e42a274c1eea7f8c652b6/agent.js#L48
Through some
console.log
debugging it seems to explain whynpm config set maxsockets 5
is not being applied.The text was updated successfully, but these errors were encountered: