Is it possible to include node load into the consistency hashing function in riak-core?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Is it possible to include node load into the consistency hashing function in riak-core?

Zhemzhitsky Sergey-2

Hi riak gurus,

 

Riak is a perfect key-value data store that allows to distribute load across the nodes based on the Dynamo principles.

What I’d like to achieve is to have the preferred list be sorted based on the current load (maybe erlang:statistics(run_queue)) of the nodes.

 

Is it possible to change the hashing function somehow so that the vnode on the node with the minimal load is returned as the first one?

 

Best Regards,

Sergey

_______________________________________________________

CONFIDENTIALITY NOTICE: This email and any files attached to it may be conf idential. If you are not the intended recipient you are notified that using, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error please notify the sender and delete this email.


_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to include node load into the consistency hashing function in riak-core?

bryan-basho
Administrator
On Tue, Oct 9, 2012 at 11:59 AM, Zhemzhitsky Sergey
<[hidden email]> wrote:
> What I’d like to achieve is to have the preferred list be sorted based on
> the current load (maybe erlang:statistics(run_queue)) of the nodes.
>
> Is it possible to change the hashing function somehow so that the vnode on
> the node with the minimal load is returned as the first one?

Hi, Sergey. It would not be possible to change the hashing function to
take load into account. That function must *always* produce the same
hash for each key - that's the "consistent" part of consistent
hashing. If it didn't do that, then a request for a key might go to a
completely different vnode every time.

After the hash is computed and the preflist is generated, it would be
possible to re-sort the first N vnodes in the preference list, as you
describe. However, except for edge cases where the network is
overloaded, I don't think it will buy you much. Riak KV sends all of
those first N requests as fast as it can, and then starts waiting for
responses from them. So, getting a response to the least-loaded vnode
a few microseconds sooner is unlikely to change performance.

Although, that overloaded-network case could prove interesting and
valuable, and regular benchmarking could just prove me wrong. Also,
Pipe could almost certainly benefit from such a behavior, since its
operations usually target one vnode at a time instead of N. That is to
say, please share your results if you do try this!

Hope that helps,
Bryan

_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Reply | Threaded
Open this post in threaded view
|

RE: Is it possible to include node load into the consistency hashing function in riak-core?

Zhemzhitsky Sergey-2
Hello Bryan,

Thanks a lot for the ideas!
In case of any results, I will necessarily share them.


Best Regards,
Sergey


-----Original Message-----
From: Bryan Fink [mailto:[hidden email]]
Sent: Monday, October 15, 2012 7:05 PM
To: Zhemzhitsky Sergey
Cc: riak-users
Subject: Re: Is it possible to include node load into the consistency hashing function in riak-core?

On Tue, Oct 9, 2012 at 11:59 AM, Zhemzhitsky Sergey <[hidden email]> wrote:
> What I’d like to achieve is to have the preferred list be sorted based
> on the current load (maybe erlang:statistics(run_queue)) of the nodes.
>
> Is it possible to change the hashing function somehow so that the
> vnode on the node with the minimal load is returned as the first one?

Hi, Sergey. It would not be possible to change the hashing function to take load into account. That function must *always* produce the same hash for each key - that's the "consistent" part of consistent hashing. If it didn't do that, then a request for a key might go to a completely different vnode every time.

After the hash is computed and the preflist is generated, it would be possible to re-sort the first N vnodes in the preference list, as you describe. However, except for edge cases where the network is overloaded, I don't think it will buy you much. Riak KV sends all of those first N requests as fast as it can, and then starts waiting for responses from them. So, getting a response to the least-loaded vnode a few microseconds sooner is unlikely to change performance.

Although, that overloaded-network case could prove interesting and valuable, and regular benchmarking could just prove me wrong. Also, Pipe could almost certainly benefit from such a behavior, since its operations usually target one vnode at a time instead of N. That is to say, please share your results if you do try this!

Hope that helps,
Bryan

_______________________________________________________
CONFIDENTIALITY NOTICE: This email and any files attached to it may be conf idential. If you are not the intended recipient you are notified that using, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error please notify the sender and delete this email.
_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com