Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (538)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (600)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Database for gameserver  (Read 4199 times)
0 Members and 1 Guest are viewing this topic.
Offline cptyx

Senior Newbie





« Posted 2012-06-03 15:56:10 »

Hello, back again, I got a question, Me and some friends are creating a Game where there (hopefully) will be 1000 user's online.

I was thinking that the database would be on heavy load (our game is sort of mmorpg-ish).

and researched a bit, and found no sql.

But is this really worth the effort?

or is mysql(or h2) + hibrenate enough for that amount of people?

thanks!
Offline Riven
« League of Dukes »

« JGO Overlord »


Medals: 840
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #1 - Posted 2012-06-03 16:05:39 »

You really must know why you don't want SQL, to replace it with NoSQL.

SQL is likely the best to start out for your project - maybe even ditch the database backend for the time being. It will be hard enough to develop the game, let alone handling the persistence.

The number of users doesn't really say anything about scalability. You can completely trash a server with the load of 10 or 1,000,000 users. As always, it depends on your code / queries / design.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social
Offline cptyx

Senior Newbie





« Reply #2 - Posted 2012-06-03 16:27:02 »

Thanks, will keep that in mind Wink
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline tigeba

Junior Devvie





« Reply #3 - Posted 2012-06-04 15:50:36 »

FWIW, we use a combination of SQL and NoSQL databases to handle persistence.  Most of the game content and player data is stored in relational databases, and we put stuff like event data in NoSQL.  It is sort of difficult to make a recommendation without a lot more detail.  With either solution, the big challenges mostly lie in caching, and how you handle growing beyond a single database.


Offline ChristerSwahn

Junior Newbie





« Reply #4 - Posted 2012-06-08 07:40:56 »

Hello, back again, I got a question, Me and some friends are creating a Game where there (hopefully) will be 1000 user's online.
...
or is mysql(or h2) + hibrenate enough for that amount of people?

I have made a similar design & development journey and from my point of view I'd definitely recommend this:

1) You'll want to end up using an SQL-DB. That is superior once you're in production (and large scale tests), it's a mature technology and there are so many tools to inspect and work with the database directly.

2) You might not want to start out with writing the SQL persistency though. This adds a lot of overhead while you're still engineering the game, changing game entities and redesigning. On the other hand, it may not be wise to postpone the persistency layer entirely unless you're quite experienced in writing database persistency. You risk having to rewrite parts of the server design once you actually design the persistency layer if you haven't thought about those issues beforehand.

3) The above can be an argument for using JPA such as Hibernate or EclipseLink. But I have used both and I really regret it! They can perhaps be good for business applications but they really have the wrong performance profile for game servers (or I dare say any simulation application). They are good for getting 'some' DB objects out from the DB, modifying them, and then saving them again in a reliable manner. They are not good for applications constantly manipulating a large set of world data. And while JPA makes the actual translation of individual object field members to DB columns much easier, in spite of JPA's objectives to insulate developers from DB issues you will end up having to really think about DB modelling while doing your class modelling. In short - for the very early, small prototyping JPA can be neat. But don't use it for the full game. (And if you must: Use Eclipse-Link rather than Hibernate.)

4) If I were doing my design journey all over again, I'd start with a clearly defined persistency layer with a small API to load, store etc game data. The first implementation would be to simply write to files as simply as possible, perhaps using Java's serialization. Then later when the game design doesn't change that much anymore, I'd replace it with a custom JDBC back-end.

Offline Nate

« JGO Bitwise Duke »


Medals: 158
Projects: 4
Exp: 14 years


Esoteric Software


« Reply #5 - Posted 2012-06-08 22:59:42 »

Try myBatis for messing with SQL. If you want NoSQL try Voldemort.

Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #6 - Posted 2012-06-08 23:17:57 »

If it's a hobby project, I'm a fan of Redis because it's lighter weight and you can do pretty much anything you want with it. It's basically a giant key-value store. If you write stuff intelligently you can also make your DB fairly object-oriented, like "entity.id#.hp" gives you somebody's hp, etc. It's easy to set up, and very easy to debug too.

See my work:
OTC Software
Offline Nate

« JGO Bitwise Duke »


Medals: 158
Projects: 4
Exp: 14 years


Esoteric Software


« Reply #7 - Posted 2012-06-10 06:02:31 »

