You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With default metrics enabled app eats ~60% of CPU. Without - ~0.1%. Node version 8.1.X.
If I have some time to look, I'll provide some additional info.
UPD:
It seems that problem is somewhere in general code, not specific metric, because even "version" metric eats 6-8% CPU. If I enable more metrics, it eats CPU proportionally.
Oh, that's interesting. The only thing that really changed is timestamp support (#69 and #103). Other than that, just how metrics are constructed and ability to merge them, neither of which should impact runtime performance.
Do you see the same thing with metrics without timestamps? Or if you remove timestamp support entirely?
@SimenB I've run with CPU profile and it shown that most of time it spends in "idle" state (aka (program)), so nothing unusual. It shouldn't eat so much CPU.
My code is in the first comment :). Just add setTimeout or setInterval to prevent node process to exit. I'll try to find out which commit causing this a bit later.
If not, I've created this Dockerfile and I'm ready to start bisecting
FROM node:8
USER node
WORKDIR /home/node
RUN git clone https://github.com/siimon/prom-client.git
WORKDIR /home/node/prom-client
RUN git checkout v8.0.0
RUN npm install --only=production
RUN echo "var m = require('./');\nm.collectDefaultMetrics && m.collectDefaultMetrics();\n\nsetInterval(() => console.log(m.register.metrics()), 1000);\n" > testFile.js
CMD ["bash"]
Activity
SimenB commentedon Jul 7, 2017
Oh, that's interesting. The only thing that really changed is timestamp support (#69 and #103). Other than that, just how metrics are constructed and ability to merge them, neither of which should impact runtime performance.
Do you see the same thing with metrics without timestamps? Or if you remove timestamp support entirely?
SimenB commentedon Jul 7, 2017
Diff: v8.1.1...v9.0.0
SimenB commentedon Jul 7, 2017
Just removing timestamp from the default metrics made no difference
SkeLLLa commentedon Jul 7, 2017
@SimenB I've run with CPU profile and it shown that most of time it spends in "idle" state (aka
(program)), so nothing unusual. It shouldn't eat so much CPU.SimenB commentedon Jul 7, 2017
hmm, I just see the issue on v10, not v9.
sup.js:
Then
git checkout v9.1.1 && node sup.jsin one terminal, andgit checkout v10.0.0 && node sup.jsin the other.Top one is v10
SkeLLLa commentedon Jul 7, 2017
@SimenB for me it reproduces on both: ^9.0.0 and ^10.0.0
SimenB commentedon Jul 7, 2017
Running on node@8 puts v10 at 12% instead of 16%, but v9.1.1 stays at the same (0.1%).
Odd!
SkeLLLa commentedon Jul 7, 2017
Here's CPU chart. 9 is on the left, 8 on the right:
http://i.imgur.com/0ypaho2.png
SimenB commentedon Jul 7, 2017
v10
--profoutputv9
SimenB commentedon Jul 7, 2017
Weird that we're getting different results...
This commit is what drove cpu usage through the roof on my machine: c8a32d9
SkeLLLa commentedon Jul 7, 2017
Probably that's because I use linux :).
v9 results:
v8 results:
SimenB commentedon Jul 7, 2017
I don't get JavaScript. The diff fixing the crazy CPU usage for me is this
SkeLLLa commentedon Jul 7, 2017
@SimenB
doesn't equal
:)
SimenB commentedon Jul 7, 2017
Oh, hahaha. So we passed
undefined....SimenB commentedon Jul 7, 2017
Well, then... 10.0.2 published! Thanks for spotting it. /cc @siimon (I deprecated 10.0.0 and 10.0.1)
But that still leaves your issue, @SkeLLLa. I can't reproduce on v9. Do you have a script I could run to test it? Which OS are you on?
EDIT: Oh, Linux. I'm on a mac
SimenB commentedon Jul 7, 2017
Are you able to bisect which commit causes the issue?
SkeLLLa commentedon Jul 7, 2017
My code is in the first comment :). Just add setTimeout or setInterval to prevent node process to exit. I'll try to find out which commit causing this a bit later.
SkeLLLa commentedon Jul 7, 2017
@SimenB With 9 version - it just my bad, because I used code from v10 with v9. So in v9 it received object instead of number for
interval.SimenB commentedon Jul 7, 2017
Oh, so v10.0.2 fixed the problem?
SimenB commentedon Jul 7, 2017
If not, I've created this Dockerfile and I'm ready to start bisecting
SkeLLLa commentedon Jul 7, 2017
@SimenB 10.0.2 is fine.
SimenB commentedon Jul 7, 2017
Perfect, thanks for pointing it out!
Don't poll default metrics every single tick