diff --git a/lib/app_generator/search_app.rb b/lib/app_generator/search_app.rb index 5ac973b0a..553db1bbf 100644 --- a/lib/app_generator/search_app.rb +++ b/lib/app_generator/search_app.rb @@ -25,6 +25,7 @@ class SearchApp < App :persistence_threads => :persistence_threads, :cpu_socket_affinity => :cpu_socket_affinity, :resource_limits => :resource_limits, + :posting_list_cache => :posting_list_cache, :proton_resource_limits => :proton_resource_limits, :search_io => :search_io, :indexing_cluster => :indexing_cluster, diff --git a/lib/app_generator/search_cluster.rb b/lib/app_generator/search_cluster.rb index be1e3072f..62afee9a7 100644 --- a/lib/app_generator/search_cluster.rb +++ b/lib/app_generator/search_cluster.rb @@ -29,6 +29,7 @@ class SearchCluster chained_setter :min_node_ratio_per_group chained_setter :persistence_threads chained_setter :resource_limits + chained_setter :posting_list_cache chained_setter :proton_resource_limits chained_setter :search_io chained_forward :config, :config => :add @@ -69,6 +70,7 @@ def initialize(name = "search") @hwinfo_disk_shared = true @persistence_threads = nil @resource_limits = nil + @posting_list_cache = nil @proton_resource_limits = nil @search_io = nil end @@ -155,6 +157,9 @@ def proton_config(indent) unless @search_io.nil? proton.add('search', ConfigValue.new('io', @search_io)) end + unless @posting_list_cache.nil? + proton.add('index', ConfigValue.new('postinglist', ConfigValue.new('cache', ConfigValue.new('maxbytes', @posting_list_cache)))) + end XmlHelper.new(indent).to_xml(proton) end diff --git a/lib/app_generator/test/test.rb b/lib/app_generator/test/test.rb index 12dda2d91..c852cbeb9 100644 --- a/lib/app_generator/test/test.rb +++ b/lib/app_generator/test/test.rb @@ -729,6 +729,21 @@ def test_that_search_io_can_be_specified assert_substring_ignore_whitespace(actual, expected_config_fragment) end + def test_that_posting_list_cache_can_be_specified + actual = SearchApp.new.posting_list_cache(12345).services_xml + + expected_config_fragment=' + + + + 12345 + + + ' + + assert_substring_ignore_whitespace(actual, expected_config_fragment) + end + def test_doc_api_and_feeder_options actual = SearchApp.new.enable_document_api(FeederOptions.new.timeout(40)).services_xml diff --git a/tests/search/metrics/metrics.rb b/tests/search/metrics/metrics.rb index 39c7d8265..e4be63a5f 100644 --- a/tests/search/metrics/metrics.rb +++ b/tests/search/metrics/metrics.rb @@ -18,7 +18,7 @@ def test_metrics tune_searchnode({:summary => {:store => {:cache => { :maxsize => 8192, :compression => {:type => :lz4, :level => 8} } } } }). - search_io('DIRECTIO'))) + search_io('DIRECTIO').posting_list_cache(262144))) start # Search handler does a warmup query which may or may not hit the backend, since 8.170. We need to account for this in some search metrics below. @@ -89,6 +89,11 @@ def test_metrics metrics = vespa.search['test'].first.get_total_metrics # Get metrics containing disk index assert_document_db_size_on_disk(metrics) assert_document_db_disk_io(metrics) + assert_document_db_cached_disk_io(metrics, false) + assert_hitcount("f1:c", 2) + metrics = vespa.search['test'].first.get_total_metrics # Get metrics containing disk index + assert_document_db_disk_io(metrics) + assert_document_db_cached_disk_io(metrics, true) end def test_metrics_imported_attributes @@ -185,6 +190,18 @@ def assert_document_db_disk_io(metrics) assert(0 < f1_disk_io["count"]) end + def assert_document_db_cached_disk_io(metrics, expect_cached) + f1_cached_disk_io = get_cached_disk_io_for_field('f1', metrics) + puts "f1_cached_disk_io = " + f1_cached_disk_io.to_s + if expect_cached + assert(1000 < f1_cached_disk_io["sum"]) + assert(0 < f1_cached_disk_io["count"]) + else + assert_equal(0, f1_cached_disk_io["sum"]) + assert_equal(0, f1_cached_disk_io["count"]) + end + end + def get_size_on_disk_for_field(field_name, metrics) metrics.get('content.proton.documentdb.ready.index.size_on_disk', {"documenttype" => "test", "field" => field_name})["last"] @@ -196,6 +213,11 @@ def get_disk_io_for_field(field_name, metrics) {"documenttype" => "test", "field" => field_name}) end + def get_cached_disk_io_for_field(field_name, metrics) + metrics.get('content.proton.documentdb.ready.index.io.search.cached_read_bytes', + {"documenttype" => "test", "field" => field_name}) + end + def dump_metric_names(metrics) metrics.json["values"].each do |metric| name = metric["name"]