[icinga-checkins] icinga.org: icingaweb2-module-director/master: HostApplyMatches: Raise memory_limit for bigger caches

git at icinga.org git at icinga.org
Fri Nov 11 11:50:17 CET 2016


Module: icingaweb2-module-director
Branch: master
Commit: 116016bbfcc9e0ad592127270bc54a2183be7f9a
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=116016bbfcc9e0ad592127270bc54a2183be7f9a

Author: Markus Frosch <markus.frosch at icinga.com>
Date:   Fri Nov 11 10:40:55 2016 +0100

HostApplyMatches: Raise memory_limit for bigger caches

refs #13049

---

 library/Director/Objects/HostApplyMatches.php |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/library/Director/Objects/HostApplyMatches.php b/library/Director/Objects/HostApplyMatches.php
index a6e6877..e3e860a 100644
--- a/library/Director/Objects/HostApplyMatches.php
+++ b/library/Director/Objects/HostApplyMatches.php
@@ -48,8 +48,19 @@ class HostApplyMatches
         return self::$flatObjects;
     }
 
+    protected static function raiseLimits()
+    {
+        // Raise limits. TODO: do this in a failsafe way, and only if necessary
+        // Note: IcingaConfig also raises the limit for generation, **but** we need the higher limit for preview.
+        if ((string) ini_get('memory_limit') !== '-1') {
+            ini_set('memory_limit', '1024M');
+        }
+    }
+
     protected static function fetchFlatObjects(Db $db)
     {
+        self::raiseLimits();
+
         Benchmark::measure('HostApplyMatches: prefetching');
         PrefetchCache::initialize($db);
         $all = IcingaHost::prefetchAll($db);



More information about the icinga-checkins mailing list