Skip to content

Commit b1bf9d6

Browse files
sluongngcopybara-github
authored andcommitted
merkle_tree_cache: change default size to 1000
The implementation of Merkle Tree Cache maintains an in-process map which cache the Input merkle tree's nodes to save traversal time when Bazel have to interact with Remote Cache and/or RBE services. This cache implementation used Caffeine's Soft Values cache which should be used with predictable maximum cache size. Set the default cache size to 1000 instead of unlimited(0). Adjust doc to note that default might not be the most optimal value. Closes #14959. PiperOrigin-RevId: 432917086
1 parent 0dc078a commit b1bf9d6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/java/com/google/devtools/build/lib/remote/options/RemoteOptions.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -540,14 +540,15 @@ public RemoteOutputsStrategyConverter() {
540540

541541
@Option(
542542
name = "experimental_remote_merkle_tree_cache_size",
543-
defaultValue = "0",
543+
defaultValue = "1000",
544544
documentationCategory = OptionDocumentationCategory.REMOTE,
545545
effectTags = {OptionEffectTag.UNKNOWN},
546546
help =
547547
"The number of Merkle trees to memoize to improve the remote cache hit checking speed. "
548548
+ "Even though the cache is automatically pruned according to Java's handling of "
549549
+ "soft references, out-of-memory errors can occur if set too high. If set to 0 "
550-
+ "(default), the cache size is unlimited.")
550+
+ " the cache size is unlimited. Optimal value varies depending on project's size. "
551+
+ "Default to 1000.")
551552
public long remoteMerkleTreeCacheSize;
552553

553554
@Option(

0 commit comments

Comments
 (0)