Welcome Guest, Not a member yet? Register   Sign In
database structure & performance for an online multiuser game
#1

[eluser]itsme[/eluser]
I have to develop an online multiuser game and i ask for your suggestion to increase the performance and the database structure, below is the game details:-


1-The game is like a chess game
2-Each registered player can create a room and invite another players to join this room and play with him.
3-Each room contain 4 players playing with each others and a lot of Viewers(only watching).
4-Once the game started each player will do something (action) then the next player and so on.
5-once the active player play, a message must be sent to the 3 others players in the room to notice them that the player has been played and the next player must play now.
6-Once the game is finished the all action made by the player will be deleted (since it has no value now).


7-Imagine that there will be 400,000 registered players and each one has created a room.
8-Imagine all the player become online, and they decided to play with each others there will be a maximum 100,000 active rooms,containing the all online players(each 4 player in one room).

The problem here with the performance
for each room there will be 3 players listening to the server waiting for the active player to play
(ie: each second they will send a request to the server to ask him Did the active player play or not? this means that there will be 3 requests per second for each room ).
3 request * 100,000 room = 300,000 request per second.

This will make overload on the server .
Each request will require a data from the database (i supposed that the actions(history) will be stored in the database), this mean that 300,000 db request, each request may execute one or more query).



I read about this problem i found that , i can use a comet technology to overcome the overload on the server
and may using memory or file system instead of the database to store the actions which will increase the server response and also to decrease the load on the database server.


If any one has a suggestion please write it .







#2

[eluser]gRoberts[/eluser]
Have you thought about using WebSockets and Push Technology?

It's relatively new, but lends a hand to situations such as this, as it will "push" updates to the browser letting you know someone has moved etc.

http://www.websocket.org/echo.html

This could reduce the amount of requests being made on your server significantly.
#3

[eluser]itsme[/eluser]
thanks gRoberts, for your reply
WebSockets's problem is that most of the existing browsers and the proxies did not support it until now and

Push Technology is a comet technology as i mentioned above.

what about actions, Is storing it in the database is better than storing it in files on the server ?
#4

[eluser]srpurdy[/eluser]
[quote author="itsme" date="1337296388"]thanks gRoberts, for your reply
WebSockets's problem is that most of the existing browsers and the proxies did not support it until now and

Push Technology is a comet technology as i mentioned above.

what about actions, Is storing it in the database is better than storing it in files on the server ?[/quote]

That depends on how long those actions are relevant. If they have a short life span in terms of how much that action matters. It probably won't make that much of a difference.

I think what you need to do is these actions need to be triggered rather than keep asking a question if something has happened or not. The client side application needs to make the request. Maybe I'm mis-understanding your explanation.

So in other words. The client application sends.
1. I made a move.

Server application says.
1. Okay thank you I will inform the other players that player 1 has made a move.

This would be much more efficient than sending meaningless requests.




Theme © iAndrew 2016 - Forum software by © MyBB