configurable hashring replicas

as a trade off between less load on coordination backend vs higher
worker utilisation.

Change-Id: I679e79edf857be3660a80e54e039ded60e8431b5
This commit is contained in:
gord chung 2017-04-19 14:28:45 +00:00
parent e82460117a
commit b21b878f36
2 changed files with 9 additions and 3 deletions

View File

@ -186,10 +186,10 @@ class MetricProcessor(MetricProcessBase):
if (not self._tasks or
self.group_state != self.partitioner.ring.nodes):
self.group_state = self.partitioner.ring.nodes.copy()
# TODO(gordc): make replicas configurable
self._tasks = [
i for i in six.moves.range(self.store.incoming.NUM_SACKS)
if self.partitioner.belongs_to_self(i, replicas=3)]
if self.partitioner.belongs_to_self(
i, replicas=self.conf.metricd.processing_replicas)]
finally:
return self._tasks or self.fallback_tasks

View File

@ -91,7 +91,13 @@ def list_opts():
"leave system (in seconds). A shorter rate, may "
"improve rebalancing but create more coordination "
"load"),
cfg.IntOpt('processing_replicas',
default=3,
min=1,
help="Number of workers that share a task. A higher "
"value may improve worker utilization but may also "
"increase load on coordination backend. Value is "
"capped by number of workers globally."),
)),
("api", (
cfg.StrOpt('paste_config',