mysterious-waiter-14207
09/19/2022, 6:44 PMremote_cache
which default to true and false on some very light processes?
2. Should some process not speculate (local process race with remote cache) because they are too heavy to start? I'm thinking mainly nailgun, java processes or tests.witty-crayon-22786
09/19/2022, 7:08 PM1. Some processes should not be remote cached? like finding binaries on the running machine? maybe new flagyea, this would be a useful optimization. currently these processes are marked as “per session”, but the implementation of that flag is actually to use some random information that will cause them to miss, rather than actually skipping the cache for them: see https://github.com/pantsbuild/pants/blob/f6b2832539e26ddffb19a7d665b9cef697abd0da/src/rust/engine/process_execution/src/remote.rs#L891-L903which default to true and false on some very light processes?remote_cache
witty-crayon-22786
09/19/2022, 7:10 PM2. Should some process not speculate (local process race with remote cache) because they are too heavy to start? I’m thinking mainly nailgun, java processes or tests.maybe… but the heavier the process is to start, the sooner you want to try and start it if the network is going to take a while to return. the issue is more to do with cancellation being expensive: this issue discusses how to make cancellation cheaper: https://github.com/pantsbuild/pants/issues/14937
witty-crayon-22786
09/19/2022, 7:11 PMyea, this would be a useful optimization.note though that because of speculation, this should probably not affect performance: it just causes some unnecessary network traffic during that phase
mysterious-waiter-14207
09/19/2022, 7:37 PMmysterious-waiter-14207
09/19/2022, 7:45 PMwitty-crayon-22786
09/19/2022, 8:05 PMSo the nailgun process would continue and try to build the canceled process and only if that slot is required would kill it?that’s right.
in heavy compilation project (we have around 900 coarsened scala targets), I think that solution might be equal to the current state, especially as the next process would start immediately, because of the speculate read.yea, this is true. #14937 is probably more useful for local iteration, when you’re not compiling your entire graph from scratch. what the optimal strategy is depends a bit on your cache hit rate: • if you’re going to hit for all cache entries, then you didn’t need to speculate at all • if you’re going to miss for all cache entries, then speculating definitely helped
witty-crayon-22786
09/19/2022, 8:08 PMmysterious-waiter-14207
09/19/2022, 8:09 PMmysterious-waiter-14207
09/19/2022, 8:11 PMwitty-crayon-22786
09/19/2022, 8:13 PMwitty-crayon-22786
09/19/2022, 8:32 PMmysterious-waiter-14207
09/19/2022, 8:38 PMmysterious-waiter-14207
09/19/2022, 8:39 PMwitty-crayon-22786
09/19/2022, 8:46 PMwitty-crayon-22786
09/19/2022, 8:47 PMselect
loop will be a little bit tricky, but not too badmysterious-waiter-14207
09/19/2022, 8:58 PMin_workunit!(
"remote_cache_read_speculation",
Level::Trace,
|workunit| async move {
tokio::select! {
cache_result = cache_read_future => {
self.handle_cache_read_completed(cache_result).await
}
s = tokio::time::sleep(tokio::time::Duration::from_millis(100)) => {
tokio::select! {
cache_result = cache_read_future => {
self.handle_cache_read_completed(cache_result).await
}
local_result = &mut local_execution_future => {
workunit.increment_counter(Metric::RemoteCacheSpeculationLocalCompletedFirst, 1);
local_result.map(|res| (res, false))
}
}
}
}
}
).await
}
witty-crayon-22786
09/19/2022, 9:05 PMwitty-crayon-22786
09/19/2022, 9:05 PMmysterious-waiter-14207
09/19/2022, 9:10 PMerror[E0382]: use of moved value: `cache_read_future`
--> process_execution/src/remote_cache.rs:303:30
|
298 | cache_result = cache_read_future => {
| ----------------- value moved here
...
303 | cache_result = cache_read_future => {
| ^^^^^^^^^^^^^^^^^ value used here after move
|
mysterious-waiter-14207
09/19/2022, 9:10 PMwitty-crayon-22786
09/19/2022, 9:16 PMcache_result = &cache_read_future => {
mysterious-waiter-14207
09/19/2022, 9:18 PMCompiling process_execution v0.0.1 (/Users/somdoron/git/pants/src/rust/engine/process_execution)
error[E0277]: `&Pin<Box<dyn futures::Future<Output = std::option::Option<FallibleProcessResultWithPlatform>> + std::marker::Send>>` is not a future
--> process_execution/src/remote_cache.rs:293:9
|
293 | / tokio::select! {
294 | | cache_result = &cache_read_future => {
295 | | self.handle_cache_read_completed(workunit, cache_lookup_start, cache_result, local_execution_future).await
296 | | }
... |
307 | | }
308 | | }
| |_________^ `&Pin<Box<dyn futures::Future<Output = std::option::Option<FallibleProcessResultWithPlatform>> + std::marker::Send>>` is not a future
mysterious-waiter-14207
09/19/2022, 9:22 PMmysterious-waiter-14207
09/19/2022, 9:23 PMwitty-crayon-22786
09/19/2022, 9:23 PMwitty-crayon-22786
09/19/2022, 9:35 PM&mut
: https://github.com/pantsbuild/pants/pull/16922/commits/36b5c0f7f19c085dddcc0980dc0371d00f2d8b69mysterious-waiter-14207
09/19/2022, 9:39 PMwitty-crayon-22786
09/19/2022, 9:39 PMmysterious-waiter-14207
09/21/2022, 9:03 PMmysterious-waiter-14207
09/21/2022, 9:04 PMremote_cache_read_errors: 0
remote_cache_requests: 2129
remote_cache_requests_cached: 2112
remote_cache_requests_uncached: 2
remote_cache_speculation_local_completed_first: 15
remote_cache_speculation_remote_completed_first: 2112
remote_cache_total_time_saved_ms: 8588882
remote_cache_write_attempts: 17
remote_cache_write_errors: 0
remote_cache_write_successes: 17
witty-crayon-22786
09/21/2022, 9:16 PMbusy-vase-39202
09/21/2022, 9:58 PM