Repository navigation
Balance the cluster test's shards and cut its waits - #8858
Merged
Merged
Conversation
Each of cluster-test's 5 shards took 33-52 s, the slowest holding several of the tests that wait out a lease or a drain, so the test needed the eternal timeout. * The shards are balanced by cost rather than taken round robin. `COSTS` says about how long each test that takes 3 s or more takes, and each test, costliest first, goes to the shard with the least cost so far. cluster-test runs in 16 shards, and cluster-cron-test, whose two tests take 7 s each, in 2. * A shard's process outlived its last test by seconds: the fake S3's server was unref'd, but the keep-alive connections it had accepted were not, nor were the delays its faults wait out. The fakes close once the shard's tests are done, and a delay does not hold the process. * The Cache API test checks its 16 keys side by side, as each write waits out the leases granted on its key. * The test of a turn of the event loop that outlasts the lease runs under `shortLease`, so that the turn takes 3 s rather than 7.5 s. * The tests of a stalled lease write stall it for 1.5 renewal bounds rather than 3 s, then wait for the fake to let it go on and for two renewals past it, rather than sleep 4 s. The fake counts the requests a fault delayed whose delay has run out. * The worker that keeps a server starting spins 3e8 times rather than 8e8, about 2 s. * The test no longer sets the eternal timeout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-test # Conflicts: # src/workerd/server/tests/cluster/BUILD.bazel
danlapid
marked this pull request as ready for review
November 25, 2026 20:03
git-bruh
approved these changes
Nov 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cluster-testran in 5 shards of 33–52 s each and settimeout = "eternal". Its shards were taken round robin, so the slowest one collected several of the tests that wait out a lease or a drain, and every shard idled for about 3 s after its last test.COSTSgives a rough cost to each test that takes 3 s or more, and each test goes to the shard with the least cost so far, costliest first.cluster-testnow runs in 16 shards, andcluster-cron-test, whose two tests take about 7 s each, in 2.shortLease, so its turn takes 3 s instead of 7.5 s.Measured on remote executors with
--runs_per_test=5(80cluster-testshard runs per build, all passing):The "before" figures come from one run of each of the 5 old shards. After the change,
cluster-cron-testtakes 6–10 s per shard.🤖 Generated with Claude Code