summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeir Storli <geirst@vespa.ai>2024-03-05 15:02:04 +0100
committerGitHub <noreply@github.com>2024-03-05 15:02:04 +0100
commit5cb7ce8c755244a81722a1dde95d2463d51eafe5 (patch)
treeacf9f97ebc14235b41b71fec3b1cf625d339c78b
parent6846943722a1c9e37ce2d607b4077ac895e39e54 (diff)
parentd215a12e9c65aa9ef0505e1de6d76d7c13069f41 (diff)
Merge pull request #30489 from vespa-engine/geirst/term-search-flow-tuning
Add tuning constants and formulas after analyzing term search perform…
-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;
+}
+
}