As a 2nd thought, you could have a key per player on the player's bucket and a key with the collection of units per player on the unit's bucket.

Guido.

On 07/08/13 15:52, Guido Medina wrote:
Whats the size of each unit JSON wise?, if it is too small, you could have the player's units inside a single key as a collection, that way when you fetch a player your key will contain the units and you could play around with mutations/locking of such player's key. And also, it will leverage your multi-threading code making each player thread your multi-threading pattern (Removing the need of a thread pool to fetch units)

The drawback of such design is that each player's key would be fetched as a whole just to add/remove a unit. If you have a single reader/writer (Server), you could add some in-memory cache (For example, in Java you could use Google's Guava framework; LoadingCache<T>)

Maybe I proposed something with way out of proportions, I think I would need more details.

Anyway, HTH,

Guido.

On 07/08/13 10:28, Maksymilian Strzelecki wrote:
Hi. I've read somewhere around the Internet that Riak benefits its performence when there are more buckets and not massive amount of keys in them. Now, if this is true I'm asking for an advice on how to go about my data model.

I've started off with one bucket called accounts_units. Every player has his set of units in-game (like 10-20) and they all have their individual keys in there. Since knowing what your units are is pretty important thing I would be doing a lot of queries on that bucket. Then I thought I could create individual buckets for every player and his units. Though it would create A LOT of buckets with little keys. Would that be better? What do you think?

Thanks for your time,
Max.


_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to