Cache store: hard-disk locality -- region-ordered writes and hot-set rewrites #712
Labels
No labels
amd
avatars
bug
builder
cannot-reproduce
crash
epic
feature
from-viewer
gl-removal
known-limitation
monitoring
parity
perf
platform
priority
critical
priority
high
priority
low
priority
medium
provenance
rendering
rt
status
in-progress
status
testing
status
up-next
triage
ui
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
sky_line/Slipstream#712
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Part of #715 (cache rewrite epic).
On hard disks a seek (7-12 ms) costs far more than reading the data, so layout beats compression.
Interface audit (step 1 of #715): what the store gives hard disks and this ticket's hooks.
Today
Every cached item is its own file: J2C bodies under
texturecache/[0-f]/(16 folders, lltexturecache.cpp:1121-1126) plus a 600-byte stripe per texture in one sharedtexture.cacheread atidx * 600(lltexturecache.cpp:405), GPU-ready files ingputex/, and 265k assets in one flatcache/folder (lldiskcache.cpp:215). A region revisit reads thousands of scattered files, each with a seek plus a directory lookup. The J2C stripe file's slots are reused through a free list, so neighbouring slots do not mean neighbouring textures.Slice of the interface
Priorityon writes changes order only within the queue's short window.WearPolicy.locality_rewrites(HDD only, drive type from #709) + the daily compaction cap: on a revisit, when the records read in a short window are spread over many segments, the store re-appends that hot set to the current segment. It reuses the compaction path (copy live record, kill old) and counts against the same cap.preadin key order within a segment. The batch read for a hot set sorts by (segment, offset) before issuing.Drop-in plan
Policy on top of the store, after #709's drive detection. Measure the region-arrival load time on an HDD before and after: first with arrival-order writes only (comes free with the store), then with hot-set rewrites.
Prefetch on arrival (decided 2026-10-18, see #715 / #708 placement)
Triggers:
Mechanism:
posix_fadvise(WILLNEED)/readaheadon the ranges (the page cache does the rest);Guards:
HDD-only hot-set rewrite: on a revisit, if the region's records and its shared references are spread over many segments, append copies into a fresh run for that region, within #709's daily write cap. Never on SSD.
Measure: region-arrival load time (first full frame, textures and meshes resident) on an HDD and on an SSD, revisit with prefetch vs without.