ShardedJedisFactory#makeObject blocks forever if shard cannot connect
ShardedJedisFactory#makeObject blocks forever (infinitely loops) to get all the shards to connect. This introduces a single point of failure for the client application if the redis server is down or otherwise unavailable. Please consider either implementing a limited number of retries or a timeout, after which the Exception should just be bubbled up so the client application can handle it and move on.
yes, this definitely makes sense, probably it should be configurable and have some default.
In case of one shard downtime we'll get exception on first command to that shard. All other shard could work further. Added pull request with removal of mandatory connection to all shard in makeObject.
Already working on a solution for this. Will send a pull request later today. My solution was to add a max number of retries so if a shard cannot connect after n retries it returns a disconnected shard for you to work with
plz check discussion in issue "Issue 78". Why do we need retries and connects in make object at all? Jonathan agreed to merge, but had no opportunity to do so yet..
Ok, didn't see that solution. It's really much simpler. We are having some problems with redis servers stopping to respond for some time and WE added retries for that, but as it will try to reconnect on every command it's really useless. I agree with your solution
2011/4/5 grdmitro < [email protected]>
plz check discussion in issue "Issue 78". Why do we need retries and connects in make object at all? Jonathan agreed to merge, but had not opportunity to do so yet
Reply to this email directly or view it on GitHub: https://github.com/xetorthio/jedis/issues/78#comment_958807
One problem remains open though with several implications:
- Hang will still occur on verify() call if testOnSomething is enabled.
- Networking overhead during one shard downtime: on connection attempt to broken shard we'll get exception and dispose the whole ShardedJedis (and connections to all other shards that are supposedly alive). That could be fixed by pooling each shard separately. Will create separate issue for this when merged/closed.
2011/4/5 grdmitro < [email protected]>
One problem remains open though with several implications;
- Hang will still occur on verify() call if testOnSomething is enabled.
Yeps, I have to check on APache pool documentation to see with path to take
- Networking owerhead during one shard downtime: on connection attempt to broken shard we'll get exception and dispose the whole ShardedJedis (and connections to all other shards that are supposedly alive). That could be fixed by pooling each shard separately.
But if no teston... is selected the pool shouldn't call verify so the poolable object will still be thought as valid. I have a problem with my version of the fix that perhaps you solved: When loosing a connection to a redis server, the shard still thinks it's connected and that raises a broken pipe exception when sending a command since the isConnected() returns true despite the fact that the connections was lost. Did you solve this?
Will create separate issue for this when merged/closed.
Reply to this email directly or view it on GitHub: https://github.com/xetorthio/jedis/issues/78#comment_958920
right, on broken pipe exception(JedisConnectionException) I'm returning resource as broken [pool.returnBrokenResource(jedis)] and returning empty value or something as shard is unavailable
ok, but then it will certainly make a new object on next getResource()
I'm wandering if it is worth adapting isConnected to handle that case...
2011/4/5 grdmitro < [email protected]>
right, on broken pipe exception(JedisConnectionException) I'm returning resource as broken [pool.returnBrokenResource(jedis)] and returning empty value or something as shard is unavailable
Reply to this email directly or view it on GitHub: https://github.com/xetorthio/jedis/issues/78#comment_958963
not sure i understood regarding isConnected. it's already being called before each command(before actual connection attempt).. or what do you mean?
if a shard starts connected but later on the server falls down, on issuing a command isConected returns true and an exception is thrown at getBulk.... isConnected is not considering server falls... it seems. I'm still checking it
2011/4/5 grdmitro < [email protected]>
not sure i understood regarding is connected. it's already being called before each command(before actual connection attempt)..
Reply to this email directly or view it on GitHub: https://github.com/xetorthio/jedis/issues/78#comment_959066
btw, sorry i haven't really been following the discussion here. we've actually switched to our own sharded implementation in which instead of having pool of objects that can talk to alll shards and it's either an all-or-nothing connection (which is very costly that whenever connection to one shard fails, the object is returned as broken so connections to all shards are reset), we implemented so that we have a sharded collection of pools that just talk to one shard. if connection is broken to a particular shard, other shards are not affected at all. in our load test it's also shown that the redis server really hates handling lots of disconnection and connection, so it's better not to go for the all-or-none approach.
great! so the suggested pull request will address this issue the right way! :) awesome! I am very happy with the pull request.
On Tue, Apr 5, 2011 at 2:25 PM, mewmewball < [email protected]>wrote:
btw, sorry i haven't really been following the discussion here. we've actually switched to our own sharded implementation in which instead of having pool of objects that can talk to alll shards and it's either an all-or-nothing connection (which is very costly that whenever connection to one shard fails, the object is returned as broken so connections to all shards are reset), we implemented so that we have a sharded collection of pools that just talk to one shard. if connection is broken to a particular shard, other shards are not affected at all. in our load test it's also shown that the redis server really hates handling lots of disconnection and connection, so it's better not to go for the all-or-none approach.
Reply to this email directly or view it on GitHub: https://github.com/xetorthio/jedis/issues/78#comment_960141
just pushed the pull request to master, so it is time to close this issue! :)
mewmewball, you're absolutely right, I've opened 118 for this, let's continue discussion there. thanks Jonathan!