You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@dubbo.apache.org by 一直以来 <27...@qq.com> on 2019/02/13 07:41:39 UTC

ConsistentHash LoadBalance中的解释:缺省只对第一个参数进行Hash运算是什么意思?

ConsistentHash LoadBalance:一致性 Hash,相同参数的请求总是发到同一提供者。当某一台提供者挂时,原本发往该提供者的请求,基于虚拟节点,会平摊到其它提供者,不会引起剧烈变动。缺省只对第一个参数进行Hash运算。

第一个参数指什么??是每个接口中方法的第一个参数吗,如果是的话,如果方法没有参数是什么行为?请教,感谢!

Re: ConsistentHash LoadBalance中的解释:缺省只对第一个参数进行Hash运算是什么意思?

Posted by 田 小波 <ti...@outlook.com>.
Hi Kitito:

If the user chooses ConsistentHashLoadBalance, indicate the user wants to load balance 
through the runtime parameters and expects remote calls with the same parameter values 
to fall on the same server. After the introduction of IP, this load balancing strategy will be disrupted.

Thanks,
Xiaobo

> 在 2019年2月22日,下午3:19,徐靖峰 <ki...@foxmail.com> 写道:
> 
> Hi, Jason
> 
> I know that the default logic of ConsistentHash LoadBalance is hashed by parameters, and dubbo provide the configuration
> 
> <dubbo:parameter key="hash.arguments" value="0,1" />  to config the hash params
> 
> <dubbo:parameter key="hash.nodes" value="320" /> to config virtual nodes
> 
> My opinion is Dubbo can extend the hash key, not only the request method params. 
> 
> IP consistent hash is a such common requirement while Dubbo’s existing extension don’t include it, there is no need to let the users extend by themselves,
> 
> A little change for Consistent Hash LoadBalance will support such function.
> 
> Kitito
> 
>> 在 2019年2月22日,上午11:39,Jason Joo <hb...@163.com> 写道:
>> 
>> hi, moe
>> 
>> I think what you mention is like "ip_hash" in NGINX or some other.
>> 
>> ConsistentHashLB is hashed by parameters because a same logic will just act the same under the same parameters (which we call it reenterability). Adding other parameters will break it.
>> 
>> While DUBBO provides the ability extending load balancers which makes it possible to implement kinds of balancers like ip_hash, app_version_hash or others.
>> 
>> best regards,
>> 
>> Jason
>> 
>>> On Feb 22, 2019, at 11:00, 徐靖峰 <ki...@foxmail.com> wrote:
>>> 
>>> Hi all
>>> 
>>> I don’t think that ConsistentHashLoadBalancer should only load balance by the method param, maybe more configuration can provide to the user to achieve more type of dynamic hash parameters, such as hash by the requestIp, more request param.
>>> 
>>> 
>> 
> 
> 
> 


Re: ConsistentHash LoadBalance中的解释:缺省只对第一个参数进行Hash运算是什么意思?

Posted by LiZhenNet <li...@gmail.com>.
Hi, jingfeng

I feel that the more complex features can be extended by the user, Dubbo
only provide the basic functions .

徐靖峰 <ki...@foxmail.com> 于2019年2月22日周五 下午8:58写道:

> Hi Xiaobo and Jason
>
> Sorry for that I give an inappropriate example — IP_HASH. My origin
> proposal was  that maybe the HASH KEY is not only can be method param. Not
> a serious problem.
>
> > 在 2019年2月22日,下午6:24,Jason Joo <hb...@163.com> 写道:
> >
> > Hi, Kitito
> >
> > I get your thought.
> > And the "IP" in our opinion is it a kind of addition (ip + parameters)
> or can be used alone (only ip)?
> >
> > Though IP + parameters may leads to unbalanced load between providers
> but i think it maybe still make sense according to the concept of
> ConsistentHash, while it will not if supporting only ip_hash.
> >
> > Hashed by IP maybe not a need so common i think.
> >
> > best regards,
> >
> > Jason
> >
> >> On Feb 22, 2019, at 15:19, 徐靖峰 <ki...@foxmail.com> wrote:
> >>
> >> Hi, Jason
> >>
> >> I know that the default logic of ConsistentHash LoadBalance is hashed
> by parameters, and dubbo provide the configuration
> >>
> >> <dubbo:parameter key="hash.arguments" value="0,1" />  to config the
> hash params
> >>
> >> <dubbo:parameter key="hash.nodes" value="320" /> to config virtual nodes
> >>
> >> My opinion is Dubbo can extend the hash key, not only the request
> method params.
> >>
> >> IP consistent hash is a such common requirement while Dubbo’s existing
> extension don’t include it, there is no need to let the users extend by
> themselves,
> >>
> >> A little change for Consistent Hash LoadBalance will support such
> function.
> >>
> >> Kitito
> >>
> >>> 在 2019年2月22日,上午11:39,Jason Joo <hb...@163.com> 写道:
> >>>
> >>> hi, moe
> >>>
> >>> I think what you mention is like "ip_hash" in NGINX or some other.
> >>>
> >>> ConsistentHashLB is hashed by parameters because a same logic will
> just act the same under the same parameters (which we call it
> reenterability). Adding other parameters will break it.
> >>>
> >>> While DUBBO provides the ability extending load balancers which makes
> it possible to implement kinds of balancers like ip_hash, app_version_hash
> or others.
> >>>
> >>> best regards,
> >>>
> >>> Jason
> >>>
> >>>> On Feb 22, 2019, at 11:00, 徐靖峰 <ki...@foxmail.com> wrote:
> >>>>
> >>>> Hi all
> >>>>
> >>>> I don’t think that ConsistentHashLoadBalancer should only load
> balance by the method param, maybe more configuration can provide to the
> user to achieve more type of dynamic hash parameters, such as hash by the
> requestIp, more request param.
> >>>>
> >>>>
> >>>
> >>
> >>
> >
>
>

Re: ConsistentHash LoadBalance中的解释:缺省只对第一个参数进行Hash运算是什么意思?

Posted by 徐靖峰 <ki...@foxmail.com>.
Hi Xiaobo and Jason

Sorry for that I give an inappropriate example — IP_HASH. My origin proposal was  that maybe the HASH KEY is not only can be method param. Not a serious problem.

> 在 2019年2月22日,下午6:24,Jason Joo <hb...@163.com> 写道:
> 
> Hi, Kitito
> 
> I get your thought. 
> And the "IP" in our opinion is it a kind of addition (ip + parameters) or can be used alone (only ip)?
> 
> Though IP + parameters may leads to unbalanced load between providers but i think it maybe still make sense according to the concept of ConsistentHash, while it will not if supporting only ip_hash.
> 
> Hashed by IP maybe not a need so common i think.
> 
> best regards,
> 
> Jason
> 
>> On Feb 22, 2019, at 15:19, 徐靖峰 <ki...@foxmail.com> wrote:
>> 
>> Hi, Jason
>> 
>> I know that the default logic of ConsistentHash LoadBalance is hashed by parameters, and dubbo provide the configuration
>> 
>> <dubbo:parameter key="hash.arguments" value="0,1" />  to config the hash params
>> 
>> <dubbo:parameter key="hash.nodes" value="320" /> to config virtual nodes
>> 
>> My opinion is Dubbo can extend the hash key, not only the request method params. 
>> 
>> IP consistent hash is a such common requirement while Dubbo’s existing extension don’t include it, there is no need to let the users extend by themselves,
>> 
>> A little change for Consistent Hash LoadBalance will support such function.
>> 
>> Kitito
>> 
>>> 在 2019年2月22日,上午11:39,Jason Joo <hb...@163.com> 写道:
>>> 
>>> hi, moe
>>> 
>>> I think what you mention is like "ip_hash" in NGINX or some other.
>>> 
>>> ConsistentHashLB is hashed by parameters because a same logic will just act the same under the same parameters (which we call it reenterability). Adding other parameters will break it.
>>> 
>>> While DUBBO provides the ability extending load balancers which makes it possible to implement kinds of balancers like ip_hash, app_version_hash or others.
>>> 
>>> best regards,
>>> 
>>> Jason
>>> 
>>>> On Feb 22, 2019, at 11:00, 徐靖峰 <ki...@foxmail.com> wrote:
>>>> 
>>>> Hi all
>>>> 
>>>> I don’t think that ConsistentHashLoadBalancer should only load balance by the method param, maybe more configuration can provide to the user to achieve more type of dynamic hash parameters, such as hash by the requestIp, more request param.
>>>> 
>>>> 
>>> 
>> 
>> 
> 


Re: ConsistentHash LoadBalance中的解释:缺省只对第一个参数进行Hash运算是什么意思?

Posted by Jason Joo <hb...@163.com>.
Hi, Kitito

I get your thought. 
And the "IP" in our opinion is it a kind of addition (ip + parameters) or can be used alone (only ip)?

