From f223dfaed57f57f39cbfe2fdad8a946fcec2b0c8 Mon Sep 17 00:00:00 2001 From: Tor Egge Date: Tue, 12 Nov 2024 13:09:25 +0100 Subject: [PATCH] Move posting list cache size in proton.def --- lib/app_generator/search_app.rb | 1 + lib/app_generator/search_cluster.rb | 13 +++++- lib/app_generator/test/test.rb | 41 +++++++++++++++++-- .../mmap_vs_directio/mmap_vs_directio.rb | 4 +- 4 files changed, 51 insertions(+), 8 deletions(-) diff --git a/lib/app_generator/search_app.rb b/lib/app_generator/search_app.rb index 553db1bbf..e7936c184 100644 --- a/lib/app_generator/search_app.rb +++ b/lib/app_generator/search_app.rb @@ -26,6 +26,7 @@ class SearchApp < App :cpu_socket_affinity => :cpu_socket_affinity, :resource_limits => :resource_limits, :posting_list_cache => :posting_list_cache, + :bitvector_cache => :bitvector_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 62afee9a7..ffdaa7511 100644 --- a/lib/app_generator/search_cluster.rb +++ b/lib/app_generator/search_cluster.rb @@ -30,6 +30,7 @@ class SearchCluster chained_setter :persistence_threads chained_setter :resource_limits chained_setter :posting_list_cache + chained_setter :bitvector_cache chained_setter :proton_resource_limits chained_setter :search_io chained_forward :config, :config => :add @@ -71,6 +72,7 @@ def initialize(name = "search") @persistence_threads = nil @resource_limits = nil @posting_list_cache = nil + @bitvector_cache = nil @proton_resource_limits = nil @search_io = nil end @@ -157,8 +159,15 @@ 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)))) + unless @posting_list_cache.nil? && @bitvector_cache.nil? + cache = ConfigValues.new + unless @posting_list_cache.nil? + cache.add('postinglist', ConfigValue.new('maxbytes', @posting_list_cache)) + end + unless @bitvector_cache.nil? + cache.add('bitvector', ConfigValue.new('maxbytes', @bitvector_cache)) + end + proton.add('index', ConfigValue.new('cache', 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 c852cbeb9..660e29b64 100644 --- a/lib/app_generator/test/test.rb +++ b/lib/app_generator/test/test.rb @@ -734,11 +734,44 @@ def test_that_posting_list_cache_can_be_specified expected_config_fragment=' - - + + 12345 - - + + + ' + + assert_substring_ignore_whitespace(actual, expected_config_fragment) + end + + def test_that_bitvector_list_cache_can_be_specified + actual = SearchApp.new.bitvector_cache(12346).services_xml + + expected_config_fragment=' + + + + 12346 + + + ' + + assert_substring_ignore_whitespace(actual, expected_config_fragment) + end + + def test_that_both_posting_list_cache_and_bitvector_cache_can_be_specified + actual = SearchApp.new.bitvector_cache(12346).posting_list_cache(12345).services_xml + + expected_config_fragment=' + + + + 12345 + + + 12346 + + ' assert_substring_ignore_whitespace(actual, expected_config_fragment) diff --git a/tests/performance/mmap_vs_directio/mmap_vs_directio.rb b/tests/performance/mmap_vs_directio/mmap_vs_directio.rb index d53cb5bd3..c1de850c2 100644 --- a/tests/performance/mmap_vs_directio/mmap_vs_directio.rb +++ b/tests/performance/mmap_vs_directio/mmap_vs_directio.rb @@ -132,8 +132,8 @@ def make_app(search_io_mode:, cache_size_mb: 0) if search_io_mode != 'MMAP' app.config(ConfigOverride.new('vespa.config.search.core.proton'). - add('index', ConfigValue.new('postinglist', - ConfigValue.new('cache', ConfigValue.new('maxbytes', cache_size_mb * 1024 * 1024))))) + add('index', ConfigValue.new('cache', + ConfigValue.new('postinglist', ConfigValue.new('maxbytes', cache_size_mb * 1024 * 1024))))) end app end