summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorGeir Storli <geirst@oath.com>2018-09-19 15:01:44 +0000
committerGeir Storli <geirst@oath.com>2018-09-19 15:01:44 +0000
commit169e1764207be186e8ccabac472f1e3dbfe3c8f6 (patch)
tree4fc0f78a1fea3a2b74f527c64cb0ea65f45cce91 /searchcore
parent68579628424a7619aaf6b7ffcba125d00ca7045a (diff)
Migrate metrics for session manager grouping cache and add metrics for search cache.
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/CMakeLists.txt1
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.cpp60
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.h10
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/legacy_documentdb_metrics.h8
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/legacy_sessionmanager_metrics.cpp29
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/legacy_sessionmanager_metrics.h29
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.cpp18
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.h11
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/documentdb.cpp13
9 files changed, 140 insertions, 39 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/metrics/CMakeLists.txt b/searchcore/src/vespa/searchcore/proton/metrics/CMakeLists.txt
index 6972f6caa98..6e01bae1866 100644
--- a/searchcore/src/vespa/searchcore/proton/metrics/CMakeLists.txt
+++ b/searchcore/src/vespa/searchcore/proton/metrics/CMakeLists.txt
@@ -16,6 +16,7 @@ vespa_add_library(searchcore_proton_metrics STATIC
legacy_attribute_metrics.cpp
legacy_documentdb_metrics.cpp
legacy_proton_metrics.cpp
+ legacy_sessionmanager_metrics.cpp
memory_usage_metrics.cpp
metrics_engine.cpp
resource_usage_metrics.cpp
diff --git a/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.cpp b/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.cpp
index f3930c58449..335ee63668b 100644
--- a/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.cpp
+++ b/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.cpp
@@ -23,18 +23,20 @@ DocumentDBTaggedMetrics::JobMetrics::JobMetrics(metrics::MetricSet* parent)
removedDocumentsPrune("removed_documents_prune", "",
"Pruning of removed documents in 'removed' sub database", this),
total("total", "", "The job load average total of all job metrics", this)
-{ }
+{
+}
-DocumentDBTaggedMetrics::JobMetrics::~JobMetrics() { }
+DocumentDBTaggedMetrics::JobMetrics::~JobMetrics() = default;
DocumentDBTaggedMetrics::SubDBMetrics::SubDBMetrics(const vespalib::string &name, MetricSet *parent)
: MetricSet(name, "", "Sub database metrics", parent),
lidSpace(this),
documentStore(this),
attributes(this)
-{ }
+{
+}
-DocumentDBTaggedMetrics::SubDBMetrics::~SubDBMetrics() { }
+DocumentDBTaggedMetrics::SubDBMetrics::~SubDBMetrics() = default;
DocumentDBTaggedMetrics::SubDBMetrics::LidSpaceMetrics::LidSpaceMetrics(MetricSet *parent)
: MetricSet("lid_space", "", "Local document id (lid) space metrics for this document sub DB", parent),
@@ -47,9 +49,10 @@ DocumentDBTaggedMetrics::SubDBMetrics::LidSpaceMetrics::LidSpaceMetrics(MetricSe
lidFragmentationFactor("lid_fragmentation_factor", "",
"The fragmentation factor of this lid space, indicating the amount of holes in the currently used part of the lid space "
"((highest_used_lid - used_lids) / highest_used_lid)", this)
-{ }
+{
+}
-DocumentDBTaggedMetrics::SubDBMetrics::LidSpaceMetrics::~LidSpaceMetrics() { }
+DocumentDBTaggedMetrics::SubDBMetrics::LidSpaceMetrics::~LidSpaceMetrics() = default;
DocumentDBTaggedMetrics::SubDBMetrics::DocumentStoreMetrics::CacheMetrics::CacheMetrics(MetricSet *parent)
: MetricSet("cache", "", "Document store cache metrics", parent),
@@ -61,7 +64,7 @@ DocumentDBTaggedMetrics::SubDBMetrics::DocumentStoreMetrics::CacheMetrics::Cache
{
}
-DocumentDBTaggedMetrics::SubDBMetrics::DocumentStoreMetrics::CacheMetrics::~CacheMetrics() {}
+DocumentDBTaggedMetrics::SubDBMetrics::DocumentStoreMetrics::CacheMetrics::~CacheMetrics() = default;
DocumentDBTaggedMetrics::SubDBMetrics::DocumentStoreMetrics::DocumentStoreMetrics(MetricSet *parent)
: MetricSet("document_store", "", "Document store metrics for this document sub DB", parent),
@@ -70,16 +73,18 @@ DocumentDBTaggedMetrics::SubDBMetrics::DocumentStoreMetrics::DocumentStoreMetric
maxBucketSpread("max_bucket_spread", "", "Max bucket spread in underlying files (sum(unique buckets in each chunk)/unique buckets in file)", this),
memoryUsage(this),
cache(this)
-{ }
+{
+}
-DocumentDBTaggedMetrics::SubDBMetrics::DocumentStoreMetrics::~DocumentStoreMetrics() { }
+DocumentDBTaggedMetrics::SubDBMetrics::DocumentStoreMetrics::~DocumentStoreMetrics() = default;
DocumentDBTaggedMetrics::AttributeMetrics::AttributeMetrics(MetricSet *parent)
: MetricSet("attribute", "", "Attribute vector metrics for this document db", parent),
resourceUsage(this)
-{ }
+{
+}
-DocumentDBTaggedMetrics::AttributeMetrics::~AttributeMetrics() { }
+DocumentDBTaggedMetrics::AttributeMetrics::~AttributeMetrics() = default;
DocumentDBTaggedMetrics::AttributeMetrics::ResourceUsageMetrics::ResourceUsageMetrics(MetricSet *parent)
: MetricSet("resource_usage", "", "Usage metrics for various attribute vector resources", parent),
@@ -91,7 +96,7 @@ DocumentDBTaggedMetrics::AttributeMetrics::ResourceUsageMetrics::ResourceUsageMe
{
}
-DocumentDBTaggedMetrics::AttributeMetrics::ResourceUsageMetrics::~ResourceUsageMetrics() { }
+DocumentDBTaggedMetrics::AttributeMetrics::ResourceUsageMetrics::~ResourceUsageMetrics() = default;
DocumentDBTaggedMetrics::IndexMetrics::IndexMetrics(MetricSet *parent)
: MetricSet("index", "", "Index metrics (memory and disk) for this document db", parent),
@@ -101,8 +106,7 @@ DocumentDBTaggedMetrics::IndexMetrics::IndexMetrics(MetricSet *parent)
{
}
-DocumentDBTaggedMetrics::IndexMetrics::~IndexMetrics() { }
-
+DocumentDBTaggedMetrics::IndexMetrics::~IndexMetrics() = default;
void
DocumentDBTaggedMetrics::MatchingMetrics::update(const MatchingStats &stats)
@@ -127,9 +131,10 @@ DocumentDBTaggedMetrics::MatchingMetrics::MatchingMetrics(MetricSet *parent)
softDoomFactor("soft_doom_factor", "", "Factor used to compute soft-timeout", this),
queryCollateralTime("query_collateral_time", "", "Average time (sec) spent setting up and tearing down queries", this),
queryLatency("query_latency", "", "Average latency (sec) when matching a query", this)
-{ }
+{
+}
-DocumentDBTaggedMetrics::MatchingMetrics::~MatchingMetrics() {}
+DocumentDBTaggedMetrics::MatchingMetrics::~MatchingMetrics() = default;
DocumentDBTaggedMetrics::MatchingMetrics::RankProfileMetrics::RankProfileMetrics(const vespalib::string &name,
size_t numDocIdPartitions,
@@ -152,7 +157,7 @@ DocumentDBTaggedMetrics::MatchingMetrics::RankProfileMetrics::RankProfileMetrics
}
}
-DocumentDBTaggedMetrics::MatchingMetrics::RankProfileMetrics::~RankProfileMetrics() {}
+DocumentDBTaggedMetrics::MatchingMetrics::RankProfileMetrics::~RankProfileMetrics() = default;
DocumentDBTaggedMetrics::MatchingMetrics::RankProfileMetrics::DocIdPartition::DocIdPartition(const vespalib::string &name, MetricSet *parent) :
MetricSet("docid_partition", {{"docidPartition", name}}, "DocId Partition profile metrics", parent),
@@ -163,7 +168,7 @@ DocumentDBTaggedMetrics::MatchingMetrics::RankProfileMetrics::DocIdPartition::Do
waitTime("wait_time", "", "Time (sec) spent waiting for other external threads and resources", this)
{ }
-DocumentDBTaggedMetrics::MatchingMetrics::RankProfileMetrics::DocIdPartition::~DocIdPartition() {}
+DocumentDBTaggedMetrics::MatchingMetrics::RankProfileMetrics::DocIdPartition::~DocIdPartition() = default;
void
DocumentDBTaggedMetrics::MatchingMetrics::RankProfileMetrics::DocIdPartition::update(const MatchingStats::Partition &stats)
@@ -208,6 +213,15 @@ DocumentDBTaggedMetrics::MatchingMetrics::RankProfileMetrics::update(const Match
}
}
+DocumentDBTaggedMetrics::SessionCacheMetrics::SessionCacheMetrics(metrics::MetricSet *parent)
+ : metrics::MetricSet("session_cache", "", "Metrics for session caches (search / grouping requests)", parent),
+ search("search", this),
+ grouping("grouping", this)
+{
+}
+
+DocumentDBTaggedMetrics::SessionCacheMetrics::~SessionCacheMetrics() = default;
+
DocumentDBTaggedMetrics::DocumentDBTaggedMetrics(const vespalib::string &docTypeName)
: MetricSet("documentdb", {{"documenttype", docTypeName}}, "Document DB metrics", nullptr),
job(this),
@@ -217,9 +231,11 @@ DocumentDBTaggedMetrics::DocumentDBTaggedMetrics(const vespalib::string &docType
notReady("notready", this),
removed("removed", this),
threadingService("threading_service", this),
- matching(this)
-{ }
+ matching(this),
+ sessionCache(this)
+{
+}
-DocumentDBTaggedMetrics::~DocumentDBTaggedMetrics() { }
+DocumentDBTaggedMetrics::~DocumentDBTaggedMetrics() = default;
-} // namespace proton
+}
diff --git a/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.h b/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.h
index b4364673aee..516e6f223bc 100644
--- a/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.h
+++ b/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.h
@@ -4,6 +4,7 @@
#include "attribute_metrics.h"
#include "memory_usage_metrics.h"
#include "executor_threading_service_metrics.h"
+#include "sessionmanager_metrics.h"
#include <vespa/metrics/metricset.h>
#include <vespa/metrics/valuemetric.h>
#include <vespa/searchcore/proton/matching/matching_stats.h>
@@ -159,6 +160,14 @@ struct DocumentDBTaggedMetrics : metrics::MetricSet
~MatchingMetrics();
};
+ struct SessionCacheMetrics : metrics::MetricSet {
+ SessionManagerMetrics search;
+ SessionManagerMetrics grouping;
+
+ SessionCacheMetrics(metrics::MetricSet *parent);
+ ~SessionCacheMetrics();
+ };
+
JobMetrics job;
AttributeMetrics attribute;
IndexMetrics index;
@@ -167,6 +176,7 @@ struct DocumentDBTaggedMetrics : metrics::MetricSet
SubDBMetrics removed;
ExecutorThreadingServiceMetrics threadingService;
MatchingMetrics matching;
+ SessionCacheMetrics sessionCache;
DocumentDBTaggedMetrics(const vespalib::string &docTypeName);
~DocumentDBTaggedMetrics();
diff --git a/searchcore/src/vespa/searchcore/proton/metrics/legacy_documentdb_metrics.h b/searchcore/src/vespa/searchcore/proton/metrics/legacy_documentdb_metrics.h
index 7b01842103b..c61d371ae0b 100644
--- a/searchcore/src/vespa/searchcore/proton/metrics/legacy_documentdb_metrics.h
+++ b/searchcore/src/vespa/searchcore/proton/metrics/legacy_documentdb_metrics.h
@@ -2,9 +2,9 @@
#pragma once
-#include "legacy_attribute_metrics.h"
#include "executor_metrics.h"
-#include "sessionmanager_metrics.h"
+#include "legacy_attribute_metrics.h"
+#include "legacy_sessionmanager_metrics.h"
#include <vespa/metrics/summetric.h>
#include <vespa/searchcore/proton/matching/matching_stats.h>
@@ -16,6 +16,8 @@ namespace proton {
* All these metrics have the document type name as part of the metric name,
* which is not flexible for setting up default metric graph dashboards.
*
+ * TODO: Remove on Vespa 7
+ *
* @deprecated Use DocumentDBTaggedMetrics for all new metrics.
*/
struct LegacyDocumentDBMetrics : metrics::MetricSet
@@ -115,7 +117,7 @@ struct LegacyDocumentDBMetrics : metrics::MetricSet
ExecutorMetrics executor;
ExecutorMetrics indexExecutor;
ExecutorMetrics summaryExecutor;
- search::grouping::SessionManagerMetrics sessionManager;
+ LegacySessionManagerMetrics sessionManager;
SubDBMetrics ready;
SubDBMetrics notReady;
SubDBMetrics removed;
diff --git a/searchcore/src/vespa/searchcore/proton/metrics/legacy_sessionmanager_metrics.cpp b/searchcore/src/vespa/searchcore/proton/metrics/legacy_sessionmanager_metrics.cpp
new file mode 100644
index 00000000000..097398f42ad
--- /dev/null
+++ b/searchcore/src/vespa/searchcore/proton/metrics/legacy_sessionmanager_metrics.cpp
@@ -0,0 +1,29 @@
+// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#include "legacy_sessionmanager_metrics.h"
+
+namespace proton {
+
+LegacySessionManagerMetrics::LegacySessionManagerMetrics(metrics::MetricSet *parent)
+ : metrics::MetricSet("sessionmanager", "", "Grouping session manager metrics", parent),
+ numInsert("numinsert", "", "Number of inserted sessions", this),
+ numPick("numpick", "", "Number if picked sessions", this),
+ numDropped("numdropped", "", "Number of dropped cached sessions", this),
+ numCached("numcached", "", "Number of currently cached sessions", this),
+ numTimedout("numtimedout", "", "Number of timed out sessions", this)
+{
+}
+
+LegacySessionManagerMetrics::~LegacySessionManagerMetrics() = default;
+
+void
+LegacySessionManagerMetrics::update(const proton::matching::SessionManager::Stats &stats)
+{
+ numInsert.inc(stats.numInsert);
+ numPick.inc(stats.numPick);
+ numDropped.inc(stats.numDropped);
+ numCached.set(stats.numCached);
+ numTimedout.inc(stats.numTimedout);
+}
+
+}
diff --git a/searchcore/src/vespa/searchcore/proton/metrics/legacy_sessionmanager_metrics.h b/searchcore/src/vespa/searchcore/proton/metrics/legacy_sessionmanager_metrics.h
new file mode 100644
index 00000000000..3e8e3f54c02
--- /dev/null
+++ b/searchcore/src/vespa/searchcore/proton/metrics/legacy_sessionmanager_metrics.h
@@ -0,0 +1,29 @@
+// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#pragma once
+
+#include <vespa/metrics/countmetric.h>
+#include <vespa/metrics/metricset.h>
+#include <vespa/metrics/valuemetric.h>
+#include <vespa/searchcore/proton/matching/sessionmanager.h>
+
+namespace proton {
+
+/**
+ * Legacy metrics for session manager cache.
+ * TODO: Remove on Vespa 7
+ */
+struct LegacySessionManagerMetrics : metrics::MetricSet
+{
+ metrics::LongCountMetric numInsert;
+ metrics::LongCountMetric numPick;
+ metrics::LongCountMetric numDropped;
+ metrics::LongValueMetric numCached;
+ metrics::LongCountMetric numTimedout;
+
+ void update(const proton::matching::SessionManager::Stats &stats);
+ LegacySessionManagerMetrics(metrics::MetricSet *parent);
+ ~LegacySessionManagerMetrics();
+};
+
+}
diff --git a/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.cpp b/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.cpp
index f609b850876..5fc41acf33c 100644
--- a/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.cpp
+++ b/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.cpp
@@ -1,16 +1,17 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "sessionmanager_metrics.h"
+#include <vespa/vespalib/util/stringfmt.h>
-namespace search::grouping {
+namespace proton {
-SessionManagerMetrics::SessionManagerMetrics(metrics::MetricSet *parent)
- : metrics::MetricSet("sessionmanager", "", "Grouping session manager metrics", parent),
- numInsert("numinsert", "", "Number of inserted sessions", this),
- numPick("numpick", "", "Number if picked sessions", this),
- numDropped("numdropped", "", "Number of dropped cached sessions", this),
- numCached("numcached", "", "Number of currently cached sessions", this),
- numTimedout("numtimedout", "", "Number of timed out sessions", this)
+SessionManagerMetrics::SessionManagerMetrics(const vespalib::string &name, metrics::MetricSet *parent)
+ : metrics::MetricSet(name, "", vespalib::make_string("Session manager cache metrics for %s", name.c_str()), parent),
+ numInsert("num_insert", "", "Number of inserted sessions", this),
+ numPick("num_pick", "", "Number if picked sessions", this),
+ numDropped("num_dropped", "", "Number of dropped cached sessions", this),
+ numCached("num_cached", "", "Number of currently cached sessions", this),
+ numTimedout("num_timedout", "", "Number of timed out sessions", this)
{
}
@@ -26,5 +27,4 @@ SessionManagerMetrics::update(const proton::matching::SessionManager::Stats &sta
numTimedout.inc(stats.numTimedout);
}
-
}
diff --git a/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.h b/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.h
index 37e070c9e04..a1a5dadd1f8 100644
--- a/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.h
+++ b/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.h
@@ -2,13 +2,16 @@
#pragma once
-#include <vespa/searchcore/proton/matching/sessionmanager.h>
-#include <vespa/metrics/metricset.h>
#include <vespa/metrics/countmetric.h>
+#include <vespa/metrics/metricset.h>
#include <vespa/metrics/valuemetric.h>
+#include <vespa/searchcore/proton/matching/sessionmanager.h>
-namespace search::grouping {
+namespace proton {
+/**
+ * Metrics for session manager cache (search or grouping requests).
+ */
struct SessionManagerMetrics : metrics::MetricSet
{
metrics::LongCountMetric numInsert;
@@ -18,7 +21,7 @@ struct SessionManagerMetrics : metrics::MetricSet
metrics::LongCountMetric numTimedout;
void update(const proton::matching::SessionManager::Stats &stats);
- SessionManagerMetrics(metrics::MetricSet *parent);
+ SessionManagerMetrics(const vespalib::string &name, metrics::MetricSet *parent);
~SessionManagerMetrics();
};
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
index ed5c7ca89fc..18d1a760dd6 100644
--- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
@@ -1167,6 +1167,17 @@ updateMatchingMetrics(DocumentDBMetricsCollection &metrics, const IDocumentSubDB
}
void
+updateSessionCacheMetrics(DocumentDBMetricsCollection &metrics, proton::matching::SessionManager &sessionManager)
+{
+ auto searchStats = sessionManager.getSearchStats();
+ metrics.getTaggedMetrics().sessionCache.search.update(searchStats);
+
+ auto groupingStats = sessionManager.getGroupingStats();
+ metrics.getTaggedMetrics().sessionCache.grouping.update(groupingStats);
+ metrics.getLegacyMetrics().sessionManager.update(groupingStats);
+}
+
+void
updateDocumentStoreCacheHitRate(const CacheStats &current, const CacheStats &last,
metrics::LongAverageMetric &cacheHitRate)
{
@@ -1264,6 +1275,7 @@ DocumentDB::updateMetrics(DocumentDBMetricsCollection &metrics)
updateIndexMetrics(metrics, _subDBs.getReadySubDB()->getSearchableStats());
updateAttributeMetrics(metrics, _subDBs);
updateMatchingMetrics(metrics, *_subDBs.getReadySubDB());
+ updateSessionCacheMetrics(metrics, *_sessionManager);
updateMetrics(metrics.getTaggedMetrics(), threadingServiceStats);
}
@@ -1273,7 +1285,6 @@ DocumentDB::updateLegacyMetrics(LegacyDocumentDBMetrics &metrics, const Executor
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.total);
metrics.numDocs.set(getNumDocs());