I successfully verified that using node 4.6.1 works properly, the problem is with pm2. I use pm2 to run clusters and there is a problem there:
Running node main.js works but pm2 start main.js does not, pm2 fails even when I type and pass the --interpreter=~/.nvm/versions/node/v4.6.1/bin/node parameter to be sure the proper version of node is used.
Let me know if you have the same problem or find a solution
In my case, the problem was that PM2 in cluster mode only uses the node version where PM2 resides… I installed PM2 using node v6, so, in cluster mode will always use that version.
Running the app in single fork mode works as long as you apply nvm use 4 (in case you are using nvm) before running the app
Also, be sure to run npm install in /programs/server with the proper version of node too, I had the node modules installed with v6 and that was causing trouble using v4
If you don’t have multiple versions of node installed then the problem is more interesting than that.
On the browser console, run Meteor.call('test','hi123',function(err,result){ console.log(result) });
When using the meteor node, cpu usage level returns to zero after the call, while using the node v6.9.1 causes the cpu usage level goes to 25% and stuck, which means whole cpu core is consumed…
But the problem is that I cannot use meteor node with forever on node v6.9.1 . At last, I switch to node v4.6.2 via https://github.com/coreybutler/nvm-windows , so that I can keep both versions of node while using forever to run meteor.
I had the same issue with the latest pm2 version (2.1.6) and node 6.9.1. I removed autopublish and insecure that I forgot, downgraded node to 4.6.1.
Autopublish and insecure don’t seem to change anything to the CPU usage, but that’s always a good thing to do.
The node version on my ubuntu server is the deal breaker. I tried switching back and forth from 6.9.1 or 6.9.3 (LTS) and 4.6.1 and I go from 100% usage with node 6 to 1 or 2% with node 4.
Is this because Meteor’s node version is tied to node 4 ? I thought it would use the bundled version anyway ?
I’m currently experiencing the same problem
Almost no load in dev mode, but once bundled and running as a docker container. It consumes 100% cpu.
Node version of the container is 4.6.1 and I’m not using pm2.
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.
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…
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.
On my live bundled app.
I’m using Meteor 1.4.3.2
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
or
$ forever start main.js
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.