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.
Problem courtesy of: CamelCamelCamel
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).
Solution courtesy of: Lalit Kapoor