Meteor bundle on production 100% CPU

Are you using the 32bit or 64bit version of node 4? It might be one of factors too.


…I must type 20 characters in order to post…

I’m gonna try to run a v8 cpu profile and see if that brings something up, but for that it would be useful if support for node 6 lands, with a lot of build-in v8 tooling.

You are using Meteor 1.4.2?

Yep, to be precise

Okay, I remembered that good old Kadira has a CPU profiling feature based on v8-profiler on my paid plan.

Cool thing is I can share them, so here is the CPU profile I took:

Except for the client requesting the CPU profile, there were 0 other connected clients. So the application should be idle, but was running at 100% CPU.

I’m yet to learn how to interpret the profile correctly, so if anyone is experienced in this, he might come to a conclusion faster…

Can you send me the raw *.cpuprofile file? I know how to read them pretty well

1 Like

Was it bundled with 4.6.2 or a higher version? It needs to be bundled, and run with the same version ideally. Meteor apps bundled with 6.x or 7.x always run at 100% CPU. This is a major issue MDG should look at, they advice what node to run the apps at, but do not state (to the best of my knowledge) they need to be bundled with it too.

Just install N and run n 4.6.2 to quickly switch :slight_smile:

This happens to me too.

On my live bundled app.
I’m using Meteor
Node 4.6.2
Ubuntu 16.04 x64

It turns out PM2 (Advance Node Process Manager) was the culprit.
Works fine when I run my app with plain node and foreverjs
$ node main.js
$ forever start main.js

Switched to foreverjs for now.

Please let me know how they go over time. I tried using forever instead of PM2 too, it worked for a little but as soon as connections started hitting the server, it jumped straight back up to 100%. Since reverted back to PM2 and found the actual issue root cause, for my deploy at least (mentioned above).

We faced the same issue, CPU shoots up as soon as you make any method calls, then slowly goes down. Even if we comment out most of what is in the method. We reverted to Node 4.6.2 on both development and host and all is working well now. PM2 is also working as planned, so it was not the culprit and I don’t see why it would be.

Haven’t tried with recent node and 1.4.3 meteor, but seen same 100% of cpu with node 6 and node 7 ~ month ago.

Make sure you dont have facts installed, I installed for debugging and forgot about, once I removed CPU when from 100% to 3-5%

I have the similar trouble:

Node v4.7.3
Deployed with Passenger (more details [here] ( stackoverflow).

Works fine for some time then cpu usage flies up to 100%.
By the way, the app has a few hundred intervals triggered every 5 sec and making changes to Mongodb (which runs fine on another instance). Could it be a cause?

Well, according to the deployment guide, you have to use specifically Node 4.6.2. So if you’re using any other version you should fix that first.

That’s something new to me ) Should I use Node 4.6.2 on dev. server (where I run meteor build) or production server (where bundle is been deployed) or both?

On the production server.
Meteor is bundled with its own version of Node, so you don’t need to worry about it in development.

1 Like

Ok, thnx. I’ll try and let you know.

Worked fine almost twice longer than before, but then the same has happened. Rebooting instance doesn’t help, as before.
Noticed that some of my setInterval callbacks does not return anything. May it be a problem?

Downgrading from Node 6.9.1 to 4.6.2 solved the 100% CPU usage issue on Centos 6.8. Thanks for the tips!