-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
process.report.getReport
slower from 20.2.0 to 20.3.0 on Linux
#48831
Comments
process.report.getReport
24x slower from 20.2.0 to 20.3.0process.report.getReport
slower from 20.2.0 to 20.3.0 on Linux
As discussed at libuv/libuv#4098, the slowdown is not related to
On my machine it took 600ms (32 cpu), on another machine it took less than 1ms (12 cpu), and on another, it took 1.6s (16 cpu), so this problem is very strange. If we call I proposed to add a flag on In this case, unless we remove the call for This issue could mainly affect native bindings with NodeJS because they use |
|
Oh, that's why I saw random slowdown/stuck in my machine, probably introduced by npm/npm-install-checks@ebf9b9f /cc @nodejs/npm |
We can use the implementation that I created for lovell/detect-libc#19, is much faster and solve the issue with the slowdown caused by getReport. I will probably open a PR soon (when I had more time to investigate and confirm the issue) |
For anyone run into this, here's a workaround (if you are using glibc, e.g. Ubuntu, change to
|
@Tofandel the network could affect but the main issue is probably the uv_cpu_info that we can't avoid without introducing a new flag, which I think could be the best scenario along with updating the npm code. But I can later try to build nodejs in your branch to confirm. |
Is it 384 core or logical processors? I'm guessing if you have 384 core you have double the logical processors and uv cpu info runs for each of the core synchronously, and the function might not be very fast 4 seconds for a debug function would be considered long but acceptable, but since it's not only used as a debug function, then instead of adding more and more flags to it, we just add options and if possible make it async |
@Tofandel My bad,
|
It seems its actually 96 real cores and 192 logical cores (1 socket with 96 core per socket * 2 threads per core) Is it maybe an AMD specific issue? Would be nice to see if it's a common factor to see where to look |
Hmmm you are right, thought it was a 2-way machine |
It seems it's just randomly slow for me as well (8 real cores - Intel), so not just AMD time sudo cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq
4000009
3999975
4000000
4000000
4000031
3999999
4000040
4000113
real 0m0.010s
user 0m0.007s
sys 0m0.003s time sudo cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq
4083445
4027384
4078306
4092856
4023428
4094010
4097951
4153294
real 0m0.166s
user 0m0.009s
sys 0m0.001s It seems to depend on what the cpu is doing at the moment, if the cpu is at rest with a lot of idle time it becomes slow |
Script:
On Node 20.2.0:
On node 20.3.0
I did a bisect and the commit that introduced this slowdown was bfcb3d1, which is the upgrade of
libuv
.But the actual problem was introduced (I think) at libuv/libuv@434eb4b, the slowdown is caused because instead of assuming the same information for all CPUs, now
libuv
read the/sys/devices/system/cpu/cpu%u/cpufreq/scaling_cur_freq
for every CPU.I'll also open an issue on
libuv
, but I want to keep it open just to track this slowdown.My machine:
cc @nodejs/performance
The text was updated successfully, but these errors were encountered: