[Gluster-devel] Load Banalancing in AFR

nicolas prochazka prochazka.nicolas at gmail.com
Thu Apr 2 13:13:33 UTC 2009


Hello,
in afr.c i can read :

afr_first_up_child function which is always call, but if i understand,
there's no load balancing in afr, just the first child up is taken.
Can I just implement a Round Robin function to alternate between child
up or it's more complicated ?

Regards,
Nicolas Prochazka

 /*
  first_up_child - return the index of the first child that is up
 /

int
afr_first_up_child (afr_private_t *priv)
{
 xlator_t * children = NULL;
 int         ret      = -1;
 int         i        = 0;

 LOCK (&priv->lock);
 {
  children = priv->children;
  for (i = 0; i < priv->child_count; i++) {
   if (priv->child_up[i]) {
    ret = i;
    break;
   }
  }
 }
 UNLOCK (&priv->lock);

 return ret;
}





More information about the Gluster-devel mailing list