[PATCH BRANCH:release-2.0] Add a random initial offset to the afr round robin index

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch helps to distribute load across an afr cluster
when you have clients with the same access patterns, such
as in benchmarking or map-reduce. By randomly offsetting
the initial read_child_rr, clients should distribute reads
over the afr nodes on average.

A better solution could be to randomly shuffle the children
instead of chosing a different initial offset. This should
average the reads better across the nodes, but I'm not
sure if there are any other consequences to doing this.
---
 xlators/cluster/afr/src/afr.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c
index a94f926..118e0fc 100644
--- a/xlators/cluster/afr/src/afr.c
+++ b/xlators/cluster/afr/src/afr.c
@@ -2494,6 +2494,9 @@ init (xlator_t *this)
 		i++;
 	}
 
+	/* Randomly pick the starting read child */
+	priv->read_child_rr = random() % priv->child_count;
+
 	ret = 0;
 out:
 	return ret;
-- 
1.6.3.1





[Index of Archives]     [Gluster Users]     [Ceph Users]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux