Is there a way to control where data is stored

Florian Odronitz odo at mac.com
Fri Jan 7 08:46:15 EST 2011


Hello,

I am new to riak so I might miss something essential.
As I understand from (http://wiki.basho.com/Replication.html), the decision about where a piece of data is stored depends on the key (and the ring).
Looking at the source code this is defined in chash.erl as:

key_of(ObjectName) ->    
    crypto:sha(term_to_binary(ObjectName)).

So naming a thing is at the same time saying the data belongs to a certain set of nodes.

In my application I have a set of buckets, 'users', 'conditions', 'actions'. All conditions and all actions are linked to a particular user and in the vast majority of cases they are loaded in one statement using link walking.
So when reading the data it would be beneficial to have them stored on the same node in order to minimize inter-node traffic. Writing is not an issue since it happens much less frequently.

So my question is: What is a good way to specify that certain pieces of data are stored together.

Intuitively I would patch key_of/1 to allow for something like:
/riak/users/123
/riak/conditions/abc at 123
/riak/actions/xyz at 123

so '123' would be hashed in all cases.

Any thoughts on this are appreciated.

Best Regards,
Florian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1524 bytes
Desc: not available
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20110107/70a49150/attachment.p7s>


More information about the riak-users mailing list