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

jodis问题 #9

Closed
nsspw opened this issue Dec 15, 2015 · 12 comments
Closed

jodis问题 #9

nsspw opened this issue Dec 15, 2015 · 12 comments

Comments

@nsspw
Copy link

nsspw commented Dec 15, 2015

我启用了2个proxy(分别是proxy1、proxy2),用jodis并发测试。在测试过程中,我手动kill掉proxy2,这个时候jodis客户端报:
redis.clients.jedis.exceptions.JedisConnectionException: Unexpected end of stream.
感觉jodis实现负载均衡没有起到作用,还是我使用不正确?

@yangzhe1991
Copy link
Member

刚kill的时候当时还在进行的请求是肯定会断的,但是过了一段时间,最长不超过proxy配置的session超时时间,再请求就不会报错了

2015年12月15日星期二,Ady Xiong notifications@github.com 写道:

我启用了2个proxy(分别是proxy1、proxy2),用jodis并发测试。在测试过程中,我手动kill掉proxy2,这个时候jodis客户端报:
redisclientsjedisexceptionsJedisConnectionException: Unexpected end of
stream
感觉jodis实现负载均衡没有起到作用,还是我使用不正确?


Reply to this email directly or view it on GitHub
#9.

Thanks,
Phil Yang

@nsspw
Copy link
Author

nsspw commented Dec 15, 2015

你说的”session超时时间“,是不是session_max_timeout?如果这个值很大,那等待时间是不是也很久?
我设置session_max_timeout=172800,所以一直没有切换过来

@yangzhe1991
Copy link
Member

不是,是zk_session_timeout。详情见配置文件中的注释。
https://github.com/wandoulabs/codis/blob/master/config.ini#L37

@Apache9
Copy link
Member

Apache9 commented Dec 15, 2015

Jodis是监控zk上结点变化来增加proxy的

首先手动kill如果是kill -9的话需要一段时间zk上的结点才会消失(取决于proxy设置的zk session超时时间)。
其次zk上的节点消失到jodis这边收到通知也有一定的时间,但最长不会超过jodis这边设置的zk session超时时间

这中间需要一个trade off,如果超时时间特别短那jodis切换就会很快,但代价就是proxy很容易因为网络抖动或者高负载而死掉。如果超时时间很长那代价就是jodis切换会很慢。

谢谢

@nsspw
Copy link
Author

nsspw commented Dec 15, 2015

经过测试发现,Jodis无法负载均衡,@Apache9说的很对

@yangzhe1991
Copy link
Member

“无法负载均衡”是什么意思?

@Apache9
Copy link
Member

Apache9 commented Dec 15, 2015

对,你说的无法负载均衡是啥意思?我的意思是jodis最终还是能把坏的节点踢掉的,只是时间长短的问题

@nsspw
Copy link
Author

nsspw commented Dec 15, 2015

可能我说的有点过哦,呵呵,就是像@Apache9说的:”如果超时时间很长那代价就是jodis切换会很慢“,我本地测试结果也是切换时间比较长。

@yangzhe1991
Copy link
Member

你的zk_session_timeout设的是多少?

@Apache9
Copy link
Member

Apache9 commented Dec 15, 2015

那你就把超时时间设短一点儿。。。这个看你业务本身的需求到底是要反应多快

@yangzhe1991
Copy link
Member

还有个问题就是,无论你怎么设参数,业务上如果要求不能访问失败,肯定是要加重试的逻辑的,基于zk的HA永远是比实际的情况慢半拍的

@nsspw
Copy link
Author

nsspw commented Dec 15, 2015

赞同

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

3 participants