0

Let's say an mmo was being created with the features of being first person view, having one world everyone plays in (like eve online), and being a sandbox game. What database would best suit it's needs in terms of cap theorem? CA, AP, CP and why?

Jonas
  • 121,568
  • 97
  • 310
  • 388
Xavier
  • 8,828
  • 13
  • 64
  • 98

1 Answers1

3

All of the tenants of CAP theory must be worked around in MMOs. The DB is not going to do all the heavy lifting - the server application is just as important, if not more so.

Video games need faster response times than a DB is going to be capable of providing. That isn't to say that IT infrastructure and architectural work isn't in place at all levels to squeeze out bottlenecks wherever possible, but the DB is not the only piece responsible for a smooth MMO experience.

Most work in the MMO server process is likely committed to memory first, and only spooled out to the DB afterwards. You don't need your DB to have even a 200ms response time if you're just going to cache everything you need quick access for at application startup. If you don't do this caching, then you aren't going to get 200ms response times to the client, no matter how fast or aggressive your DB is. Memory with correct data structures is just faster.

With all that caching, most of the CAP guarantees become less meaningful and less important.

From the wiki article on CAP theorem:

...CAP is often taken to preclude consistency for services running in the highly elastic first-tier of a modern cloud computing system. These services are typically required to be stateless or to maintain only soft-state (cached data), and must be responsive even if inner-tier services are temporarily inaccessible...

This does not match the requirements of MMOs. MMO server processes are not stateless, and don't simply contain soft-state (cached data). They will aggressively pre-cache tons of world data in order to make up for the DB's lack of ability to provide guarantees of nearly instantaneous response time.

Examples of how MMOs will work around each of these (basically, caching):

  • Consistency - You can easily work around this with data locality. Most things in the MMO world won't have effects on anything else. You don't need to know what someone half the galaxy away is doing, let alone the mobs they're encountering, or what they're looting. So you don't need the DB to provide it. The data can thus be partitioned in a way that consistency between multiple DBs doesn't matter. Anything you need to remain consistent (not much - mostly your character/inventory/mail/bank/auction house) could stay resident in memory, so will have high consistency, or could stand to suffer on one of the other two CAP axes.

  • Availability - You can easily work around this with aggressive and algorithm-invasive caching. Some data is important, in which case you cache it. Other data isn't as important, in which case you don't always need it to be available (e.g. the things I mentioned under Consistency, which could stand to suffer availability lapses).

  • Partition Tolerance - You can easily work around losing access to portions of data by caching. Memory is always available, and you'd jam it full of anything important. Anything not important to always have access to could suffer a loss of access with a lower pain threshold for players (e.g. the things mentioned under Consistency).

So out of these, Consistency is the most valuable, as availability and partition tolerency will already be worked around with super-aggressive and algorithm-invasive caching. And even then, Consistency is only important for some pieces of data.

Merlyn Morgan-Graham
  • 58,163
  • 16
  • 128
  • 183