Opinion: Server type selection: 1CPU

Hi,

For those rather new to NodeJS (which Meteor is based on).

Keep in mind that Node uses a Single Threaded Event Loop Model meaning, you are limited to 1 processor. Node has a way to run multiprocessor, described here: Cluster | Node.js v22.2.0 Documentation, however, with Meteor we use horizontal scaling ( elastic computing, add more machines behind a load balancer or reverse proxy ) and vertical scaling, use a more powerful machine or batch of machines.

Case: AWS has this T3.micro EC2 with 2 virtual CPUs (vCPU based on Intel Xeon at 3.3 Ghz) and a total of 1 GB memory. This is a cheap one for small projects, tests, etc. However this memory is actually 1/2 GB per vCPU. This means, you will only use half the machine (and pay for all of it) and at a load of up to 500 MB memory (roughly 30-50 users) this machine will fail.

When you select hardware or virtual hardware in any cloud, go for single processors, CPU or memory optimized, depending on your app specifics, or a general use machine with a good balance of both processor and memory.

This is a list of all EC2s in AWS sorted by number or processors: Amazon EC2 Instance Comparison

I always used a provider for Mongo and I am not familiar with deploying multiple apps on the same server. I would love to understand multi app multi CPU contexts. For instance, how Meteor + Mongo run on a 2 CPU server versus how they ar allocated in a single CPU. In theory can you run Meteor + Mongo + Redis on a 4 core machine, each with its own processor? Is this done by default by the Linux or the Node stack, like detecting multiple apps and dedicating processors to them?!

1 Like

I could be wrong but I don’t think that’s how computer works. If nodejs run on a single process, it doesn’t mean computer needs to dedicate 1 cpu core for that one.

What would be your understanding from this, if I may ask: Clustering In NodeJs. When multiple CPU cores are available… | by Jatin Jain Saraf | Medium