Storing socket.io socket object in memory and synchronizing within node processes Storing socket.io socket object in memory and synchronizing within node processes mongoose mongoose

Storing socket.io socket object in memory and synchronizing within node processes


The most common approach is to use a database like Redis and, for message passing, a queue system like Kue. It's extremely common to use a queue system like RabbitMQ, Resque, or Kue to enable IPC. At some point, you will outgrow one server anyway and need to be able to communicate on processes between servers.

Update:

Because Node is explicitly single process, it is not optimized for multi-process communication. This makes particular sense for environments like Heroku and small EC2 instances, where your architecture is to scale horizontally across many machines, rather than trying to satisfy all demand from a single big server. This is called horizontal, share-nothing scaling, and is a core principle of 12 factor design.