From b21b878f36f3c5c8e6b037b55c8be95810bd4388 Mon Sep 17 00:00:00 2001 From: gord chung Date: Wed, 19 Apr 2017 14:28:45 +0000 Subject: [PATCH] configurable hashring replicas as a trade off between less load on coordination backend vs higher worker utilisation. Change-Id: I679e79edf857be3660a80e54e039ded60e8431b5 --- gnocchi/cli.py | 4 ++-- gnocchi/opts.py | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/gnocchi/cli.py b/gnocchi/cli.py index 8d3b9549..c13aca83 100644 --- a/gnocchi/cli.py +++ b/gnocchi/cli.py @@ -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 diff --git a/gnocchi/opts.py b/gnocchi/opts.py index ca3a7be4..f1142fd4 100644 --- a/gnocchi/opts.py +++ b/gnocchi/opts.py @@ -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',