Though IP + parameters may leads to unbalanced load between providers but i think it maybe still make sense according to the concept of ConsistentHash, while it will not if supporting only ip_hash.

Hashed by IP maybe not a need so common i think.

best regards,

Jason

> On Feb 22, 2019, at 15:19, 徐靖峰 <ki...@foxmail.com> wrote:
> 
> Hi, Jason
> 
> I know that the default logic of ConsistentHash LoadBalance is hashed by parameters, and dubbo provide the configuration
> 
> <dubbo:parameter key="hash.arguments" value="0,1" />  to config the hash params
> 
> <dubbo:parameter key="hash.nodes" value="320" /> to config virtual nodes
> 
> My opinion is Dubbo can extend the hash key, not only the request method params. 
> 
> IP consistent hash is a such common requirement while Dubbo’s existing extension don’t include it, there is no need to let the users extend by themselves,
> 
> A little change for Consistent Hash LoadBalance will support such function.
> 
> Kitito
> 
>> 在 2019年2月22日,上午11:39,Jason Joo <hb...@163.com> 写道:
>> 
>> hi, moe
>> 
>> I think what you mention is like "ip_hash" in NGINX or some other.
>> 
>> ConsistentHashLB is hashed by parameters because a same logic will just act the same under the same parameters (which we call it reenterability). Adding other parameters will break it.
>> 
>> While DUBBO provides the ability extending load balancers which makes it possible to implement kinds of balancers like ip_hash, app_version_hash or others.
>> 
>> best regards,
>> 
>> Jason
>> 
>>> On Feb 22, 2019, at 11:00, 徐靖峰 <ki...@foxmail.com> wrote:
>>> 
>>> Hi all
>>> 
>>> I don’t think that ConsistentHashLoadBalancer should only load balance by the method param, maybe more configuration can provide to the user to achieve more type of dynamic hash parameters, such as hash by the requestIp, more request param.
>>> 
>>> 
>> 
> 
> 


Re: ConsistentHash LoadBalance中的解释:缺省只对第一个参数进行Hash运算是什么意思?

Posted by 徐靖峰 <ki...@foxmail.com>.
Hi, Jason

I know that the default logic of ConsistentHash LoadBalance is hashed by parameters, and dubbo provide the configuration

<dubbo:parameter key="hash.arguments" value="0,1" />  to config the hash params

<dubbo:parameter key="hash.nodes" value="320" /> to config virtual nodes

My opinion is Dubbo can extend the hash key, not only the request method params. 

IP consistent hash is a such common requirement while Dubbo’s existing extension don’t include it, there is no need to let the users extend by themselves,
 
A little change for Consistent Hash LoadBalance will support such function.

Kitito

> 在 2019年2月22日,上午11:39,Jason Joo <hb...@163.com> 写道:
> 
> hi, moe
> 
> I think what you mention is like "ip_hash" in NGINX or some other.
> 
> ConsistentHashLB is hashed by parameters because a same logic will just act the same under the same parameters (which we call it reenterability). Adding other parameters will break it.
> 
> While DUBBO provides the ability extending load balancers which makes it possible to implement kinds of balancers like ip_hash, app_version_hash or others.
> 
> best regards,
> 
> Jason
> 
>> On Feb 22, 2019, at 11:00, 徐靖峰 <ki...@foxmail.com> wrote:
>> 
>> Hi all
>> 
>> I don’t think that ConsistentHashLoadBalancer should only load balance by the method param, maybe more configuration can provide to the user to achieve more type of dynamic hash parameters, such as hash by the requestIp, more request param.
>> 
>> 
> 




Re: ConsistentHash LoadBalance中的解释:缺省只对第一个参数进行Hash运算是什么意思?

Posted by Jason Joo <hb...@163.com>.
hi, moe

I think what you mention is like "ip_hash" in NGINX or some other.

ConsistentHashLB is hashed by parameters because a same logic will just act the same under the same parameters (which we call it reenterability). Adding other parameters will break it.

While DUBBO provides the ability extending load balancers which makes it possible to implement kinds of balancers like ip_hash, app_version_hash or others.

best regards,

Jason

> On Feb 22, 2019, at 11:00, 徐靖峰 <ki...@foxmail.com> wrote:
> 
> Hi all
> 
> I don’t think that ConsistentHashLoadBalancer should only load balance by the method param, maybe more configuration can provide to the user to achieve more type of dynamic hash parameters, such as hash by the requestIp, more request param.
> 
> 


