My first programming language is PHP, which results in a stateless webserver. Each request you have to rebuild your state.
Now that I’m happily doing Go, I want to give a shot at creating a webbased browser game. I can keep state/data in memory; good candidates are game-wide structs.
But my question is; Can/should per-user data be stored in memory?
Pros: Things will be fast, I won’t have to do (as much) database transactions
Cons: It won’t scale well with lots of concurrent users
For a starting game the ‘concurrent user’ issue is probably a non-issue. The ‘will be fast’ is also quite relative, as the frontend will have JS and images and browsers still take more time rendering.
I understand this is quite a big ‘It Depends’ question, but I’m curious about examples/thoughts out there.