Skip to content

Commit 387a585

Browse files
bvincsluongng
authored andcommitted
[rbe cache]: configure FindMissingBlobs batch size
The OSS RE client used a fixed 100-digest limit for each FindMissingBlobs request. High-latency backends can spend a long time in serial round trips when an action has many digests to check. Expose the limit as buck2_re_client.find_missing_blobs_batch_size while preserving the 100-digest default. Clamp zero to one so an invalid value does not create a degenerate batching path. Original-Commit: 72aaf61 Source-PR: facebook#1330
1 parent 04d1292 commit 387a585

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

  • app/buck2_re_configuration/src
  • remote_execution/oss/re_grpc/src

app/buck2_re_configuration/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,8 @@ pub struct Buck2OssReConfiguration {
476476
pub remote_cache_compression_threshold: Option<usize>,
477477
/// Maximum number of concurrent upload requests for each action.
478478
pub max_concurrent_uploads_per_action: Option<usize>,
479+
/// Maximum number of digests to ask about in a single FindMissingBlobs RPC.
480+
pub find_missing_blobs_batch_size: Option<usize>,
479481
/// Time that digests are assumed to live in CAS after being touched.
480482
pub cas_ttl_secs: Option<i64>,
481483
/// Whether to chunk large remote-cache blobs using FastCDC 2020 and SpliceBlob.
@@ -615,6 +617,10 @@ impl Buck2OssReConfiguration {
615617
section: BUCK2_RE_CLIENT_CFG_SECTION,
616618
property: "max_concurrent_uploads_per_action",
617619
})?,
620+
find_missing_blobs_batch_size: legacy_config.parse(BuckconfigKeyRef {
621+
section: BUCK2_RE_CLIENT_CFG_SECTION,
622+
property: "find_missing_blobs_batch_size",
623+
})?,
618624
cas_ttl_secs: legacy_config.parse(BuckconfigKeyRef {
619625
section: BUCK2_RE_CLIENT_CFG_SECTION,
620626
property: "cas_ttl_secs",

remote_execution/oss/re_grpc/src/client.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1094,6 +1094,8 @@ pub struct RERuntimeOpts {
10941094
max_concurrent_uploads_per_action: Option<usize>,
10951095
/// Time that digests are assumed to live in CAS after being touched.
10961096
cas_ttl_secs: i64,
1097+
/// Maximum number of digests per FindMissingBlobs RPC.
1098+
find_missing_blobs_batch_size: usize,
10971099
/// Whether to chunk large remote-cache blobs using FastCDC 2020 and SpliceBlob.
10981100
remote_cache_chunking: bool,
10991101
/// Minimum blob size for remote cache compression.
@@ -2321,6 +2323,10 @@ impl REClientBuilder {
23212323
// NOTE: This is an arbitrary number because RBE does not return information
23222324
// on the TTL of the remote blob.
23232325
cas_ttl_secs: opts.cas_ttl_secs.unwrap_or(3 * 60 * 60),
2326+
find_missing_blobs_batch_size: opts
2327+
.find_missing_blobs_batch_size
2328+
.unwrap_or(100)
2329+
.max(1),
23242330
remote_cache_chunking: opts.remote_cache_chunking,
23252331
remote_cache_compression_threshold,
23262332
retries,
@@ -4647,6 +4653,7 @@ impl REClient {
46474653
let mut remote_results: HashMap<TDigest, DigestRemoteState> = HashMap::new();
46484654
let mut digests_to_check: Vec<TDigest> = Vec::new();
46494655

4656+
let batch_size = self.runtime_opts.find_missing_blobs_batch_size;
46504657
let mut digest_iter = request.digests.iter();
46514658
while digest_iter.len() > 0 {
46524659
// Sort our blobs based on what action we need to take
@@ -4664,7 +4671,7 @@ impl REClient {
46644671
// We can check this blob
46654672
digests_to_check.push(digest.clone());
46664673
}
4667-
if digests_to_check.len() >= 100 {
4674+
if digests_to_check.len() >= batch_size {
46684675
break;
46694676
}
46704677
}
@@ -6916,6 +6923,7 @@ mod tests {
69166923
request_metadata_tool_name: DEFAULT_REQUEST_METADATA_TOOL_NAME.to_owned(),
69176924
max_concurrent_uploads_per_action: None,
69186925
cas_ttl_secs: 0,
6926+
find_missing_blobs_batch_size: 100,
69196927
remote_cache_chunking: false,
69206928
remote_cache_compression_threshold: DEFAULT_REMOTE_CACHE_COMPRESSION_THRESHOLD,
69216929
retries: 0,

0 commit comments

Comments
 (0)