summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@oath.com>2018-03-05 12:13:21 +0000
committerTor Egge <Tor.Egge@oath.com>2018-03-05 12:28:32 +0000
commit4da2c2c885062659e0c86f76061065f9ac4dc216 (patch)
tree2a6b27752704ce8c05fac1af3115f87b72915e91 /searchcore
parent8ce3e8d16fd1c9297d663808fff27cb62f52f924 (diff)
Collect executor stats once per metrics update and pass the info to both
metrics update method for document db legacy metrics and to metrics update method for tagged document db metrics.
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/CMakeLists.txt1
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/documentdb.cpp16
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/documentdb.h5
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/executor_threading_service_stats.cpp25
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/executor_threading_service_stats.h36
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/executorthreadingservice.cpp12
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/executorthreadingservice.h4
7 files changed, 90 insertions, 9 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/server/CMakeLists.txt b/searchcore/src/vespa/searchcore/proton/server/CMakeLists.txt
index 8ee6a4f73ae..cabbc5c101c 100644
--- a/searchcore/src/vespa/searchcore/proton/server/CMakeLists.txt
+++ b/searchcore/src/vespa/searchcore/proton/server/CMakeLists.txt
@@ -34,6 +34,7 @@ vespa_add_library(searchcore_server STATIC
documentsubdbcollection.cpp
emptysearchview.cpp
executor_thread_service.cpp
+ executor_threading_service_stats.cpp
executorthreadingservice.cpp
fast_access_doc_subdb.cpp
fast_access_doc_subdb_configurer.cpp
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
index 39d902ebfc2..2c37d847ba3 100644
--- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
@@ -11,6 +11,7 @@
#include "maintenance_jobs_injector.h"
#include "reconfig_params.h"
#include "bootstrapconfig.h"
+#include "executor_threading_service_stats.h"
#include <vespa/searchcore/proton/attribute/attribute_writer.h>
#include <vespa/searchcore/proton/attribute/imported_attributes_repo.h>
#include <vespa/searchcore/proton/common/eventlogger.h>
@@ -1222,19 +1223,20 @@ DocumentDB::updateMetrics(DocumentDBMetricsCollection &metrics)
return;
}
- updateLegacyMetrics(metrics.getLegacyMetrics());
+ ExecutorThreadingServiceStats threadingServiceStats = _writeService.getStats();
+ updateLegacyMetrics(metrics.getLegacyMetrics(), threadingServiceStats);
updateIndexMetrics(metrics, _subDBs.getReadySubDB()->getSearchableStats());
updateAttributeMetrics(metrics, _subDBs);
- updateMetrics(metrics.getTaggedMetrics());
+ updateMetrics(metrics.getTaggedMetrics(), threadingServiceStats);
}
void
-DocumentDB::updateLegacyMetrics(LegacyDocumentDBMetrics &metrics)
+DocumentDB::updateLegacyMetrics(LegacyDocumentDBMetrics &metrics, const ExecutorThreadingServiceStats &threadingServiceStats)
{
updateMatchingMetrics(metrics.matching, *_subDBs.getReadySubDB());
- metrics.executor.update(_writeService.getMasterExecutor().getStats());
- metrics.summaryExecutor.update(_writeService.getSummaryExecutor().getStats());
- metrics.indexExecutor.update(_writeService.getIndexExecutor().getStats());
+ metrics.executor.update(threadingServiceStats.getMasterExecutorStats());
+ metrics.summaryExecutor.update(threadingServiceStats.getSummaryExecutorStats());
+ metrics.indexExecutor.update(threadingServiceStats.getIndexExecutorStats());
metrics.sessionManager.update(_sessionManager->getGroupingStats());
updateDocstoreMetrics(metrics.docstore, _subDBs, _lastDocStoreCacheStats);
metrics.numDocs.set(getNumDocs());
@@ -1268,7 +1270,7 @@ updateMetrics(DocumentDBTaggedMetrics::AttributeMetrics &metrics)
}
void
-DocumentDB::updateMetrics(DocumentDBTaggedMetrics &metrics)
+DocumentDB::updateMetrics(DocumentDBTaggedMetrics &metrics, const ExecutorThreadingServiceStats &)
{
_jobTrackers.updateMetrics(metrics.job);
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.h b/searchcore/src/vespa/searchcore/proton/server/documentdb.h
index e23cd78b3ad..e25f1fe66fc 100644
--- a/searchcore/src/vespa/searchcore/proton/server/documentdb.h
+++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.h
@@ -43,6 +43,7 @@ namespace proton {
class IDocumentDBOwner;
class MetricsWireService;
class StatusReport;
+class ExecutorThreadingServiceStats;
namespace matching { class SessionManager; }
@@ -198,8 +199,8 @@ private:
virtual void notifyClusterStateChanged(const IBucketStateCalculator::SP &newCalc) override;
void notifyAllBucketsChanged();
- void updateLegacyMetrics(LegacyDocumentDBMetrics &metrics);
- void updateMetrics(DocumentDBTaggedMetrics &metrics);
+ void updateLegacyMetrics(LegacyDocumentDBMetrics &metrics, const ExecutorThreadingServiceStats &threadingServiceStats);
+ void updateMetrics(DocumentDBTaggedMetrics &metrics, const ExecutorThreadingServiceStats &threadingServiceStats);
void updateMetrics(DocumentDBTaggedMetrics::AttributeMetrics &metrics);
/*
diff --git a/searchcore/src/vespa/searchcore/proton/server/executor_threading_service_stats.cpp b/searchcore/src/vespa/searchcore/proton/server/executor_threading_service_stats.cpp
new file mode 100644
index 00000000000..c17731efbc5
--- /dev/null
+++ b/searchcore/src/vespa/searchcore/proton/server/executor_threading_service_stats.cpp
@@ -0,0 +1,25 @@
+// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#include "executor_threading_service_stats.h"
+
+namespace proton {
+
+ExecutorThreadingServiceStats::ExecutorThreadingServiceStats(Stats masterExecutorStats,
+ Stats indexExecutorStats,
+ Stats summaryExecutorStats,
+ Stats indexFieldInverterExecutorStats,
+ Stats indexFieldWriterExecutorStats,
+ Stats attributeFieldWriterExecutorStats)
+ : _masterExecutorStats(masterExecutorStats),
+ _indexExecutorStats(indexExecutorStats),
+ _summaryExecutorStats(summaryExecutorStats),
+ _indexFieldInverterExecutorStats(indexFieldInverterExecutorStats),
+ _indexFieldWriterExecutorStats(indexFieldWriterExecutorStats),
+ _attributeFieldWriterExecutorStats(attributeFieldWriterExecutorStats)
+{
+}
+
+ExecutorThreadingServiceStats::~ExecutorThreadingServiceStats() = default;
+
+
+}
diff --git a/searchcore/src/vespa/searchcore/proton/server/executor_threading_service_stats.h b/searchcore/src/vespa/searchcore/proton/server/executor_threading_service_stats.h
new file mode 100644
index 00000000000..a49aa3021f8
--- /dev/null
+++ b/searchcore/src/vespa/searchcore/proton/server/executor_threading_service_stats.h
@@ -0,0 +1,36 @@
+// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+#pragma once
+
+#include <vespa/vespalib/util/threadstackexecutorbase.h>
+
+namespace proton {
+
+class ExecutorThreadingServiceStats {
+public:
+ using Stats = vespalib::ThreadStackExecutorBase::Stats;
+
+private:
+ Stats _masterExecutorStats;
+ Stats _indexExecutorStats;
+ Stats _summaryExecutorStats;
+ Stats _indexFieldInverterExecutorStats;
+ Stats _indexFieldWriterExecutorStats;
+ Stats _attributeFieldWriterExecutorStats;
+public:
+ ExecutorThreadingServiceStats(Stats masterExecutorStats,
+ Stats indexExecutorStats,
+ Stats summaryExecutorStats,
+ Stats indexFieldInverterExecutorStats,
+ Stats indexFieldWriterExecutorStats,
+ Stats attributeFieldWriterExecutorStats);
+ ~ExecutorThreadingServiceStats();
+
+ const Stats &getMasterExecutorStats() const { return _masterExecutorStats; }
+ const Stats &getIndexExecutorStats() const { return _indexExecutorStats; }
+ const Stats &getSummaryExecutorStats() const { return _summaryExecutorStats; }
+ const Stats &getIndexFieldInverterExecutorStats() const { return _indexFieldInverterExecutorStats; }
+ const Stats &getIndexFieldWriterExecutorStats() const { return _indexFieldWriterExecutorStats; }
+ const Stats &getAttributeFieldWriterExecutorStats() const { return _attributeFieldWriterExecutorStats; }
+};
+
+}
diff --git a/searchcore/src/vespa/searchcore/proton/server/executorthreadingservice.cpp b/searchcore/src/vespa/searchcore/proton/server/executorthreadingservice.cpp
index 52a401a9e35..9a9bc3d2904 100644
--- a/searchcore/src/vespa/searchcore/proton/server/executorthreadingservice.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/executorthreadingservice.cpp
@@ -2,6 +2,7 @@
#include "executorthreadingservice.h"
#include <vespa/vespalib/util/executor.h>
+#include "executor_threading_service_stats.h"
using vespalib::ThreadStackExecutorBase;
@@ -68,5 +69,16 @@ ExecutorThreadingService::setTaskLimit(uint32_t taskLimit, uint32_t summaryTaskL
_attributeFieldWriter.setTaskLimit(taskLimit);
}
+ExecutorThreadingServiceStats
+ExecutorThreadingService::getStats()
+{
+ return ExecutorThreadingServiceStats(_masterExecutor.getStats(),
+ _indexExecutor.getStats(),
+ _summaryExecutor.getStats(),
+ _indexFieldInverter.getStats(),
+ _indexFieldWriter.getStats(),
+ _attributeFieldWriter.getStats());
+}
+
} // namespace proton
diff --git a/searchcore/src/vespa/searchcore/proton/server/executorthreadingservice.h b/searchcore/src/vespa/searchcore/proton/server/executorthreadingservice.h
index 2e9eecf8fea..25aa65d43a7 100644
--- a/searchcore/src/vespa/searchcore/proton/server/executorthreadingservice.h
+++ b/searchcore/src/vespa/searchcore/proton/server/executorthreadingservice.h
@@ -9,6 +9,8 @@
namespace proton {
+class ExecutorThreadingServiceStats;
+
/**
* Implementation of IThreadingService using 2 underlying thread stack executors
* with 1 thread each.
@@ -83,6 +85,8 @@ public:
virtual search::ISequencedTaskExecutor &attributeFieldWriter() override {
return _attributeFieldWriter;
}
+
+ ExecutorThreadingServiceStats getStats();
};
} // namespace proton