Skip to content

Commit

Permalink
Move posting list cache size in proton.def
Browse files Browse the repository at this point in the history
  • Loading branch information
toregge committed Nov 12, 2024
1 parent c738b89 commit f223dfa
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 8 deletions.
1 change: 1 addition & 0 deletions lib/app_generator/search_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
13 changes: 11 additions & 2 deletions lib/app_generator/search_cluster.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
41 changes: 37 additions & 4 deletions lib/app_generator/test/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -734,11 +734,44 @@ def test_that_posting_list_cache_can_be_specified

expected_config_fragment='
<index>
<postinglist>
<cache>
<cache>
<postinglist>
<maxbytes>12345</maxbytes>
</cache>
</postinglist>
</postinglist>
</cache>
</index>'

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='
<index>
<cache>
<bitvector>
<maxbytes>12346</maxbytes>
</bitvector>
</cache>
</index>'

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='
<index>
<cache>
<postinglist>
<maxbytes>12345</maxbytes>
</postinglist>
<bitvector>
<maxbytes>12346</maxbytes>
</bitvector>
</cache>
</index>'

assert_substring_ignore_whitespace(actual, expected_config_fragment)
Expand Down
4 changes: 2 additions & 2 deletions tests/performance/mmap_vs_directio/mmap_vs_directio.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f223dfa

Please sign in to comment.