Locally on OS X my meteor app works great, but on the production Ubuntu14.04, it sets the CPU to 100% just by running the app… without any visits
I used the “meteor build ../ --architecture os.linux.x86_64” command to create the bundle. On the server the installation of the npm packages went smooth…
Any idea, why this is happening?
Also, my ubuntu server has 4 cores and if I use pm2 to run in cluster mode, it eats all of them
EDIT:
Copied the full meteor project to my server. Running the app with the meteor command works fine and shows decent CPU usage.
Created the production bundle inside the server and running the bundle eats all the CPU…
So, running with meteor works good, using the node option makes the CPU cry
When I start the (built) application the CPU usage is normal until I login in. After logging in the CPU stays at 100%.
I tried to profile the application but couldn’t figure out what is wrong.
I have faced the same problem before. For me the problem is, I forgot to remove the autopublish and insecure packages from meteor. Therefore the entire collection was being published to the client during the startup that causes the high CPU usage during the deployment.
In your case you might have some different problem. But I just wanted to give a heads up.
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.