NodeJS clusters - do they share anything?
Problem
How does node cluster work? Is it a share nothing architecture? Is the session guaranteed to be directed to the same worker? The docs are pretty sparse.
Thanks!
Solution
No, they are not guaranteed to be directed to the same worker based on a session. It generally follows a round-robin pattern to load balance the connections, but this is determined by the operating system (more info in this Discussion - https://groups.google.com/d/topic/nodejs/svIXu5wUXCI/discussion).
If you need to access data for a specific session I would recommend storing the data in some kind of a data store - either your database or some in-memory store for faster access (e.g. Redis).
Discussion
View additional discussion.