Skip to content

Log the size, duration and throughput of artifact downloads - #3086

Merged
marco-c merged 1 commit into
mozilla:masterfrom
marco-c:download-measurements
Nov 25, 2026
Merged

marco-c merged 1 commit into
mozilla:masterfrom
marco-c:download-measurements

Conversation

@marco-c

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

Copy link
Copy Markdown
Collaborator

The mozilla-central "repo" task downloads ~673 coverage artifacts (~50 GiB: code-coverage-grcov.zip ~66 MiB on average, code-coverage-jsvm.zip ~84 MiB) in ~166 s, i.e. ~300 MB/s. The task logs have no measurements, so we can't tell whether this is limited by the network, the disk, or Python streaming the files through requests with 8 threads.

This adds measurements to the downloads, without changing how they are done:

  • The existing per-artifact "artifact downloaded" line now has the size, duration and throughput of the download, and whether the artifact was already on disk (cached, in which case download_artifact skips it):
    [info     ] Artifact downloaded            cached=False duration=0.58 mb_per_s=119.5 path=ccov-artifacts/linux_mochitest-devtools-chrome-4_code-coverage-grcov.zip size_mb=69.0
    
  • Before the download phase, the number of tasks to download from and the number of worker threads:
    [info     ] Downloading artifacts          tasks=1 workers=8
    
  • After it, a summary with the number of downloaded artifacts (excluding the cached ones), their total size, the wall-clock duration of the phase, the aggregate throughput, the number of worker threads, and concurrency, the sum of the per-artifact durations divided by the wall-clock duration, i.e. the average number of downloads in flight:
    [info     ] Code coverage artifacts downloaded artifacts=1 concurrency=1.0 duration=0.6 mb_per_s=119.0 size_mb=69.0 workers=8
    

(MB = 10^6 bytes. The example values come from a local run with a mocked download.)

The number of download threads is now the DOWNLOAD_WORKERS constant in artifacts.py. It is set to 8, which is what ThreadPoolExecutor defaulted to (min(32, os.cpu_count() + 4)) on the 4-vCPU workers, so production behaviour doesn't change.

What the next production run should tell us: if the per-artifact throughput is roughly the aggregate throughput divided by 8 and concurrency is close to 8, the threads are busy the whole time and more of them may help, unless the per-artifact throughput drops as we add threads (then the network or disk is the limit). If concurrency is well below 8, the time goes elsewhere (e.g. the per-task artifact listing, which is in the wall-clock duration but not in the per-artifact durations). Note that the per-artifact duration includes tenacity retries and their waits, if any happen.

Testing: added tests in bot/tests/test_artifacts.py for the per-artifact log line, the cached case, the summary line, and the worker count (checking that DOWNLOAD_WORKERS is passed to the executor, by monkeypatching it). test_artifacts.py, test_grcov.py and test_reports.py pass locally (with grcov 0.10.9), and pre-commit is clean. This has not run on Taskcluster yet.

Comment thread bot/code_coverage_bot/artifacts.py Resolved
On mozilla-central, the bot downloads ~673 coverage artifacts (~50 GiB)
in ~166 s, i.e. ~300 MB/s, but the logs don't tell whether that is
limited by the network, the disk or by Python streaming the files with
8 threads.

Log the size, duration and throughput of each downloaded artifact, and
at the end of the download phase a summary with the number of
artifacts, their total size, the wall-clock duration, the aggregate
throughput, the number of worker threads and the average number of
downloads in flight. Artifacts which were already on disk are logged as
cached and not counted in the summary.

The number of download threads is now the DOWNLOAD_WORKERS constant,
set to 8, which is what ThreadPoolExecutor defaulted to on the 4-vCPU
workers, so the behaviour doesn't change there.
@marco-c
marco-c force-pushed the download-measurements branch from 3e7e9aa to 04ec874 Compare November 25, 2026 12:55
@marco-c
marco-c marked this pull request as ready for review November 25, 2026 13:00
@marco-c
marco-c merged commit efbb33c into mozilla:master Nov 25, 2026
4 checks passed
@marco-c
marco-c deleted the download-measurements branch November 25, 2026 13:04
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