Skip to content

Commit 85f749b

Browse files
heschigopherbot
authored andcommitted
cmd/relui: address performance issues with module zips
Creating the module zips is surprisingly CPU-intensive, and we end up doing it many times in parallel, resulting in it taking more than 10 minutes to finish and triggering the watchdog timer. Disable the watchdog for this task, and give relui more CPU so that it's less of a problem in the first place. (Collateral damage to other tasks is still a concern.) For golang/go#58659. Change-Id: I65b5c47f9fdc011885c0d5f886f4050551d55f61 Reviewed-on: https://go-review.googlesource.com/c/build/+/489275 Reviewed-by: Dmitri Shuralyov <[email protected]> Auto-Submit: Heschi Kreinick <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Run-TryBot: Heschi Kreinick <[email protected]>
1 parent 5a08e2b commit 85f749b

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

cmd/relui/deployment-prod.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ spec:
5959
value: relui
6060
resources:
6161
requests:
62-
cpu: "2"
63-
memory: "4Gi"
62+
cpu: "8"
63+
memory: "8Gi"
6464
- name: cloud-sql-proxy
6565
# It is recommended to use the latest version of the Cloud SQL proxy
6666
image: gcr.io/cloudsql-docker/gce-proxy:latest

internal/relui/workflows.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,7 @@ func (b *BuildReleaseTasks) modFilesFromDistpack(ctx *wf.TaskContext, distpack a
717717
func (b *BuildReleaseTasks) modFilesFromBinary(ctx *wf.TaskContext, target *releasetargets.Target, version string, t time.Time, tar artifact) (moduleArtifact, error) {
718718
result := moduleArtifact{Target: tar.Target}
719719
a, err := b.runBuildStep(ctx, nil, nil, tar, "mod.zip", func(_ *task.BuildletStep, r io.Reader, w io.Writer) error {
720+
ctx.DisableWatchdog() // The zipping process can be time consuming and is unlikely to hang.
720721
var err error
721722
result.Mod, result.Info, err = task.TarToModFiles(target, version, t, r, w)
722723
return err

internal/workflow/workflow.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,11 +460,20 @@ func (c *TaskContext) DisableRetries() {
460460
}
461461

462462
func (c *TaskContext) ResetWatchdog() {
463+
c.resetWatchdog(WatchdogDelay)
464+
}
465+
466+
func (c *TaskContext) DisableWatchdog() {
467+
// Resetting with a very long delay is easier than canceling the timer.
468+
c.resetWatchdog(365 * 24 * time.Hour)
469+
}
470+
471+
func (c *TaskContext) resetWatchdog(d time.Duration) {
463472
// Should only occur in tests.
464473
if c.watchdogTimer == nil {
465474
return
466475
}
467-
c.watchdogTimer.Reset(WatchdogDelay)
476+
c.watchdogTimer.Reset(d)
468477
}
469478

470479
// A Listener is used to notify the workflow host of state changes, for display

0 commit comments

Comments
 (0)