Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用Robbin时,定义规则(灰度发布的RULE)与ET的RULE冲突,现在去掉ET的RULE发现事务结果也是正确的,只是性能稍低,有更好的解决方案吗? #116

Open
shanghaiyanfaer opened this issue Apr 18, 2019 · 2 comments

Comments

@shanghaiyanfaer
Copy link

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'retryableRibbonLoadBalancingHttpClient' defined in org.springframework.cloud.netflix.ribbon.apache.HttpClientRibbonConfiguration: Unsatisfied dependency expressed through method 'retryableRibbonLoadBalancingHttpClient' parameter 2; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'ribbonLoadBalancer' defined in org.springframework.cloud.netflix.ribbon.RibbonClientConfiguration: Unsatisfied dependency expressed through method 'ribbonLoadBalancer' parameter 3; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type 'com.netflix.loadbalancer.IRule' available: expected single matching bean but found 2: easyTransLoadBalanceRule,metadataAwareRule

@skyesx
Copy link
Contributor

skyesx commented Apr 19, 2019

ET里的自定义的Rule主要是为了提高效率。其实现了简单地Sticky功能,这样多次调用间一些关联的上下文信息可以临时缓存到内存,而不需要从磁盘中取出。

但业务有需要创建自己的Rule时,如灰度发布的Rule用于全局的调用,那么需要将该Rule设置为@primary,这样这个Rule就会替换掉ET里设定的Rule(否则ET的调用就没有走到灰度发布的流程,造成错误)。替换ET的Rule不影响事务的正确性。

但此时失去了sticky的功能,(涉及嵌套事务时)效率会降低,若不想降低,需要客户自行在灰度的基础上,再加上Sticky的功能。

@shanghaiyanfaer
Copy link
Author

ET里的自定义的Rule主要是为了提高效率。其实现了简单地Sticky功能,这样多次调用间一些关联的上下文信息可以临时缓存到内存,而不需要从磁盘中取出。

但业务有需要创建自己的Rule时,如灰度发布的Rule用于全局的调用,那么需要将该Rule设置为@primary,这样这个Rule就会替换掉ET里设定的Rule(否则ET的调用就没有走到灰度发布的流程,造成错误)。替换ET的Rule不影响事务的正确性。

但此时失去了sticky的功能,(涉及嵌套事务时)效率会降低,若不想降低,需要客户自行在灰度的基础上,再加上Sticky的功能。

好的,谢谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants