How do you guys deploy on multicore machines (e.g. a digital ocean droplet)? Kadira Cluster seems to be no longer maintained, is it safe to use on production apps? What about Phusion passenger?
If you’re using MUPX to deploy it supposedly has support for cluster built-in.
PM2? http://pm2.keymetrics.io/docs/usage/cluster-mode/
I can’t vouch for cluster mode because we run single core servers but PM2 itself is pretty good.
PM2 clustering does not work with sticky sessions (open issue) which is generally a requirement for Meteor apps.
Based on some of the open issues on meteorhacks:cluster it looks like at least the multi-core support should be mostly stable. I would love to see this decoupled as a separate package and actively maintained. If somebody wants to pick this up, we would be willing to sponsor the effort.
Why would you want multi-core support? Just run X amount of $10 DO instances using Cluster.
It’s as cheap and saves you all the hurdles.
It’s not quite as simple as that. There is an overhead associated with each machine when scaling out (especially on dedicated VMs) and clustering processes doesn’t boil down to just one per CPU core.
Can you elaborate more?
I learnt that it is the opposite in fact. Scaling up (more cores per machine) is always worse than scaling out (multiple machines)
Good point RE sticky sessions. You could however run multiple instances of an app on different ports with PM2 (not clustered) behind a load balancer that supports sticky sessions (e.g. haproxy). Probably not ideal though.
I agree with @satya though, easier to just scale out not up. For Meteor apps CPU is the limiting factor so it’s almost always better to scale out.
To give a real example using Linode VPS: Say you want 20 instances of your app running, you could get a 20-core VPS (80GB RAM) for $640/month, you wouldn’t use most of the RAM. OR you could get 20 x 2GB RAM VPS (40GB RAM) for $200/month. You probably still wouldn’t use that much RAM if running 1 app per server but it’s less than 1/3 of the cost of the larger server, plus you have redundancy.
Alternatively you could pay for 10x4GB RAM or 5x8GB RAM for exactly the same price ($200) while minimising the overall overhead of your setup and retaining redundancy…
Could you explain why you might want more clustering processes than there are CPU cores? I’ve read other people having up to 70 and 80 processes? Why?
Also, have you ran into this currently open cluster
issue then using it in multi-core mode? Seems it has to do with multi-core mode.
Yeah, that is one of the main sources of unreliability (in the multi-core mode) along with:
For those who are still interested this:
As of v0.2.25, the Azure IISNode module now has support for multi-core load balancing with session affinity (similar to Phusion passenger).
If you want to use this in a PAAS, you can try Azure App Service. We’re maintaining the meteor integration here, and we’ve added a section in our docs for getting this set up.