Replace wrong "entries" parameter in docs and commands The correct parameter to configure the number of maximum chronicle-map entries is "maxEntries". Fix documentation and the AnalyzeH2Caches command with the correct configuration value. Issue: Bug 13699 Change-Id: I4d791bc4c0f7635f10bb5d5d51033effa82f56cf
diff --git a/config.md b/config.md index 26b163d..60d4ae1 100644 --- a/config.md +++ b/config.md
@@ -49,7 +49,7 @@ https://www.javadoc.io/doc/net.openhft/chronicle-map/3.8.0/net/openhft/chronicle/map/ChronicleMapBuilder.html#averageValueSize-double- ) -```cache.<name>.entries``` +```cache.<name>.maxEntries``` : The number of entries that this cache is going to hold, _at most_. The actual number of entries needs to be less or equal to this value. @@ -65,7 +65,7 @@ configured entries. Chronicle Map will allocate memory until the actual number of entries inserted -divided by the number configured through `entries` is not +divided by the number configured through `maxEntries` is not higher than the configured `maxBloatFactor`. Chronicle Map works progressively slower when the actual size grows far beyond @@ -154,7 +154,7 @@ * `web_sessions`: * `avgKeySize`: 45 bytes * `avgValueSize`: 221 bytes - * `entries`: 1000 + * `maxEntries`: 1000 * `maxBloatFactor`: 1 Allows up to 1000 users to be logged in. @@ -162,7 +162,7 @@ * `change_notes`: * `avgKeySize`: 36 bytes * `avgValueSize`: 10240 bytes - * `entries`: 1000 + * `maxEntries`: 1000 * `maxBloatFactor`: 2 Allow for a dozen review activities (votes, comments of medium length) to up to @@ -171,7 +171,7 @@ * `accounts`: * `avgKeySize`: 30 bytes * `avgValueSize`: 256 bytes - * `entries`: 1000 + * `maxEntries`: 1000 * `maxBloatFactor`: 1 Allows to cache up to 1000 details of active users, including their display name, @@ -180,7 +180,7 @@ * `diff`: * `avgKeySize`: 98 bytes * `avgValueSize`: 10240 bytes - * `entries`: 1000 + * `maxEntries`: 1000 * `maxBloatFactor`: 3 Allow for up to 1000 medium sized diffs between two commits to be cached. @@ -189,7 +189,7 @@ * `diff_intraline`: * `avgKeySize`: 512 bytes * `avgValueSize`: 2048 bytes - * `entries`: 1000 + * `maxEntries`: 1000 * `maxBloatFactor`: 2 Allow for up to 1000 medium sized diffs between two files to be cached. @@ -198,7 +198,7 @@ * `external_ids_map`: * `avgKeySize`: 24 bytes * `avgValueSize`: 204800 bytes - * `entries`: 2 + * `maxEntries`: 2 * `maxBloatFactor`: 1 This cache holds a map of the parsed representation of all current external IDs. @@ -208,7 +208,7 @@ * `oauth_tokens`: * `avgKeySize`: 8 bytes * `avgValueSize`: 2048 bytes - * `entries`: 1000 + * `maxEntries`: 1000 * `maxBloatFactor`: 1 caches information about the operation performed by a change relative to its @@ -217,7 +217,7 @@ * `mergeability`: * `avgKeySize`: 79 bytes * `avgValueSize`: 16 bytes - * `entries`: 65000 + * `maxEntries`: 65000 * `maxBloatFactor`: 2 Caches information about the mergeability status of up to 1000 open changes. @@ -225,7 +225,7 @@ * `pure_revert`: * `avgKeySize`: 55 bytes * `avgValueSize`: 16 bytes - * `entries`: 1000 + * `maxEntries`: 1000 * `maxBloatFactor`: 1 Caches the result of checking if one change or commit is a pure/clean revert of @@ -234,7 +234,7 @@ * `persisted_projects`: * `avgKeySize`: 128 bytes * `avgValueSize`: 1024 bytes - * `entries`: 250 + * `maxEntries`: 250 * `maxBloatFactor`: 2 Caches the project description records from the refs/meta/config branch of each @@ -244,7 +244,7 @@ * `conflicts`: * `avgKeySize`: 70 bytes * `avgValueSize`: 16 bytes - * `entries`: 1000 + * `maxEntries`: 1000 * `maxBloatFactor`: 1 Caches whether two commits are in conflict with each other. @@ -257,7 +257,7 @@ * `avgKeySize`: 128 bytes * `avgValueSize`: 2048 bytes -* `entries`: 1000 +* `maxEntries`: 1000 * `maxBloatFactor`: 1 ### Gotchas
diff --git a/src/main/java/com/googlesource/gerrit/modules/cache/chroniclemap/command/AnalyzeH2Caches.java b/src/main/java/com/googlesource/gerrit/modules/cache/chroniclemap/command/AnalyzeH2Caches.java index 3dec1cd..89dfeef 100644 --- a/src/main/java/com/googlesource/gerrit/modules/cache/chroniclemap/command/AnalyzeH2Caches.java +++ b/src/main/java/com/googlesource/gerrit/modules/cache/chroniclemap/command/AnalyzeH2Caches.java
@@ -72,7 +72,7 @@ continue; } - config.setLong("cache", baseName, "entries", size); + config.setLong("cache", baseName, "maxEntries", size); config.setLong("cache", baseName, "avgKeySize", avgKeySize); // Account for extra serialization bytes of TimedValue entries.
diff --git a/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/command/AnalyzeH2CachesIT.java b/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/command/AnalyzeH2CachesIT.java index 25327e0..d6ae02d 100644 --- a/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/command/AnalyzeH2CachesIT.java +++ b/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/command/AnalyzeH2CachesIT.java
@@ -47,11 +47,11 @@ String result = adminSshSession.exec(cmd); adminSshSession.assertSuccess(); - assertThat(result).contains("[cache \"mergeability\"]\n" + "\tentries = 1\n"); - assertThat(result).contains("[cache \"diff\"]\n" + "\tentries = 1\n"); - assertThat(result).contains("[cache \"accounts\"]\n" + "\tentries = 4\n"); - assertThat(result).contains("[cache \"diff_summary\"]\n" + "\tentries = 1\n"); - assertThat(result).contains("[cache \"persisted_projects\"]\n" + "\tentries = 3\n"); + assertThat(result).contains("[cache \"mergeability\"]\n" + "\tmaxEntries = 1\n"); + assertThat(result).contains("[cache \"diff\"]\n" + "\tmaxEntries = 1\n"); + assertThat(result).contains("[cache \"accounts\"]\n" + "\tmaxEntries = 4\n"); + assertThat(result).contains("[cache \"diff_summary\"]\n" + "\tmaxEntries = 1\n"); + assertThat(result).contains("[cache \"persisted_projects\"]\n" + "\tmaxEntries = 3\n"); } @Test
diff --git a/tuning.md b/tuning.md index 2f72668..86d8eb2 100644 --- a/tuning.md +++ b/tuning.md
@@ -41,31 +41,31 @@ **************************** [cache "diff_summary"] - entries = 101 + maxEntries = 101 avgKeySize = 192 avgValueSize = 1350 [cache "web_sessions"] - entries = 1 + maxEntries = 1 avgKeySize = 68 avgValueSize = 332 [cache "pure_revert"] - entries = 1 + maxEntries = 1 avgKeySize = 112 avgValueSize = 8 [cache "mergeability"] - entries = 101 + maxEntries = 101 avgKeySize = 150 avgValueSize = 8 [cache "diff"] - entries = 101 + maxEntries = 101 avgKeySize = 188 avgValueSize = 5035 [cache "persisted_projects"] - entries = 2 + maxEntries = 2 avgKeySize = 88 avgValueSize = 4489 [cache "accounts"] - entries = 5 + maxEntries = 5 avgKeySize = 52 avgValueSize = 505 ```