Change in vdsm[master]: virt: configurable sampling interval for HostStatsThread
smelamud at redhat.com
smelamud at redhat.com
Wed Mar 25 16:29:30 UTC 2015
Shmuel Leib Melamud has uploaded a new change for review.
Change subject: virt: configurable sampling interval for HostStatsThread
......................................................................
virt: configurable sampling interval for HostStatsThread
Sampling interval and averaging window for HostStatsThread were
hardcoded. Sampling interval was set to 2s which is too short.
Added new configuration options: host_sample_stats_interval and
host_sample_stats_window for this purposes. Sampling interval is set to
15s by default.
Change-Id: I526029a6a45a928fd0af2f320fe64ac842e205a2
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1185279
Signed-off-by: Shmuel Melamud <smelamud at redhat.com>
---
M lib/vdsm/config.py.in
M vdsm/virt/sampling.py
2 files changed, 13 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/91/39191/1
diff --git a/lib/vdsm/config.py.in b/lib/vdsm/config.py.in
index cf8cadd..099e458 100644
--- a/lib/vdsm/config.py.in
+++ b/lib/vdsm/config.py.in
@@ -170,6 +170,10 @@
('vm_sample_numa_interval', '15',
'How often should we sample NUMA CPU assignments'),
+ ('host_sample_stats_interval', '15', None),
+
+ ('host_sample_stats_window', '5', None),
+
('trust_store_path', '@TRUSTSTORE@',
'Where the certificates and keys are situated.'),
diff --git a/vdsm/virt/sampling.py b/vdsm/virt/sampling.py
index 87d9bed..82f2a7e 100644
--- a/vdsm/virt/sampling.py
+++ b/vdsm/virt/sampling.py
@@ -34,6 +34,7 @@
from vdsm import ipwrapper
from vdsm import netinfo
from vdsm import utils
+from vdsm.config import config
import caps
@@ -515,8 +516,6 @@
"""
A thread that periodically samples host statistics.
"""
- AVERAGING_WINDOW = 5
- SAMPLE_INTERVAL_SEC = 2
_CONNLOG = logging.getLogger('connectivity')
def __init__(self, log):
@@ -531,6 +530,11 @@
self._pid = os.getpid()
self._ncpus = max(os.sysconf('SC_NPROCESSORS_ONLN'), 1)
+ self._sampleInterval = \
+ config.getint('vars', 'host_sample_stats_interval')
+ self._averagingWindow = \
+ config.getint('vars', 'host_sample_stats_window')
+
def stop(self):
self._stopEvent.set()
@@ -542,7 +546,7 @@
import vm
try:
# wait a bit before starting to sample
- time.sleep(self.SAMPLE_INTERVAL_SEC)
+ time.sleep(self._sampleInterval)
while not self._stopEvent.isSet():
try:
sample = self.sample()
@@ -554,11 +558,11 @@
if diff:
self._CONNLOG.debug('%s', diff)
- if len(self._samples) > self.AVERAGING_WINDOW:
+ if len(self._samples) > self._averagingWindow:
self._samples.pop(0)
except vm.TimeoutError:
self._log.exception("Timeout while sampling stats")
- self._stopEvent.wait(self.SAMPLE_INTERVAL_SEC)
+ self._stopEvent.wait(self._sampleInterval)
except:
if not self._stopEvent.isSet():
self._log.exception("Error while sampling stats")
--
To view, visit https://gerrit.ovirt.org/39191
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I526029a6a45a928fd0af2f320fe64ac842e205a2
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Shmuel Leib Melamud <smelamud at redhat.com>
More information about the vdsm-patches
mailing list