Skip to content

x/build: use Cloud Run #31834

@bradfitz

Description

@bradfitz

There are a lot of interesting things we could do with Cloud Run for the Go build system.

The make.bash step would be great, but at Cloud Run's 1 vCPU, that takes 4.5 minutes. If they add support for cranking that up, we plateau pretty flatly around 4 vCPUs (1m45s). It doesn't get much better than 1m15s even with 96 CPUs. So 4 vCPUs would be great. But that's not available.

But we could also wrap each make.bash tool invocation (compile, link, etc) with a toolexec wrapper, and run each step remotely as its own Cloud Run call. We'd need to inject a VFS into the remote call with some private syscall and/or os package hooks, as Cloud Run doesn't permit FUSE or NFS or anything in the kernel. (It's gVisor)

So Cloud Run for make.bash naively is too slow today with its 1 vCPU (4.5 minutes) and doing make.bash quickly on Cloud Run today requires some time consuming (but straight forward) work for the VFS and wrappers.

But tests today are easy...

We can do make.bash elsewhere, and then use Cloud Run to massively shard the test execution.

With a make.bash snapshot,

  • first run go tool dist test --list to find all the tests
  • then run each of those tests as its own Cloud Run call
  • but for standard package "testing" tests, shard further... go test -list . unicode/utf8 to get all the TestFoo names, then:
  • separate call for each utf8.test -short -vet=off -run=^TestEncodeRune$, etc.

Cloud Run's default quota (before asking for it to be raised) permits 1,000 instances. We'd need to lock down concurrency to 1 call per service (probably), but 1,000 test executions in parallel SGTM.

I hacked up a super rough prototype today that's promising.

/cc @dmitshur

Metadata

Metadata

Assignees

No one assigned

    Labels

    Buildersx/build issues (builders, bots, dashboards)NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Performance

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions