diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2019-08-29 14:19:59 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2019-08-29 14:19:59 +0000 |
commit | fb3faed94ddccfb184e59feb754e07119bf53755 (patch) | |
tree | 9e28a5661376e465cd96404ca1ed1a421844329e /searchcore | |
parent | 7234edd83fcc42e79d3b419a026dae137f617b63 (diff) |
Do not allow adjustment of soft timout factor the first 60 seconds after a matcher has been created.
Diffstat (limited to 'searchcore')
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/matching/matcher.cpp | 8 | ||||
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/matching/matcher.h | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp index 9ddf1ff8ac9..9eb82ae7ab3 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp @@ -38,6 +38,8 @@ namespace proton::matching { namespace { +constexpr long SECONDS_BEFORE_ALLOWING_SOFT_TIMEOUT_FACTOR_ADJUSTMENT = 60; + // used to give out empty whitelist blueprints struct StupidMetaStore : search::IDocumentMetaStore { bool getGid(DocId, GlobalId &) const override { return false; } @@ -135,6 +137,7 @@ Matcher::Matcher(const search::index::Schema &schema, const Properties &props, c _viewResolver(ViewResolver::createFromSchema(schema)), _statsLock(), _stats(), + _startTime(my_clock::now()), _clock(clock), _queryLimiter(queryLimiter), _distributionKey(distributionKey) @@ -337,7 +340,10 @@ Matcher::match(const SearchRequest &request, vespalib::ThreadBundle &threadBundl if (adjustedDuration < 0) { adjustedDuration = 0; } - _stats.updatesoftDoomFactor(request.getTimeout(), softLimit, adjustedDuration); + bool allowedSoftTimeoutFactorAdjustment = (std::chrono::duration_cast<std::chrono::seconds>(my_clock::now() - _startTime).count() > SECONDS_BEFORE_ALLOWING_SOFT_TIMEOUT_FACTOR_ADJUSTMENT); + if (allowedSoftTimeoutFactorAdjustment) { + _stats.updatesoftDoomFactor(request.getTimeout(), softLimit, adjustedDuration); + } LOG(info, "Triggered softtimeout factor adjustment. Coverage = %lu of %u documents. request=%1.3f, doomOvertime=%1.3f, limit=%1.3f and duration=%1.3f, rankprofile=%s" ", factor adjusted from %1.3f to %1.3f", covered, numActiveLids, diff --git a/searchcore/src/vespa/searchcore/proton/matching/matcher.h b/searchcore/src/vespa/searchcore/proton/matching/matcher.h index 3fb1fb24c70..f234b76008e 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/matcher.h +++ b/searchcore/src/vespa/searchcore/proton/matching/matcher.h @@ -48,12 +48,14 @@ private: using IAttributeContext = search::attribute::IAttributeContext; using DocsumRequest = search::engine::DocsumRequest; using Properties = search::fef::Properties; + using my_clock = std::chrono::steady_clock; IndexEnvironment _indexEnv; search::fef::BlueprintFactory _blueprintFactory; search::fef::RankSetup::SP _rankSetup; ViewResolver _viewResolver; std::mutex _statsLock; MatchingStats _stats; + my_clock::time_point _startTime; const vespalib::Clock &_clock; QueryLimiter &_queryLimiter; uint32_t _distributionKey; |