summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorGeir Storli <geirst@yahooinc.com>2024-03-05 13:39:21 +0000
committerGeir Storli <geirst@yahooinc.com>2024-03-05 13:39:21 +0000
commitd215a12e9c65aa9ef0505e1de6d76d7c13069f41 (patch)
tree3ec82590c0232d1ddeb8871374bbdc75bdcd893f /searchlib
parent40c484e2230f77575c22c50c496fa3f33e898b94 (diff)
Add tuning constants and formulas after analyzing term search performance.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/flow_tuning.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/searchlib/src/vespa/searchlib/queryeval/flow_tuning.h b/searchlib/src/vespa/searchlib/queryeval/flow_tuning.h
index 491f0ad5571..ce5a24d9c2f 100644
--- a/searchlib/src/vespa/searchlib/queryeval/flow_tuning.h
+++ b/searchlib/src/vespa/searchlib/queryeval/flow_tuning.h
@@ -14,4 +14,47 @@ inline double array_cost(double my_est, size_t num_children) {
return my_est * num_children;
}
+/**
+ * The following constants and formulas were derived after analyzing term search over attributes
+ * (with and without fast-search) and disk index by using the iterator benchmark program:
+ * searchlib/src/tests/queryeval/iterator_benchmark
+ *
+ * The following tests were executed on a machine with an Intel Xeon 2.5 GHz CPU with 48 cores and 256 Gb of memory:
+ * ./searchlib_iterator_benchmark_test_app --gtest_filter='*analyze_term_search*'
+ *
+ * The benchmark summary shows the 'average ms per cost' of the different benchmark cases.
+ * The following constants and formulas were derived to balance 'average ms per cost' to be similar
+ * across the different benchmark cases.
+ */
+
+// Non-strict cost of lookup based matching in an attribute (not fast-search).
+inline double lookup_cost(size_t num_indirections) {
+ return 1.0 + (num_indirections * 4.0);
+}
+
+// Strict cost of lookup based matching in an attribute (not fast-search).
+inline double lookup_strict_cost(size_t num_indirections) {
+ return lookup_cost(num_indirections);
+}
+
+// Non-strict cost of matching in a btree posting list (e.g. fast-search attribute or memory index field).
+inline double btree_cost() {
+ return 7.0;
+}
+
+// Strict cost of matching in a btree posting list (e.g. fast-search attribute or memory index field).
+inline double btree_strict_cost(double my_est) {
+ return my_est;
+}
+
+// Non-strict cost of matching in a disk index posting list.
+inline double disk_index_cost() {
+ return 12.0;
+}
+
+// Strict cost of matching in a disk index posting list.
+inline double disk_index_strict_cost(double my_est) {
+ return 1.5 * my_est;
+}
+
}