Skip to content

Commit

Permalink
merkle_tree_cache: change default size to 1000 (bazelbuild#14984)
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 bazelbuild#14959.

PiperOrigin-RevId: 432917086
(cherry picked from commit b1bf9d6)

Co-authored-by: Son Luong Ngoc <[email protected]>
  • Loading branch information
brentleyjones and sluongng authored Mar 7, 2022
1 parent 61cfa1d commit 0764821
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 0764821

Please sign in to comment.