If it's a hobby project, I'm a fan of Redis because it's lighter weight and you can do pretty much anything you want with it. It's basically a giant key-value store. If you write stuff intelligently you can also make your DB fairly object-oriented, like "entity.id#.hp" gives you somebody's hp, etc. It's easy to set up, and very easy to debug too.
Redis is in-memory only (though you can snapshot periodically) and doesn't have clustering, so is hard to scale. I like Kyoto Cabinet, which can be in-memory or to disk, but it also doesn't have clustering. Couchbase, Cassandra, MonogDB and friends are big monsters, I wouldn't touch them if you paid me (literally). There are other really bad ones like HyperDEX. Riak might be ok. Voldemort is the most sane of them all though, IMO.

Offline sproingie

JGO Kernel


Medals: 202



« Reply #8 - Posted 2012-06-10 14:54:53 »

Redis is competition for memcached, so it might be useful for fronting a nosql store, but not replacing one.  Mongo has really grown up lately, though its clustering isn't "elastic" so I didn't consider it further for my own bigdata projects.

I found Cassandra's complexity is only there if you choose to use it.  You don't have to predefine column families, or use supercolumns or any of that stuff if you don't want to.  And speed-wise it's just bananas.  I hammered the thing with millions and millions of rows and queries and the garbage collector never even ran.  Not exactly real-world conditions, so we'll see when it actually gets to that.

Last I looked, Voldemort didn't support configurable quorum policies, which was a huge minus for me.  Using vector clocks is a nice touch (something riak also does) but all the data we write is immutable and is associated with its own timestamp, not just the internal one, so a little clock drift doesn't really hurt anything for me.

Riak is developing something of a MySQL problem, internally fragmenting itself with its choice of storage implementations (bitcask and eleveldb), where some features only work with one or the other.  It also lacks range queries and bulk inserts, and considering I needed to insert over 200 million rows to populate the thing, inserting them one at a time was quite literally never going to happen.
Offline Nate

« JGO Bitwise Duke »


Medals: 158
Projects: 4
Exp: 14 years


Esoteric Software


« Reply #9 - Posted 2012-06-10 20:30:07 »

I believe I read craigslist and others use Redis like NoSQL, they do their own sharding and have lots of machines with lots of RAM. I imagine it is fast (everything in RAM!), but it is expensive and doing your own clustering is a maintenance nightmare.

Even if you are right that most of the Cassandra nonsense could be ignored, it still scares the hell out of me. It makes both the API and maintenance complicated/difficult to figure out. I want keys and values to be bytes, a simple API for that, and servers that are easy to scale and maintain since I'm doing it all myself. So far Voldemort seems to be working out well for me, though I haven't released and don't have any users yet. Smiley Of course I've wildly over engineered, but that is part of the fun I guess. I have a simple interface over the database, so I can swap if needed. Maybe Cassandra is the right tool if you need the column features or a different quorum policy makes a real difference for you, but do you really want to be the DBA for that monster? Plus, Thrift is ewww! Wink

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #10 - Posted 2012-06-11 19:59:50 »

I've used Redis on a 300,000 user / day app. MySQL stored most user data, Redis was used for time-related stuff like push notifications, when events would happen, etc. because it was hooked with Resque. That worked totally well. Like I said, Redis is only a viable option as a replacement for MySQL if you're doing a hobby app and don't need that many users. And face it, he's not going to need something that can support more than 100 users / day.

I've also used Mongo, which was awesome once we made a bunch of wrappers for it to make it less annoying.

See my work:
OTC Software
Offline sproket

Junior Devvie


Medals: 1



« Reply #11 - Posted 2012-06-17 00:44:52 »

If you're using a database you can check here:
http://www.java-gaming.org/topics/simple-no-nonsense-persistence-library/26665/view.html

 Smiley

Offline tigeba

Junior Devvie





« Reply #12 - Posted 2012-06-18 16:27:09 »

We are actually giving a talk at http://qconnewyork.com/ QCon tomorrow on java persistence and multiplayer gaming.  I'm not yet sure if there will be a live stream of the talk, but I can try to provide the info if anyone is interested.




Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

rwatson462 (29 views)
2014-12-15 09:26:44

Mr.CodeIt (20 views)
2014-12-14 19:50:38

BurntPizza (40 views)
2014-12-09 22:41:13

BurntPizza (75 views)
2014-12-08 04:46:31

JscottyBieshaar (37 views)
2014-12-05 12:39:02

SHC (50 views)
2014-12-03 16:27:13

CopyableCougar4 (47 views)
2014-11-29 21:32:03

toopeicgaming1999 (114 views)
2014-11-26 15:22:04

toopeicgaming1999 (102 views)
2014-11-26 15:20:36

toopeicgaming1999 (30 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!