Using a separate VM instance for handling Socket Connections Vs Using same instance where Node is running?
I have two Node servers that are handling HTTP requests. Now we need to enable socket connections in order to send realtime notifications. What are the pros and cons of the following approaches :
Hosting Web Socket Server in a separate VM and letting clients connect to that instance
Hosting the socket server in same Node instances that are handling HTTP requests
It all depends, how much traffic are you getting, how many connections will be kept open and what OS you are running. If you are running Linux, you will hit a connection limit eventually, that limit is usually massive, run cat /proc/sys/fs/file-max to see your connection limit.
The benefit of running both node instances on the same machine (I'm assuming you're talking about VM as in VMWare type of VM and not AWS / GCE VM instances), assuming you have at least a dual-core, is that each will utilize a core properly instead of just utilizing one core.
If you're using AWS / GCE type of VMs, have a look at Kubernetes, it'll allow you to run all your apps on one cluster, but add machines to the cluster as needed.
Jan Vladimir Mostert
Idea Incubator
It all depends, how much traffic are you getting, how many connections will be kept open and what OS you are running. If you are running Linux, you will hit a connection limit eventually, that limit is usually massive, run
cat /proc/sys/fs/file-maxto see your connection limit.The benefit of running both node instances on the same machine (I'm assuming you're talking about VM as in VMWare type of VM and not AWS / GCE VM instances), assuming you have at least a dual-core, is that each will utilize a core properly instead of just utilizing one core.
If you're using AWS / GCE type of VMs, have a look at Kubernetes, it'll allow you to run all your apps on one cluster, but add machines to the cluster as needed.