Skip to content

Commit

Permalink
merkle_tree_cache: change default size to 1000
Browse files Browse the repository at this point in the history
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
  • Loading branch information
sluongng authored and copybara-github committed Mar 7, 2022
1 parent 0dc078a commit b1bf9d6
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -540,14 +540,15 @@ public RemoteOutputsStrategyConverter() {

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

@Option(
Expand Down

0 comments on commit b1bf9d6

Please sign in to comment.