Cache sizes: defaults from free disk space, explicit sizes kept, disk-full guard #711

Open
opened 2026-10-12 11:17:23 +00:00 by sky_line · 1 comment
Owner

Part of #715 (cache rewrite epic).

Defaults by free disk space (first run / while the user hasn't set a size; shown and editable in Advanced preferences as today). Starting point:

Free disk Textures (J2C + GPU-ready) Assets Sounds Total
> 500 GB 40 GB 20 GB 4 GB ~64 GB
250-500 GB 20 GB 10 GB 2 GB ~32 GB
100-250 GB 12 GB 6 GB 1 GB ~19 GB
< 100 GB 4 GB 2 GB 0.5 GB ~6.5 GB
  • Explicit sizes are never lowered. Only automatic sizes follow the tiers.
  • Disk-full guard: every cache write is limited by the smaller of the configured size and (free space - 2 GB reserve for the OS and other programs). Near a full disk caches stop growing and evict instead; a failed write is dropped, never a crash. The effective limit is logged and shown in Preferences when below the configured size.
Part of #715 (cache rewrite epic). **Defaults by free disk space** (first run / while the user hasn't set a size; shown and editable in Advanced preferences as today). Starting point: | Free disk | Textures (J2C + GPU-ready) | Assets | Sounds | Total | |---|---|---|---|---| | > 500 GB | 40 GB | 20 GB | 4 GB | ~64 GB | | 250-500 GB | 20 GB | 10 GB | 2 GB | ~32 GB | | 100-250 GB | 12 GB | 6 GB | 1 GB | ~19 GB | | < 100 GB | 4 GB | 2 GB | 0.5 GB | ~6.5 GB | - **Explicit sizes are never lowered.** Only automatic sizes follow the tiers. - **Disk-full guard:** every cache write is limited by the smaller of the configured size and (free space - 2 GB reserve for the OS and other programs). Near a full disk caches stop growing and evict instead; a failed write is dropped, never a crash. The effective limit is logged and shown in Preferences when below the configured size.
sky_line added this to the Slipstream project 2026-10-12 11:17:23 +00:00
Author
Owner

Interface audit (step 1 of #715): where sizes come from today and the store hooks for this ticket.

Today

Setting Default Used at
CacheSize (clamped 896 MB .. 256 GB) 16384 MB llappviewer.cpp:9058
DiskCachePercentOfTotal (assets' share of CacheSize) 35% (rest = J2C) llappviewer.cpp:9060
SlipstreamGpuTexCacheSizeMB (256 .. 65536) 3072 llappviewer.cpp:9163, live via llviewercontrol.cpp:672
SlipstreamSoundCacheSizeMB (32 .. 4096) 1024 llappviewer.cpp:8234, live via llviewercontrol.cpp:666
RenderVKClusterCacheMB 2048 llappviewer.cpp:9171

No cache checks free disk space. Failed writes are dropped per cache: J2C switches the whole cache to read-only and clears it (setReadOnly(true) + clearCorruptedCache, lltexturecache.cpp:2062). Mesh logs "disk full?" (llmeshrepository.cpp:4363). An asset fetch reports CACHE_CORRUPT.

Slice of the interface

Store::setBudget(BudgetGroupId, U64 bytes);   // TEXTURES, ASSETS (+ CLUSTER); sounds keep LLSoundCache::setBudget
Store::setDiskReserve(U64 bytes);             // 2 GB: every append limited by min(budget, free - reserve)
Stats: budget_bytes, effective_limit           // shown in Preferences when below the configured size
Status::NO_SPACE                               // a refused write; never a crash, never a wipe
  • The writer thread checks free space (cached, refreshed every N MB written or every few seconds) before each append. Near the reserve it evicts instead of growing. Writes that still do not fit are dropped with NO_SPACE.
  • Asset writes are the exception that must keep working: the asset system delivers assets through the cache. Near a full disk they evict harder, and the final fallback holds the record in RAM until it is read.
  • Explicit vs automatic: the app keeps a "user set" flag per budget. Automatic sizes follow the free-space tiers at each start, and explicit sizes are never lowered.

Drop-in plan

After the store core (#708). Sizing code moves out of LLAppViewer::initCache (llappviewer.cpp:9041) into a small sizing function that feeds setBudget per group. The J2C clearCorruptedCache on a failed write disappears with the J2C adapter.

**Interface audit (step 1 of #715): where sizes come from today and the store hooks for this ticket.** ### Today | Setting | Default | Used at | |---|---|---| | `CacheSize` (clamped 896 MB .. 256 GB) | 16384 MB | llappviewer.cpp:9058 | | `DiskCachePercentOfTotal` (assets' share of `CacheSize`) | 35% (rest = J2C) | llappviewer.cpp:9060 | | `SlipstreamGpuTexCacheSizeMB` (256 .. 65536) | 3072 | llappviewer.cpp:9163, live via llviewercontrol.cpp:672 | | `SlipstreamSoundCacheSizeMB` (32 .. 4096) | 1024 | llappviewer.cpp:8234, live via llviewercontrol.cpp:666 | | `RenderVKClusterCacheMB` | 2048 | llappviewer.cpp:9171 | No cache checks free disk space. Failed writes are dropped per cache: J2C switches the whole cache to read-only and clears it (`setReadOnly(true)` + `clearCorruptedCache`, lltexturecache.cpp:2062). Mesh logs "disk full?" (llmeshrepository.cpp:4363). An asset fetch reports `CACHE_CORRUPT`. ### Slice of the interface ```cpp Store::setBudget(BudgetGroupId, U64 bytes); // TEXTURES, ASSETS (+ CLUSTER); sounds keep LLSoundCache::setBudget Store::setDiskReserve(U64 bytes); // 2 GB: every append limited by min(budget, free - reserve) Stats: budget_bytes, effective_limit // shown in Preferences when below the configured size Status::NO_SPACE // a refused write; never a crash, never a wipe ``` - The writer thread checks free space (cached, refreshed every N MB written or every few seconds) before each append. Near the reserve it evicts instead of growing. Writes that still do not fit are dropped with NO_SPACE. - Asset writes are the exception that must keep working: the asset system delivers assets through the cache. Near a full disk they evict harder, and the final fallback holds the record in RAM until it is read. - Explicit vs automatic: the app keeps a "user set" flag per budget. Automatic sizes follow the free-space tiers at each start, and explicit sizes are never lowered. ### Drop-in plan After the store core (#708). Sizing code moves out of `LLAppViewer::initCache` (llappviewer.cpp:9041) into a small sizing function that feeds `setBudget` per group. The J2C `clearCorruptedCache` on a failed write disappears with the J2C adapter.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sky_line/Slipstream#711
No description provided.