[BUG] Slow down on npm installs when using custom registry compared to < v10
Is there an existing issue for this?
- [X] I have searched the existing issues
This issue exists in the latest npm version
- [X] I am using the latest npm
Current Behavior
When using npm version 10+ with artifactory as the npm registry it takes over 6m for npm installs compared to v9 which is usually half the time
Machine M1 Macbook but the same slowness was observe in our builds when using 10
Cleared node_modules and cache for each test rm -rf node_modules && npm cache clean --force && time npm i
Is anyone able to advise if something changed in terms of npm 10 in regards to resource management? I found it strange that time command for npm was similar but the overall time increased if anyone knows why.
Ran 2 of our local repos with the same outcome
| node | npm | private repo 1 | private repo 2 |
|---|---|---|---|
| 20.11.1 | 10.5.0 | npm i 96.14s user 31.78s system 33% cpu 6:24.16 total | npm i 80.79s user 21.22s system 25% cpu 6:37.86 total |
| 20.11.1 | 9.9.3 | npm i 93.55s user 32.85s system 76% cpu 2:44.17 total | npm i 71.34s user 21.57s system 84% cpu 1:49.86 total |
| 20.11.1 | 8.19.4 | npm i 83.29s user 29.63s system 96% cpu 1:57.12 total | npm i 71.39s user 21.74s system 90% cpu 1:43.40 total |
I also ran sentry repo which identifies the issue being artifactory linked but can also see slower install times in v10
| node | npm | https://github.com/getsentry/sentry | https://github.com/getsentry/sentry with artifactory |
|---|---|---|---|
| 20.11.1 | 10.5.0 | npm i 48.17s user 20.65s system 43% cpu 2:39.36 total | npm i 65.16s user 21.31s system 17% cpu 8:06.44 total |
| 20.11.1 | 9.9.3 | npm i 26.51s user 17.14s system 54% cpu 1:20.72 total | |
| 20.11.1 | 8.19.4 | npm i 25.24s user 18.17s system 68% cpu 1:03.04 total | npm i 35.73s user 19.91s system 24% cpu 3:49.53 total |
I may be wrong and it might just be an issue with artifactory but it seems like this only happens on version 10 which I found strange.
Expected Behavior
Expected to see similar times as previous version of npm
Steps To Reproduce
Not sure if this can be reproduced any other way than having self hosted artifactory, I have not tested with any other registry as I don't have one at hand.
Environment
- npm: 10.5.0
- Node.js: 20.11.1
- OS Name: Mac OS
- System Model Name: M1 Macbook
- npm config:
registry=(link to artifactory)
--no-shrinkwrap
commit-hooks=false
save-exact=true
legacy-peer-deps
We are still seeing the issue is there anyone able to provide some info as to why this is happening. We are blocked from upgrading existing projects to use 10+ npm version
Hey, @rriskus-r7,
I'm certain that this is related to the issue I've also reported. NPM is now installing the full metadata instead of the abbreviated metadata, which can sometimes be up to 10 times larger for each package.
What version of Artifactory are you using? I'm on 7.90.8 rev 79008900 and have noticed something similar. Switching to an older version of npm does alleviate it somewhat, but it is still nowhere near what I feel it should be.
@ullarseerme Hi, the issue you're experiencing isn't related to the Artifactory version but rather the npm version. When using npm versions below 10.4.0, Artifactory supports slim metadata. If this still doesn't improve the performance, I recommend reaching out to JFrog support for further assistance.
@yuvalojfrog, alright, I just wanted to make sure everybody was on the same page regarding this. Is there any tuning I could do on the Artifactory side to alleviate this? I've adjusted the following parameters, but to no real effect:
-Dartifactory.http.client.max.total.connections=150
-Dartifactory.http.client.max.connections.per.route=120