diff options
author | Henning Baldersheim <balder@oath.com> | 2018-01-30 12:35:06 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@oath.com> | 2018-01-30 12:35:06 +0000 |
commit | 91b5ea5eb3290a305978338f1fe11fa8b738d906 (patch) | |
tree | be81c70c96c92f2072af8e072e60e3185dac0c7b /searchcore | |
parent | 700bd36c212986332d14674c7c7e32af994b097c (diff) |
Set a default summary cache of 5% of memory
Diffstat (limited to 'searchcore')
3 files changed, 13 insertions, 4 deletions
diff --git a/searchcore/src/tests/proton/proton_config_fetcher/proton_config_fetcher_test.cpp b/searchcore/src/tests/proton/proton_config_fetcher/proton_config_fetcher_test.cpp index d305cbf532b..994cbd86aa7 100644 --- a/searchcore/src/tests/proton/proton_config_fetcher/proton_config_fetcher_test.cpp +++ b/searchcore/src/tests/proton/proton_config_fetcher/proton_config_fetcher_test.cpp @@ -367,9 +367,14 @@ TEST_FF("require that docstore config computes cachesize automatically if unset" f1.protonBuilder.summary.cache.maxbytes = 2000; auto config = getDocumentDBConfig(f1, f2, hwInfo); EXPECT_EQUAL(2000ul, config->getStoreConfig().getMaxCacheBytes()); - f1.protonBuilder.summary.cache.maxbytes = -1; + + f1.protonBuilder.summary.cache.maxbytes = -7; + config = getDocumentDBConfig(f1, f2, hwInfo); + EXPECT_EQUAL(70000ul, config->getStoreConfig().getMaxCacheBytes()); + + f1.protonBuilder.summary.cache.maxbytes = -700; config = getDocumentDBConfig(f1, f2, hwInfo); - EXPECT_EQUAL(50000ul, config->getStoreConfig().getMaxCacheBytes()); + EXPECT_EQUAL(500000ul, config->getStoreConfig().getMaxCacheBytes()); } TEST_MAIN() { TEST_RUN_ALL(); } diff --git a/searchcore/src/vespa/searchcore/config/proton.def b/searchcore/src/vespa/searchcore/config/proton.def index d7b1cbfa45f..e223ee64828 100644 --- a/searchcore/src/vespa/searchcore/config/proton.def +++ b/searchcore/src/vespa/searchcore/config/proton.def @@ -210,7 +210,9 @@ grow.numdocs int default=10000 restart grow.multivalueallocfactor double default=0.2 restart ## Control cache size in bytes. -summary.cache.maxbytes long default=0 +## Postive numbers are absolute in bytes. +## Negative numbers are a percentage of memory. +summary.cache.maxbytes long default=-5 ## Include visits in the cache, if the visitoperation allows it. ## This will enable another separate cache of summary.cache.maxbytes size. diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp index 27bbd019ff5..c10a4ad95fa 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp @@ -160,7 +160,9 @@ deriveCompression(const T & config) { DocumentStore::Config getStoreConfig(const ProtonConfig::Summary::Cache & cache, const HwInfo & hwInfo) { - size_t maxBytes = (cache.maxbytes < 0) ? hwInfo.memory().sizeBytes()*0.05 : cache.maxbytes; + size_t maxBytes = (cache.maxbytes < 0) + ? (hwInfo.memory().sizeBytes()*std::min(50l, -cache.maxbytes))/100l + : cache.maxbytes; return DocumentStore::Config(deriveCompression(cache.compression), maxBytes, cache.initialentries).allowVisitCaching(cache.allowvisitcaching); } |