Advertisement

[java] Tough Question: Handling data

Started by December 19, 2000 12:58 AM
6 comments, last by moregames 24 years ago
Whats the best way to store and load data for a java game server? There will be a lot of storing,loading, updates, queries going on. RandomAccessFiles? Saving objects to files? Database (and if so which free database is the best? Enterprise/MySql/Postgresql ?)
The game will need 1) speed, 2) stability (no corrupt data if the server crashes), 3) easy to implement
I''d recommend using a database of some sort. Reading and updating information from/to a database using JDBC is very easy, and very fast (especially if you use a connection-pool).
As to what database to use, if the server is running under Linux I''d heartly recommend Oracle, as it is fast, stable, and free. Otherwise I don''t know.

Neophyte

- Death awaits you all with nasty, big, pointy teeth. -
Advertisement
Oracle has definitely been the fastest in my experience. Don''t bother with Postgresql - I''ve heard it''s one of the slowest of the free databases. MySQL, is supposedly quite quick. InstantDB is a good free java db option - but I don''t know how it compares to MySQL (which after all is native code).

In terms of the game server speed though it really depends what kind of data you''re sending back and forth. It may be worthwhile considering implementing some sort of cache in your game server (Hashmaps, lists, whatever). Spool chunks of the data through at the beginning of the game and keep it in the middle layer while the game is running.
Anything that needs to be persisted (such as scoring, character position, etc), can be picked up by a separate thread (or even a separate process if you want to use RMI), and saved to the database periodically - so the impact on the performance of the server engine is minimal.
Thanks for the response. Has anyone had any experience with Borlands Enterprise server? I want a database than will work for both linux and windows. That way there will still be options for portability. I''ve heard MySql is a database mainly used for webservers that like updating news and stuff. That it isn''t to great for games even compared to PostGreSql.
In my experience I''ve found that Microsoft SQL server is the fastest that I''ve used, but for the easiest to handle and maintain I''d suggest the 97 version of microsoft access. But access cannot handle more than a few hundred users, but that''s where sql server is great. I mean for thousands of users. I guess it depends on whether or not you have the ability to install software on the wb server you are using or not. If you cannot install software, try using an ms access database file. anyway that would be my $.02 Good luck

Andrew
Ok, i''ve worked with MS SQL but i need a free database for this project. Seriously I would rather use Mysql, Interbase or PostgreSql over access.
Advertisement
I wouldn''t touch Access with a 50 foot barge pole, myself.

I''ve used Oracle, Sybase, InstantDB, MySQL, Access (& SQL Server, briefly). Oracle was definitely the best out of the commercial databases - features, performance, and Java interaction.

What sort of game are you writing the server for? Like I mentioned earlier, it really depends what sort of data you''re sending back and forth.
I''m working on a sparetime project: a java mud. The server will be saving player stats, equipment, health etc. back and forth.

This topic is closed to new replies.

Advertisement