Skip to content

cachers,cmd/go-cacher: make HTTP PUTs async for BestEffortHTTP#40

Merged
tomhjp merged 1 commit into
mainfrom
tomhjp/async-puts
Jul 22, 2026
Merged

cachers,cmd/go-cacher: make HTTP PUTs async for BestEffortHTTP#40
tomhjp merged 1 commit into
mainfrom
tomhjp/async-puts

Conversation

@tomhjp

@tomhjp tomhjp commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Most of the time, PUTs don't significantly add to a build's latency, but occasionally we've seen an outsized amount of time spent on doing PUTs for a build. In addition to making BestEffortHTTP ignore errors, also make it run PUTs in a background goroutine with support for timeouts and concurrency control. This better represents best-effort PUTs as an optimisation, not a dependency for correctness.

Disk writes still have to happen synchronously though, because cmd/go expects the file to exist and be readable/seekable as soon as the RPC returns.

Updates tailscale/corp#45334

@tomhjp
tomhjp requested a review from bradfitz July 22, 2026 14:03
Comment thread cachers/http.go Outdated
Comment thread cachers/http.go Outdated
Comment thread cachers/http.go Outdated
Most of the time, PUTs don't significantly add to a build's latency, but
occasionally we've seen an outsized amount of time spent on doing PUTs
for a build. In addition to making BestEffortHTTP ignore errors, also
make it run PUTs in a background goroutine with support for timeouts and
concurrency control. This better represents best-effort PUTs as an
optimisation, not a dependency for correctness.

Disk writes still have to happen synchronously though, because cmd/go
expects the file to exist and be readable/seekable as soon as the RPC
returns.

Updates tailscale/corp#45334

Signed-off-by: Tom Proctor <[email protected]>
@tomhjp
tomhjp force-pushed the tomhjp/async-puts branch from b0019fd to 44cbb3b Compare July 22, 2026 20:14
@tomhjp
tomhjp merged commit 0bb331e into main Jul 22, 2026
3 checks passed
@tomhjp
tomhjp deleted the tomhjp/async-puts branch July 22, 2026 20:18
tomhjp added a commit to tailscale/tailscale that referenced this pull request Jul 22, 2026
Pull in bradfitz/go-tool-cache#40, and configure PUTs to be async so we
never slow down the build or extend the build time for the sake of
writing to the remote cache.

Updates tailscale/corp#45334

Signed-off-by: Tom Proctor <[email protected]>
tomhjp added a commit to tailscale/tailscale that referenced this pull request Jul 22, 2026
Pull in bradfitz/go-tool-cache#40, and configure PUTs to be async so we
never slow down the build or extend the build time for the sake of
writing to the remote cache.

Updates tailscale/corp#45334

Signed-off-by: Tom Proctor <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants