I'm building a website where players can play a turn based game for virtual credits (like a Poker site, but different). The setup I came up with:
- One data server which contains all player accounts with associated data (a database + service). Database and API may be split into two servers, if that helps.
- One or more webservers which serve the website, connecting to the data server when needed.
- One lobby server where players can find eachother and set up games (multiple is possible, but less user friendly)
- Multiple game servers where the game is run (all rules and such are on the server, the client is just a remote control and viewer), with one load balancer.
- A game client
The client will be made with Flash, the webserver will use PHP. The rest is all Java.
Communications
- Player logs in on the site. Webserver sends username/password to data server, which creates a session key (like a cookie)
- Player starts the client. Client connects to lobby server, passing the session key. Lobby server checks this key with the data server
- Once a lobby is created and a game must start, the lobby server fetches a game server from the load balancer and sets up a game on this game server.
- Lobby server tells the clients to connect to the game server and the game is played.
- When the game is finished, the game server lets the lobby server know. The lobby server will check the score and update the credits in the data server.
Protocols:
- Java to Java: RMI
- PHP or Flash to Java: Custom binary protocol via socket. This protocol supports closing the socket when idle while keeping the virtual connection alive and resumable.
If the client has his wishes, the site will need to support thousands of concurrent players. With this information, can you see any bottlenecks in my setup? I'm personally a little bit worried about the existence of only one data server, but I'm not sure how to split that up. Other scalability (or other) remarks are also welcome.