Database to choose for game
I'm working on a game (something l开发者_JAVA百科ike chess) where every move needs to be saved into a database per move.
Since it's very important that both reads and writes are fast, and I don't need complex queries, I'm probably going to go with a NoSQL solution.
Which one though? I'm thinking about MongoDB but will its durability be an issue?
It's not the end of the world if some game movelists are corrupted, but would be problematic if it occurs too often.
Suggestions?
Thanks.
Just about any database technology would work in your scenario. There are no compelling reasons (that you've given, anyway) that would recommend "NoSQL" style data access over any other technology.
Last time I looked at a chess game you would need about 1 insert every 5 minutes. You could use LDAP server for that. But of course I do not know your use-case.
Mongo-db excels for document like records where you would want to extend the information over time. It has a nice ad-hoc query facility and is relatively speedy, which means about as fast as mysql database on the same machine.
In first view your data looks to be highly structured so the document flexibility will not add a lot of benefits.
If you have a huge number of records (like in many x10^6) then it will show the difference.
Now if you want to use mongo-db, fine, you probably won't be dissappointed, but I see no compelling case here.
If your database have more than one table, than NoSQL is no starter. I can immediately think of two: Positions and Moves.
The only advantage I can see to a mongodb or couchdb is that you could conceivably store the entire match in a single record, thus making your data a little simpler. You wouldn't have to do the traditional one to many mapping between moves table and a game table. CouchDB could be interesting because it supports offline transactions and a pure rest interface so all your code could be javascript. But you probably don't want your users to directly interface with the database!
精彩评论