diff options
author | Tor Egge <Tor.Egge@oath.com> | 2017-12-05 13:01:26 +0000 |
---|---|---|
committer | Tor Egge <Tor.Egge@oath.com> | 2017-12-05 13:01:26 +0000 |
commit | 9f1dff759284838b27c05c08c41af88c054a34c6 (patch) | |
tree | d6ca0d6683c0f070640f9c141c5dafbe9ba63501 /searchcore | |
parent | 43e141e0567ae7eb67c0d7eeb9eb8177a59fab04 (diff) |
Delay check of total memory and disk gains until we have calculated the
totals.
Diffstat (limited to 'searchcore')
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/server/memoryflush.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/server/memoryflush.cpp b/searchcore/src/vespa/searchcore/proton/server/memoryflush.cpp index e80f2645fcf..ea787868f18 100644 --- a/searchcore/src/vespa/searchcore/proton/server/memoryflush.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/memoryflush.cpp @@ -120,13 +120,6 @@ size_t computeGain(const IFlushTarget::DiskGain & gain) { return std::max(100000000l, std::max(gain.getBefore(), gain.getAfter())); } -bool isDiskBloatToHigh(const IFlushTarget::DiskGain & totalDisk, - const MemoryFlush::Config & config, - const IFlushTarget::DiskGain & dgain) -{ - return (totalDisk.gain() > config.globalDiskBloatFactor * computeGain(totalDisk)) - || (dgain.gain() > config.diskBloatFactor * computeGain(dgain)); -} } @@ -167,9 +160,9 @@ MemoryFlush::getFlushTargets(const FlushContext::List &targetList, order = TLSSIZE; } } - if (((totalMemory >= config.maxGlobalMemory) || (mgain >= config.maxMemoryGain)) && (order < MEMORY)) { + if ((mgain >= config.maxMemoryGain) && (order < MEMORY)) { order = MEMORY; - } else if (isDiskBloatToHigh(totalDisk, config, dgain) && (order < DISKBLOAT)) { + } else if ((dgain.gain() > config.diskBloatFactor * computeGain(dgain)) && (order < DISKBLOAT)) { order = DISKBLOAT; } else if ((timeDiff >= config.maxTimeGain) && (order < MAXAGE)) { order = MAXAGE; @@ -195,6 +188,14 @@ MemoryFlush::getFlushTargets(const FlushContext::List &targetList, timeDiff.sec(), getOrderName(order).c_str()); } + if (!targetList.empty()) { + if ((totalMemory >= config.maxGlobalMemory) && (order < MEMORY)) { + order = MEMORY; + } + if ((totalDisk.gain() > config.globalDiskBloatFactor * computeGain(totalDisk)) && (order < DISKBLOAT)) { + order = DISKBLOAT; + } + } FlushContext::List fv(targetList); std::sort(fv.begin(), fv.end(), CompareTarget(order, tlsStatsMap)); // No desired order and no urgent needs; no flush required at this moment. |