Lets say I want to run 3 different servers. Which of these is better ? -
- 3 VM instances, single cpu, running the app, with a load balancer in front.
- Larger VM instance with multiple cpu’s and cores. Use pm2 to run multiple instances of the node app and load balance among them.
#1 pros - a single instance dying doesn’t take the rest down. Separate ip’s and machines. Can use external tools like AWS load balancer.
#1 cons - can scale easily by just adding more servers
#2 pros - simpler to setup, integrated monitoring, cpu/resource locality
#2 cons - not sure how pm2 can load balance across multiple machines, can’t use standard tools