One possible scheme:

To optimize reads, I advice such scheme:
Bucket <<"clients">>, by client_id you store client info and all his users
in one object.
Bucket <<"servers">>, by client_id you store all his servers in one object.

Move user statistics into separate object:
Bucket <<"usage_stats">>, by client_id you store something like this:
[{user_id(), stat()}]
But note, as there will be a lot of simultaneously updates, thereof there
will be a lot of conflicts. Consider to write code which solves it or
possibly use something like statebox for this.

So to execute "give me all sub-users of this client" you will have to make 2
queries: to <<"clients">> bucket and to <<"usage_stats">> bucket.
"give me all servers of this client" will require one query.



--
View this message in context: 
http://riak-users.197444.n3.nabble.com/Need-help-with-moving-to-Riak-tp4027331p4027336.html
Sent from the Riak Users mailing list archive at Nabble.com.

_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to