Open Bug 2074878 Opened 2 months ago Updated 8 hours ago

Investigate using `checkout.workers` for Git operations in Lando

Categories

(Conduit :: Lando, enhancement, P3)

enhancement

Tracking

(Not tracked)

People

(Reporter: sheehan, Unassigned)

References

Details

(Keywords: good-first-bug)

Attachments

(1 external file)

See bug 2071187 comment 0.

We do a decent amount of switching between commits in Lando, especially with 3-way merge. We should investigate using the checkout.workers config in Git to improve the time spent switching between commits.

Hi Connor! I'm new to contributing to Mozilla and would like to give this a try. I work with data and FinOps, so the performance side caught my interest. Is this still available? Any suggestions on which Lando operations to benchmark first?

(via GitHub webhook, authenticated as shared-secret)

Hi, I asked Claude Code to run benchmarks with and without parallel workers. It suggested the Firefox repository as well as the Linux kernel tree (as "a smaller repository"), and implemented https://github.com/rolandmas/lando/tree/bug-2074878-checkout-workers
Here are the benchmark results:

  Linux kernel (65,701 files, v5.4 ↔ v6.6)
 
  ┌─────────────────────────────┬───────────┬────────────┬───────────┐
  │          Operation          │ workers=1 │ workers=-1 │ Speed-up  │
  ├─────────────────────────────┼───────────┼────────────┼───────────┤
  │ checkout --force -B         │ 5.49 s    │ 1.93 s     │ 2.8×      │
  ├─────────────────────────────┼───────────┼────────────┼───────────┤
  │ reset --hard (back)         │ 4.01 s    │ 1.70 s     │ 2.4×      │
  ├─────────────────────────────┼───────────┼────────────┼───────────┤
  │ Small switch (40 files, ×2) │ 113 ms    │ 109 ms     │ no change │
  └─────────────────────────────┴───────────┴────────────┴───────────┘
  
  6 rounds, with tight ranges (about ±0.1 s).

  Firefox (mozilla-firefox/firefox, 491,515 files)

  ┌──────────────────────────────────────┬─────────────────────┬───────────┬────────────┬──────────┬────────┐
  │                Switch                │      Operation      │ workers=1 │ workers=-1 │ Speed-up │ Rounds │
  ├──────────────────────────────────────┼─────────────────────┼───────────┼────────────┼──────────┼────────┤
  │ main ↔ beta (5,561 files differ)     │ checkout --force -B │ 1.44 s    │ 1.27 s     │ 1.13×    │ 5      │
  ├──────────────────────────────────────┼─────────────────────┼───────────┼────────────┼──────────┼────────┤
  │ main ↔ beta                          │ reset --hard (back) │ 1.81 s    │ 1.64 s     │ 1.10×    │ 5      │
  ├──────────────────────────────────────┼─────────────────────┼───────────┼────────────┼──────────┼────────┤
  │ main ↔ esr128 (297,744 files differ) │ checkout --force -B │ 18.51 s   │ 11.28 s    │ 1.64×    │ 4      │
  ├──────────────────────────────────────┼─────────────────────┼───────────┼────────────┼──────────┼────────┤
  │ main ↔ esr128                        │ reset --hard (back) │ 17.17 s   │ 11.51 s    │ 1.49×    │ 4      │
  └──────────────────────────────────────┴─────────────────────┴───────────┴────────────┴──────────┴────────┘

This benchmark is run on a 16-core PC, on NVME storage.

Following up on my benchmark comment: I've opened a pull request with the change,
https://github.com/mozilla-conduit/lando/pull/1588. It adds a GIT_CHECKOUT_WORKERS setting (default -1, one worker
per core) and passes it to every git command through GIT_CONFIG_* environment variables, so it also applies to
repositories cloned before this existed. Setting it to 1 restores Git's sequential default, which may be useful
where a container's CPU quota is lower than the core count Git sees.

Could this bug be assigned to me? I saw the earlier question about whether it's still available, and it seems
nobody replied. I'm happy to adjust the approach, for example the default value, if you'd prefer something
different.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: