Skip to content

auth_timeout & auth_retry_time of Failover in Redis Cluster supported by Redis-3.0.0-rc1 #2205

Closed

Description

@Spectrumleeee

Hello,
Recently, i study from cluster.c from the source code of Redis-3.0.0-rc1 just to figure it out how the cluster node perform a failover , i have several question below:

  1. the auth_timeout has been set the maximum between 2 times CLUSTER_NODE_TIMEOUT and 2000 mills and auth_retry_time was 2 times the auth_timeout(the annotation for this part from the function clusterHandleSlaveFailover(void) in cluster.c says 'Timeout is MIN(NODE_TIMEOUT_2,2000) milliseconds' may give an opposite meaning), comes my question, After _CLUSTER_NODE_TIMEOUT* mills from a slave node of the FAIL master send a VOTE REQUEST, can we tell this VOTE REQUEST time out just like PING-PONG, why should we wait for 2 times the maximum of CLUSTER_NODE_TIMEOUT and 2000 mills? what is the basis for this assignment?
  2. In extremely situation, for example, there are two slaves are running for master and they reached an impasse after analyzing voting results, so they retry after auth_retry_time, at least 4 times CLUSTER_NODE_TIMEOUT, will it be too long in the process of failover? it just comes to the question : what is the basis of these two timeout: auth_timeout & auth_retry_timeout, i think these two timeout will make a big difference for the performance of failover.

Activity

  1. changed the title [-]auth_timeout & auth_retry_time of Failover in Redis Cluster supported by Redis-3.0.0-rc1[/-] [+]**auth_timeout** & **auth_retry_time** of Failover in Redis Cluster supported by Redis-3.0.0-rc1[/+] on Dec 12, 2014
  2. changed the title [-]**auth_timeout** & **auth_retry_time** of Failover in Redis Cluster supported by Redis-3.0.0-rc1[/-] [+]auth_timeout & auth_retry_time of Failover in Redis Cluster supported by Redis-3.0.0-rc1[/+] on Dec 12, 2014
  3. antirez commented on Dec 16, 2014

    @antirez
    Contributor

    Hello, I understand those times look indeed large. The original rationale was the following: while there is no strict need for the auth time and the retry time of failovers to be proportional to time node timeout, it makes somewhat sense since if you think that reliable detection of failure takes 5 seconds (node timeout), it's strange you want to retry the failover after 500 milliseconds you don't get a reply from the majority. By setting the node timeout, you give some hint about what you expect to be the responsiveness of nodes and the delay of the network.

    Moreover nodes don't vote again to authorize a failover if they voted already, less than node_timeout*2 time ago (this is why the retry time is proportional to that, you can't get voted again before that time). This way it is unlikely that multiple slaves start a failover at the same time, and get voted one after the other, for two different epochs (so no safety issue, technically speaking).

    However mapping this to practical numbers, I don't see huge problems. For example if node timeout is set to 5 seconds, a failover starts. Usually this will be handled by a single slave (because they add an additional delay based on the "rank" of each slave). Even if this fails to happen, you'll see a new failover attempt every 10 seconds, which is not a huge amount of time considering you are already willing to don't change the configuration at all for lack of availability that lasts 5 seconds.

    About the low barrier at 2000 milliseconds, since the failover actual start is delayed between 500 and 1000 milliseconds, this gives us at least 1000 milliseconds to get a reply if the node timeout is set to a small value.

  4. Spectrumleeee commented on Dec 17, 2014

    @Spectrumleeee
    Author

    Yes, auth timeout should be greater than node timeout, and i also found node will not vote again after they voted already in node_timeout_2 in function named clusterSendFailoverAuthIfNeeded().
    And can i think auth_retry_time = auth_timeout_2 means the node will retry after 4 times the node timeout when this node does not get enough Ballots, Generally, in 4 times the node timeout, some node will finish failover and broadcast to others and then stops their retry attempt?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions