Does it make sense to have multiple instances of meteor per server?


#1

Does Meteor make better use of a multi-core server by using the fibers library than a traditional nodejs application?


#2

It depends purely on what problem you are trying to address.

A common reason why people would consider running multiple instances of Meteor is if their Meteor webapp is saturating the Node.js event loop.

This is better handled by either of the following:

  1. Finding the cause of the high CPU usage and seeing if their algorithms or design can be reengineered to make it more efficient.
  2. Modifying the webapp so that the CPU intensive code runs asynchronously in the Node.js threadpool
  3. Using the Node.js cluster module to spawn additional worker processes which can then communicate with each other and/or the main parent process.

#3

To me it makes sense when one server is sufficient and you have a load balancer in front. Then you can update the instances one after another without downtime.


#4

Erm, you can do that without any downtime even with a single instance of Meteor running.

For example, I’m unpacking the build folder into a folder named with a timestamp, simply update a symlink and then a simple pm2 restart app_name will do the trick.