From af740f30588eaa6d166dc25b500147c11aba1799 Mon Sep 17 00:00:00 2001 From: sixcooler Date: Tue, 23 Jul 2013 14:21:12 +0200 Subject: [PATCH] changed optimization to a segment-size of index-size/5.000.000 + one if not idle + one (and force) if postprocessing --- source/net/yacy/search/Switchboard.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/net/yacy/search/Switchboard.java b/source/net/yacy/search/Switchboard.java index e9b38c6f2..8c7db2b38 100644 --- a/source/net/yacy/search/Switchboard.java +++ b/source/net/yacy/search/Switchboard.java @@ -2290,15 +2290,17 @@ public final class Switchboard extends serverSwitch { long idleAdmin = System.currentTimeMillis() - this.adminAuthenticationLastAccess; long deltaOptimize = System.currentTimeMillis() - this.optimizeLastRun; boolean optimizeRequired = deltaOptimize > 60000 * 60 * 3; // 3 hours + int opts = Math.max(1, (int) (index.fulltext().collectionSize() / 5000000)); + log.info("Solr auto-optimization: idleSearch=" + idleSearch + ", idleAdmin=" + idleAdmin + ", deltaOptimize=" + deltaOptimize + ", proccount=" + proccount); if (idleAdmin > 600000) { // only run optimization if the admin is idle (10 minutes) if (proccount > 0) { - log.info("Solr auto-optimization: running solr.optimize(8)"); - index.fulltext().optimize(8); + opts++; // have postprocessings will force optimazion with one more Segment which is small an quick + optimizeRequired = true; } if (optimizeRequired) { - int opts = idleSearch > 600000 ? 1 : 5; // > 10 minutes idle time will cause a full optimization, otherwise a 5-segment optimization + if (idleSearch < 600000) opts++; // < 10 minutes idle time will cause a optimization with one more Segment which is small an quick log.info("Solr auto-optimization: running solr.optimize(" + opts + ")"); index.fulltext().optimize(opts); this.optimizeLastRun = System.currentTimeMillis();