[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14114855#comment-14114855
 ] 

Alexander Shraer commented on ZOOKEEPER-2016:
---------------------------------------------

Hi Hongchao, 

this looks very nice! 

to avoid the first connect issue you could do something like this:
if (version == -1) {
  version = configVersion;
  return;
}

of course there still should be some default policy, like sleeping between min 
and max.
alternatively, perhaps its more flexible if before calling updateServerList the 
code calls a function provided in the policy class by the user. 

The way I tested these things is using a modified system test, where each 
server also reports the number of client connections and not only performance 
stats. Then while the system test is running you could invoke a reconfig and 
see what happens to the number of client connections per server.

We have StaticHostProvider tests for rebalancing, but they don't create a 
ZooKeeper object, IIRC.

Perhaps you could do it in a unit test. For example if you have 5 servers, 
start 100 clients with a connection string including all of them. Then 
reconfigure to remove one server, and make sure that the number of clients
connected to the removed server goes to 0 and each remaining server is 
approximately the same.


> Automate client-side rebalancing
> --------------------------------
>
>                 Key: ZOOKEEPER-2016
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2016
>             Project: ZooKeeper
>          Issue Type: Improvement
>            Reporter: Hongchao Deng
>         Attachments: draft-2.patch, draft.patch
>
>
> ZOOKEEPER-1355 introduced client-side rebalancing, which is implemented in 
> both the C and Java client libraries. However, it requires the client to 
> detect a configuration change and call updateServerList with the new 
> connection string (see reconfig manual). It may be better if the client just 
> indicates that he is interested in this feature when creating a ZK handle and 
> we'll detect configuration changes and invoke updateServerList for him 
> underneath the hood.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to