Skip to content

Speed up the HTTP service worker boot - #7646

Merged
marco-c merged 4 commits into
mozilla:masterfrom
marco-c:faster-worker-boot
Nov 24, 2026
Merged

marco-c merged 4 commits into
mozilla:masterfrom
marco-c:faster-worker-boot

Conversation

@marco-c

@marco-c marco-c commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

The prod worker took 9m40s to boot. Most of it was on a single critical path: about 4.5 minutes waiting for the autoland clone, then three steps that each read the whole commits DB or barely used the available processes. Each commit fixes one of these:

  • Download the pushlog once when cloning a repository. robustcheckout pulls twice, once into the pooled store and once into the share. mozext keeps changetracker.db per repository rather than in the shared store, so the whole autoland pushlog (about 290k pushes) was downloaded and processed twice, and the pooled store's copy was never used. The clone now runs with mozext.disable_local_database=true, followed by one pull in the share. Estimated saving: about 60-90s, based on the log's progress bars.
  • Read only the end of the commits DB to find the last mined commit. Adds db.read_last and uses it instead of reading the 12.6 GB DB to get its last 4096 commits. This took 81s and now takes about a second. The nodes are no longer filtered like get_commits does. With the filtering, when the newest commits of the DB were filtered out (backouts, commits without a bug, etc.), they were mined and added to the DB again. The current DB ends with such a commit.
  • Read only the last commits of the commits DB to update the touched together DB. When the last commit analyzed by update_touched_together is among the last 10000 commits of the DB, only those are read, starting 2000 commits before it. The margin means revisions sent slightly before it (commits can be ordered differently on mozilla-central and autoland) are still recognized as already analyzed. Otherwise the whole DB is read, as before (e.g. when generating it from scratch). The commit is found by searching the raw lines, so only the commits actually used are deserialized. This took 68s at boot. With the current DBs it takes 2.5s, and the daily resumed runs of the test scheduling history retriever get faster too.
  • Mine patches in smaller chunks when there are few commits. The 393 commits mined at boot were split into 7 chunks of 64, so 9 of the 16 processes sat idle and the step took 50s. Mining the full history still uses chunks of 64.

Together these should bring the boot to about 5 minutes.

The pushlog change is covered by a new test, which checks that after a clone changetracker.db is in the share and not in the pooled store. It fails without the flag and without the follow-up pull. It was also checked against autoland without a full clone: a pull that brings no changesets (hg pull -r null into an empty repo) still fetches the whole pushlog (289,341 pushes, 85 seconds locally, roughly what this saves per boot). The push IDs and dates it records match json-pushes, and a second pull fetches only the new pushes.

robustcheckout pulls twice (into the pooled store, then into the share), and mozext
records the pushes in the changetracker.db of each repository rather than in the
shared store, so the whole pushlog (about 290k pushes for autoland) was downloaded
and processed twice, with the copy of the pooled store never used. Disable the mozext
database for the clone, and retrieve the pushes once by pulling in the share.
The worker read the whole commits DB (12.6 GB) to find its last 4096 commits, which
took 81 seconds of the boot. Read them from the end of the file instead, which takes
about a second.

The commits are no longer filtered like get_commits does: the commits after the last
one in the DB are the ones to mine, and starting from an older one mined again (and
appended to the DB a second time) the last commits when they were filtered out, e.g.
backouts or commits without a bug, as the last one of the DB currently is.
…gether DB

update_touched_together read the whole commits DB (12.6 GB) to find the last commit it
analyzed, which took 68 seconds of the worker boot to add a few hundred commits. When
it's among the last 10000 commits of the DB, only those are read now, starting 2000
commits before it, so that the revisions sent which are slightly before it (as commits
can be in a different order in mozilla-central and autoland) are still found as already
analyzed. Otherwise (e.g. when generating the DB from scratch), the whole DB still is.

This also speeds up the daily runs of the test scheduling history retriever, which
resume from the last analyzed commit.
The patches were mined in chunks of 64 commits, so the 393 commits mined when the
worker booted were split in 7 chunks, leaving 9 of the 16 processes idle, and the
step took 50 seconds. Give several chunks to each process, and keep chunks of 64 when
mining many commits.
@marco-c
marco-c marked this pull request as ready for review November 24, 2026 10:36
@marco-c
marco-c requested a review from a team as a code owner November 24, 2026 10:36
@marco-c
marco-c merged commit 56e84a4 into mozilla:master Nov 24, 2026
12 of 13 checks passed
@marco-c
marco-c deleted the faster-worker-boot branch November 24, 2026 10:42
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.

1 participant