Hey guys!
So, I am feeling a bit 'worried' about how my server architecture is designed for my game so I decided to create a flow chart (very bad) instead of trying to explain everything:
So, everything is working fine. I am using the PM2 module to manage the node instances.
Here are some questions / concerns I have surrounding my above setup.
1. If Player a is on 9300 and Player B on the 9301 instance, and they are chatting or in a game together; the server would have to use ALOT of Pub Sub signals. (Movement positions, if a player used a skill, etc, etc). Wouldn't it be far better to somehow get those player's on the same instance so I don't have to keep on Pub Subbing between nodes? If so, how would I go about doing that? -- Or is this how it's supposed to be when scaling instances with Redis? Should I rely on Redis` Pub/Sub feature for that, or use something like ZeroMQ maybe? I just need Redis to share memory across the instances.
2. Now, what if I add another server in the same data center. I would obviously add those inside my nginx upstream block, but then what if two players are on two different servers and trying to communicate. I would then be Pub Subbing between servers and instances! Am I over-thinking all of this, is this all premature optimization? Or do I have a right to be concerned about Pub Subbing, I just keep thinking I am doing something wrong and that sending a ton of Pub Sub signals across instances makes me feel uncomfortable.
I feel like if I get the player's onto the same node instance, it would minimize latency lag. But that way wouldn't scale very good as ultimately 1 instance could end up with a ton of player's on it. And that would void the idea of utilizing Redis in the first place.
Sorry for the long, drifted questions, just trying to wrap my head around things. Thanks for reading, and looking forward to some advice!