Re: Best use of Cayenne for a large scale game?

From: Mike Kienenberger (mkienen..laska.net)
Date: Thu Jun 24 2004 - 13:57:54 EDT

  • Next message: Mike Kienenberger: "Re: RES: RES: org.apache.commons.collections.IteratorUtils.singletonIterator"

    Elia Morling <eli..amiljen.se> wrote:
    > I'm almost ready to implement my Cayenne objects in my project
    > and I would like some advice. I'm working with a game server that
    > will host thousands of players, npc:s and items. Properties will be
    > requested frequently.
    >
    > For example. When a player logs into the game. Should I get all
    > properties from the DataObject once and store them in fixed
    > fields? I could use a load() and save() method that communicates
    > with the DataObject.
    >
    > Or should I simply extend the DataObject and used the geters and
    > seters supplied? I'm mainly concerned with performance. I noticed that
    > the DataObject stores all its values in a Map.
    >
    > I'm also unknowledgable of how the values are being read. How
    > they are cached. And if there is a difference between how values
    > and lists used in many-relationships are stored.
    >
    > Any advice on how to proceed would be appreciated.

    Some of this will depend on your game.

    Imperial Wars currently uses java EOF rather than Cayenne, but it's similar
    enough that the same principles apply.

    However, this is a turn-based multiplayer game, so how we do it is that we
    load in data for a particular player/universe/turn into a shared data
    context, then send that data to the player's client. We also load in any
    current orders that the player is working on into a non-shared context and
    send them to the player.

    Since the data doesn't change for a particular player/universe/turn once
    that turn has been processed, it makes sense to cache it in the server.
    This provides performance improvements as well since we don't have to
    refetch it.

    If you're worried about performance, chances are that you'll see the
    greatest speedups by using correct prefetching for your relationships.
    This can orders of magnitudes of speedup. There have been areas where I've
    decreased the number of queries to 6% of the original using prefetching.



    This archive was generated by hypermail 2.0.0 : Thu Jun 24 2004 - 13:57:45 EDT