-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Install and CI performance is significantly worse than npm@6 #2011
Comments
I have also experienced some performance issues, particularly when running I realize this could be simply a problem with Docker, specifically Docker for Mac, but I'm curious if anyone else has experienced this or if it's something unique to my environment. I have 6 CPUs and 12GB memory allocated to the vm, so I don't think it's a resource issue. Is I created a demo repo here (https://github.com/bdentino/npm7-perf-demo) with timing logs from both host and docker installs, if anyone would like to try and reproduce. |
I'm experiencing significant performance degradation as well. |
Also having a lot of trouble with installing Installed node and npm via homebrew on Mac (node 15.5.1 and npm 7.3.0) Downgrading manually via |
@billyjanitsch Wanted to finally circle back on this. I've had a drafted message for a while but we took some of your initial findings back internally & have dug in here quite a bit (p.s. this message is not that draft). There should be some recent perf wins we've found that just landed in Going to leave this open until we have some concrete data points to share back either way. |
I'm also noticing some performance regression after upgrading to npm 7. Below some benchmarks where npm 7 is always slower than npm 6 in my case.
System:
|
I have established that the problem specifically manifests when With npm v6, performance is more or less the same whether running in a mounted folder, or a "local" (to the container) folder. With npm v7, performance in the mounted folder is up to 3 times worse. In case it helps, I whomped up this benchmark to highlight issue: https://github.com/n3dst4/npm-docker-spike (You'll need docker installed but the script takes care of everything else.) Also for the record, I have seen this degradation in docker running on...
It would be interesting to get some more folk to run my benchmark (or critique it to shreds). |
@darcyclarke Just checked, and this is still a problem in npm 7.12.0 - any news internally? |
I've just tried this in npm 7.19.0, and not only is it still an issue, the performance degradation is even more pronounced! Running my benchmark tool (above) previously showed a 3x perf degradation when using npm 7.12.0 in a mounted volume in docker. With npm 7.19.0 the baseline performance has improved and the in-mounted-volume performance has degraded even further so it's more like a 8x degradation now! These are the benchmark results, annotated: First, results with npm 6, in a mounted volume. The first one is slow then the next two are ~12 seconds:
now npm6, nut running in a local folder inside the container (not a mounted volume). The numbers are similar, slightly quicker:
Now we upgrade to npm@latest and do it all again. HUGE PERF LOSS when running the test in a mounted folder. Like 4x slower than npm 6! This is even worse than npm 7.12.x.
Finally, running with npm 7.19.0 in a local folder (not a mounted volume). npm is fast, who knew?
Npm 7 definitely has a performance issue when running inside a mounted volume in a container. if that's a side-effect of recent perormance wins, and it's not going to be fixed, we need a clear statement to that effect. Otherwise, it needs fixing! |
Its not only a CPU time issue. In my CI system, runners have been historically allocated 1024mb with 0 issues. Once upgraded to npm@7, a simple script running Very much related: #3208 |
@darcyclarke any news on this issue? Unfortunately, I am still experiencing the performance issue :/ See #3208 (comment) for a reproduction for |
We just upgraded our CI environment from npm 6 to npm 8 and installs are taking 6-10 times longer. |
See this astonishing comment #3208 (comment) for a slight mitigation of the issue. TL;DR: |
I can confirm, using |
Can confirm the slowdown from our side as well, haven't quantified but at least 2x the time for a |
Just checking in to record that the issue persists in npm@9 I am confused on how the tags should be managed. "Release Y.X" descriptions say "associated with a specific npm Y release", but this issue affects all npm >=7.0.0 releases known to date. Yet, I guess the "Release 9.X" tag should be just as present as former tags (absent IMHO). |
related: npm/cli#2011 related: npm/cli#3208
I can confirm that creating an empty "node_modules" folder before calling Here is a verbose output of npm.
After, with an empty node_modules folder created just before running
Note the enormous difference on the |
I've tested this node_module dir creation hack and it yields zero benefit in our setup (GH Actions). Snippet from the workflow: steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
- name: Create node_modules dir
run: mkdir node_modules
- name: Install Dependencies
run: npm ci |
related: npm/cli#2011 related: npm/cli#3208
Could possibly be related, I seem to have a minimal reproduction case. We seem to see an large performance degradation impact from loading npm, e.g. for use with npx XYZ. Something up with the A few things that are odd:
Other notes:
i'll investigate further in the morning (npm v9.7.2)
vs: (npm v6.15.13)
from the error logs of above.
|
I don't know what you guys fixed, but thank you! Our npm installs have been slow for quite some time, taking 20+ minutes in some cases on a scorched earth install. Now with npm 10.1.0 it's less than a minute. |
@billyjanitsch and @dmaicher could you please run the tests once more following this comment? |
For whatever reason now NPM 6 is incredibly slow for me 🙄 NPM 7.24.2 and 10.4.0 have pretty much identical performance for me. I cannot really compare it to my old benchmark though as my environment is completely different. |
Just for giggles I updated my repro to npm 6, 7, and 10, and pnpm 9. npm 7 "still" has the regression but npm 10 does not. I did not establish which version it was fixed in, (As a side note, pnpm is about twice as fast though, and has no appreciable difference in performance between a bind mount and a local folder when running in a container.) If anyone at npm sees this, I think this ticket can be safely closed :) |
I am using Instead of caching
Time reduces from
|
Current Behavior:
Hi! I've upgraded around 10 projects from npm@6 to npm@7 and I've unfortunately found npm@7's
install
/ci
commands to be significantly (30-200%) slower in practical situations, across all of the projects that I've tested. Specifically, in the cases of:install
with no package-lock ornode_modules
, and cold~/.npmrc
cacheinstall
with no package-lock ornode_modules
, and warm~/.npmrc
cacheinstall
with a package-lock but nonode_modules
, and cold~/.npmrc
cacheinstall
with a package-lock but nonode_modules
, and warm~/.npmrc
cacheci
with a package-lock but nonode_modules
, and cold~/.npmrc
cacheci
with a package-lock but nonode_modules
, and warm~/.npmrc
cacheExpected Behavior:
Various posts/comments have suggested that npm@7 would be faster than its predecessor. I know that the bulk of the install logic was rewritten so I understand that there are bound to be some performance regressions (or at least differences in performance characteristics) but it currently seems to be universally, significantly slower. I know this was a huge release so I hope I don't come across negatively; I'm hopeful that this can be improved over time.
Steps To Reproduce:
I understand that there are many factors involved in benchmarking performance: hardware, software, network connection, etc., and a particular set of benchmarks doesn't mean much on its own. But the relative difference has reproduced consistently across multiple developer machines and CI boxes, as well as across a variety of
package.json
files with completely different sets of dependencies.With that said, below are some scripts I put together to demonstrate the relative difference. The setup for each one is a directory containing only a valid
package.json
, and an installation of eithernpm@6
ornpm@7
. I believe that I was careful with scenario setup (ensuring that caches are in the correct state, ensuring that package-locks are generated appropriately, etc.) but feel to let me know if you think any of this logic needs adjustment.Cold cache, without package-lock or node_modules.
Warm cache, without package-lock or node_modules.
Cold cache, with a package-lock but without node_modules.
Warm cache, with a package-lock but without node_modules.
Cold cache, with a package-lock but without node_modules (
ci
).Warm cache, with a package-lock but without node_modules (
ci
).So far, npm@7 has been slower than npm@6 in all 6 scenarios for every
package.json
file that I've tested. (Here are some examples, varied across number and uniqueness of deps: 1 2 3 4.)I'm interested to know whether you see similar results. Let me know if there's any more data I can provide. Thanks, and congrats on the release!
Environment:
The text was updated successfully, but these errors were encountered: