Skip to content

osdc/hf-cache: cut rclone RSS with --buffer-size 4M --use-mmap - #907

Merged
huydhn merged 2 commits into
pytorch:mainfrom
huydhn:hf-cache-rclone-rss
Jul 16, 2026
Merged

osdc/hf-cache: cut rclone RSS with --buffer-size 4M --use-mmap#907
huydhn merged 2 commits into
pytorch:mainfrom
huydhn:hf-cache-rclone-rss

Conversation

@huydhn

@huydhn huydhn commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Problem

On the 1-GPU mount tier (512Mi), concurrent large-model (safetensors) reads OOM-kill rclone → the node-wide /mnt/hf_cache FUSE mount dies → the job's mmap'd read faults with SIGBUS, surfacing as a misleading LocalEntryNotFoundError ("missing weights").

Example — failing inductor_huggingface a10g job:

Loading weights: 25%|██▍| 36/146 … Run failed with return code: -7   # SIGBUS
huggingface_hub.errors.LocalEntryNotFoundError: Cannot find the requested files in the disk cache ...

Stats — live rclone OOMKilled mounts, gpu1 tier only (cpu/gpu4/gpu8 = 0): ue2 17/59, ue1 9/80.

Fix

rclone RSS under --vfs-cache-mode full is dominated by per-open-file read-ahead buffers, not GPU count:

  • --buffer-size 4M — 4x cut from rclone's 16Mi-per-open-file default read-ahead (the RSS driver when a model opens many shards); kept non-zero so cold reads retain some prefetch, with the on-disk cache serving the rest.
  • --use-mmap — return freed buffers to the OS instead of Go retaining them as RSS.

Keeps rclone inside the reserve without raising the limit. Complements #890 (512Mi→1Gi headroom).

The 1-GPU mount tier (512Mi) OOM-kills rclone during concurrent large-model
(safetensors) reads; the dead node-wide FUSE mount then faults the job's mmap'd
read with SIGBUS, surfacing as a spurious LocalEntryNotFoundError.

rclone RSS under --vfs-cache-mode full is dominated by per-open-file read-ahead
buffers, not GPU count. --buffer-size 0 drops that read-ahead (redundant — reads
already come from the on-disk VFS cache), and --use-mmap returns freed buffers to
the OS instead of Go holding them as RSS. This keeps rclone inside the reserve
without raising the limit, and complements the tier bump in pytorch#890.
@huydhn
huydhn requested a review from jeanschmidt as a code owner July 16, 2026 01:05
A 4x cut from rclone's 16Mi-per-open-file default caps the RSS driver while
leaving a small prefetch so cold model reads don't lose throughput.
@huydhn huydhn changed the title osdc/hf-cache: cut rclone RSS with --buffer-size 0 --use-mmap osdc/hf-cache: cut rclone RSS with --buffer-size 4M --use-mmap Jul 16, 2026
@huydhn

huydhn commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

Deploy on ue1 staging, smoke and integration tests are passing

@huydhn
huydhn added this pull request to the merge queue Jul 16, 2026
Merged via the queue into pytorch:main with commit 76fd948 Jul 16, 2026
13 checks passed
@huydhn
huydhn deleted the hf-cache-rclone-rss branch July 16, 2026 17:19
huydhn added a commit to huydhn/pytorch-ci-infra that referenced this pull request Jul 17, 2026
Remove --use-mmap from the rclone mount, keeping the --buffer-size 4M
read-ahead cut. Both were added together in pytorch#907; we're rolling out one
lever at a time, starting with the buffer-size reduction.
huydhn added a commit to huydhn/pytorch-ci-infra that referenced this pull request Jul 17, 2026
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.

2 participants