Re: ConsistentHash LoadBalance中的解释:缺省只对第一个参数进行Hash运算是什么意思?

Posted by 徐靖峰 <ki...@foxmail.com>.
Hi all

I don’t think that ConsistentHashLoadBalancer should only load balance by the method param, maybe more configuration can provide to the user to achieve more type of dynamic hash parameters, such as hash by the requestIp, more request param.




Re: ConsistentHash LoadBalance中的解释:缺省只对第一个参数进行Hash运算是什么意思?

Posted by Ian Luo <ia...@gmail.com>.
+1. I agree with Xiaobo and Jason.

-Ian.

On Thu, Feb 14, 2019 at 9:29 AM Jason Joo <hb...@163.com> wrote:

> +1
>
> Methods with no arguments or little possible values of arguments should
> not be applied `ConsistentHashLoadBalance`. Or requests can not be smoothly
> distributed when nodes change.
>
> best regards,
>
> Jason
>
> > On Feb 13, 2019, at 22:30, 田 小波 <ti...@outlook.com> wrote:
> >
> > 数
>
>

Re: ConsistentHash LoadBalance中的解释:缺省只对第一个参数进行Hash运算是什么意思?

Posted by Jason Joo <hb...@163.com>.
+1

Methods with no arguments or little possible values of arguments should not be applied `ConsistentHashLoadBalance`. Or requests can not be smoothly distributed when nodes change.

best regards,

Jason

> On Feb 13, 2019, at 22:30, 田 小波 <ti...@outlook.com> wrote:
> 
> 数


Re: ConsistentHash LoadBalance中的解释:缺省只对第一个参数进行Hash运算是什么意思?

Posted by 田 小波 <ti...@outlook.com>.
Hi,

我觉得这并不是一个 bug,ConsistentHashLoadBalance 只根据运行时参数值进行负载均衡。
如果两个接口的参数值相同,那么这两个远程调用会被分配到同一台机器上。当接口方法中
不存在参数时,我们也可认为他们的参数值是相同的,从源码的角度来说,它们都是空串。
因此在运行时,ConsistentHashLoadBalance 会将不存在参数的远程调用分配到同一个机器上。

translate by Google Translator:

I don't think this is a bug. ConsistentHashLoadBalance only load balances based on runtime parameter values.
If the parameter values of the two interfaces are the same, then the two remote calls are assigned to the same machine. In the interface method
When there are no parameters, we can also think that their parameter values are the same. From the source point of view, they are all empty strings.
So at runtime, ConsistentHashLoadBalance will assign remote calls with no parameters to the same machine.

> 在 2019年2月13日,下午8:20,Xianjun Ke <ke...@apache.org> 写道:
> 
> Good question. And about your last question, I have made some test in my
> local machine,
> it seems that there is a bug about the ConsistentHashLoadBalance when the
> method has
> no argument, pls refer this issue [1]
> 
> [1] https://github.com/apache/incubator-dubbo/issues/3468
> 
> 一直以来 <27...@qq.com> 于2019年2月13日周三 下午3:41写道:
> 
>> ConsistentHash LoadBalance:一致性
>> Hash,相同参数的请求总是发到同一提供者。当某一台提供者挂时,原本发往该提供者的请求,基于虚拟节点,会平摊到其它提供者,不会引起剧烈变动。缺省只对第一个参数进行Hash运算。
>> 
>> 第一个参数指什么??是每个接口中方法的第一个参数吗,如果是的话,如果方法没有参数是什么行为?请教,感谢!


Re: ConsistentHash LoadBalance中的解释:缺省只对第一个参数进行Hash运算是什么意思?

Posted by Xianjun Ke <ke...@apache.org>.
Good question. And about your last question, I have made some test in my
local machine,
it seems that there is a bug about the ConsistentHashLoadBalance when the
method has
no argument, pls refer this issue [1]

[1] https://github.com/apache/incubator-dubbo/issues/3468

一直以来 <27...@qq.com> 于2019年2月13日周三 下午3:41写道:

> ConsistentHash LoadBalance:一致性
> Hash,相同参数的请求总是发到同一提供者。当某一台提供者挂时,原本发往该提供者的请求,基于虚拟节点,会平摊到其它提供者,不会引起剧烈变动。缺省只对第一个参数进行Hash运算。
>
> 第一个参数指什么??是每个接口中方法的第一个参数吗,如果是的话,如果方法没有参数是什么行为?请教,感谢!