Change in vdsm[master]: periodic: make ttl factors tunable

fromani at redhat.com fromani at redhat.com
Fri Oct 30 12:06:59 UTC 2015


Francesco Romani has uploaded a new change for review.

Change subject: periodic: make ttl factors tunable
......................................................................

periodic: make ttl factors tunable

We don't know yet the right alchemy for the factors of the TTL formulas,
assuming one good universal formula ever exists.

So, to save some future headache, we expose them as tunable.

TODO: we should clearly mark those tunables as
- advanced/debugging, meaning "you don't usually need to change this"
- volatile, meaning "this may go away anytime once we figure this
out completely"

Change-Id: Id1e5448d244ab0411daf5155dce015b25c753978
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M lib/vdsm/config.py.in
M vdsm/virt/periodic.py
2 files changed, 21 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/94/47894/1

diff --git a/lib/vdsm/config.py.in b/lib/vdsm/config.py.in
index 9ed11ff..079ef19 100644
--- a/lib/vdsm/config.py.in
+++ b/lib/vdsm/config.py.in
@@ -364,6 +364,11 @@
         ('periodic_task_per_worker', '100',
             'Max number of tasks which can be queued on workers.'
             ' This is for internal usage and may change without warning'),
+
+        ('ttl_interval_pervm_mult', '4', ''),
+        ('ttl_interval_pervm_grace', '1', ''),
+        ('ttl_interval_bulk_mult', '2', ''),
+        ('ttl_interval_bulk_grace', '5', ''),
     ]),
 
     # Section: [devel]
diff --git a/vdsm/virt/periodic.py b/vdsm/virt/periodic.py
index fd180c6..a1c4e7d 100644
--- a/vdsm/virt/periodic.py
+++ b/vdsm/virt/periodic.py
@@ -52,11 +52,21 @@
     return interval / 2.
 
 
-def _ttl_from(interval):
+def _per_vm_ttl_from(interval):
     """
     Estimate a sensible skip domain cache TTL given a periodic interval.
     """
-    return interval * 4 + 1
+    return ((
+        config.getint('sampling', 'ttl_interval_per_vm_mult') * interval) +
+        config.getint('sampling', 'ttl_interval_per_vm_grace')
+    )
+
+
+def _bulk_ttl_from(interval):
+    return ((
+        config.getint('sampling', 'ttl_interval_bulk_mult') * interval) +
+        config.getint('sampling', 'ttl_interval_bulk_grace')
+    )
 
 
 def start(cif, scheduler):
@@ -72,7 +82,7 @@
     def per_vm_operation(func, period):
         disp = VmDispatcher(
             cif.getVMs, _executor, func,
-            _timeout_from(period), _ttl_from(period))
+            _timeout_from(period), _per_vm_ttl_from(period))
         return Operation(disp, period, scheduler)
 
     _operations = [
@@ -99,7 +109,9 @@
             sampling.VMBulkSampler(
                 libvirtconnection.get(cif),
                 cif.getVMs,
-                sampling.stats_cache),
+                sampling.stats_cache,
+                ttl=_bulk_ttl_from(
+                    config.getint('vars', 'vm_sample_interval'))),
             config.getint('vars', 'vm_sample_interval'),
             scheduler),
 


-- 
To view, visit https://gerrit.ovirt.org/47894
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id1e5448d244ab0411daf5155dce015b25c753978
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>


More information about the vdsm-patches mailing list