Files
opengenesislinkserver/bin/config-include/FlotsamCache.ini.example
T
OpenGenesis (MPL 2.0) af7483ac61 feat(perf): optional Flotsam RAM-pressure trim (#423)
* feat(perf): opt-in thread-safe LRU RAM pressure trimming policy

* feat(perf): optional GC-memory-pressure driven Flotsam RAM trim

* test(perf): high RAM pressure LRU eviction is bounded and preserves MRU assets

* docs(perf): expose opt-in Flotsam RAM-pressure trim settings

* docs(perf): RAM pressure trim opt-in, operating limits and benchmark guidance

* docs(perf): clarify budgeted memory cache lifecycle
2026-11-10 20:05:27 +01:00

157 lines
7.3 KiB
Plaintext

[AssetCache]
;;
;; Options for FlotsamAssetCache
;;
; cache directory can be shared by multiple instances
CacheDirectory = ./assetcache
; Other examples:
;CacheDirectory = /directory/writable/by/OpenSim/instance
; Log level
; 0 - (Error) Errors only
; 1 - (Info) Hit Rate Stats + Level 0
; 2 - (Debug) Cache Activity (Reads/Writes) + Level 1
;
LogLevel = 0
; How often should hit rates be displayed (given in AssetRequests)
; 0 to disable
HitRateDisplay = 100
; Set to false for no memory cache
; assets can be requested several times in short periods
; so even a small memory cache is useful
MemoryCacheEnabled = false
; Optional OGL Memory Manager: when MemoryCacheEnabled=true,
; cap strong asset references by estimated payload bytes (MiB) and LRU count.
; 0 preserves the legacy TTL cache without a byte budget.
; Suggested isolated test values: 256 MiB, 8192 entries.
; Actual process RSS can exceed these values due to other allocators/assets.
MemoryCacheMaxMiB = 0
MemoryCacheMaxEntries = 8192
; Optional G1.1 high-memory-pressure relief for the byte-budgeted LRU.
; Effective only when MemoryCacheEnabled=true and MemoryCacheMaxMiB>0.
; Every 30 seconds, check .NET GC memory load; if >=85% trim only
; disposable RAM-cache entries down to 50% of the configured cache budget.
; Does not force GC, modify authoritative asset storage, or cap whole-process RSS.
; Remains OFF unless explicitly activated in the loaded [AssetCache] section.
MemoryPressureTrimEnabled = false
MemoryPressureTrimThresholdPercent = 85
MemoryPressureTrimTargetPercent = 50
; Optional dead weak-reference key reclamation for long-lived regions.
; Weak asset targets already allow GC, but UUID string keys in the
; reference dictionary otherwise persist until cache clear/deep scan.
; 0 disables this independent low-frequency cleanup (legacy default).
; Values >0 are clamped to 60..3600 seconds; use 600 (10 minutes) in tests.
; It never calls GC.Collect and never discards still-live asset references.
WeakReferencePruneSeconds = 0
; If a memory cache hit happens, or the asset is still in memory
; due to other causes, update the timestamp on the disk file anyway.
; Don't turn this on unless you share your asset cache between simulators
; AND use an external process, e.g. cron job, to clean it up.
UpdateFileTimeOnCacheHit = false
; Enabling this will cache negative fetches. If an asset is negative-cached
; it will not be re-requested from the asset server again for a while.
; Generally, this is a good thing.
;
; Regular expiration settings (non-sliding) mean that the asset will be
; retried after the time has expired. Sliding expiration means that
; the time the negative cache will keep the asset is refreshed each
; time a fetch is attempted. Use sliding expiration if you have rogue
; scripts hammering the asset server with requests for nonexistent
; assets.
;
; There are two cases where negative caching may cause issues:
;
; 1 - If an invalid asset is repeatedly requested by a script and that asset is
; subsequently created, it will not be seen until fcache clear
; is used. This is a very theoretical scenario since UUID collisions
; are deemed to be not occuring in practice.
; This can only become an issue with sliding expiration time.
;
; 2 - If the asset service is clustered, an asset may not have propagated
; to all cluster members when it is first attempted to fetch it.
; This may theoretically occur with networked vendor systems and
; would lead to an asset not found message. However, after the
; expiration time has elapsed, the asset will then be fetchable.
;
; The defaults below are suitable for all small to medium installations
; including grids.
NegativeCacheEnabled = true
NegativeCacheTimeout = 120
NegativeCacheSliding = false
; Set to false for no file cache
FileCacheEnabled = true
; OGL Performance Engine 1.0: independent disk-cache writes may use more CPU
; and I/O bandwidth. Set 1 for historical serial behavior (safe default).
; Positive values are clamped to 1..min(8, process-visible CPU cores).
; An explicit 0 selects conservative auto mode (up to 4 workers, half the
; visible CPU cores, minimum 1). The default stays 1 for compatibility.
; Compare region frame times and disk latency before enabling 0/2/4.
FileWriteConcurrency = 1
; OGL adaptive I/O scheduler. Off by default, for isolated load tests.
; When enabled with >1 writer, a 5-60 second sample periodically checks
; process CPU usage and (if [OGLPerformance] Enabled=true) actual region
; work-time budget overruns. High pressure reduces concurrent DISK-CACHE
; writes, never Physics, scripts, scene frames or authoritative asset saves.
; Recovery is gradual to avoid worker-count oscillation.
; Excess independent disk-cache writes can be skipped after a 500ms wait.
; Enable only after setting an appropriate file write queue / byte budget.
AdaptiveFileWrites = false
AdaptiveFileWriteSampleSeconds = 5
; Optional RAM backpressure for the disposable disk-write queue. 0 means
; legacy unbounded queue; 512-2048 bounds asset buffers retained in memory.
; When saturated, the cache write is skipped (the authoritative asset remains
; available). This is NOT a limit on Flotsam's memory asset cache.
MaxPendingFileWrites = 0
; Harder RAM backpressure: cap the combined estimated asset payload bytes
; reserved by queued AND currently executing disk-cache file writes.
; A single 100 MiB asset can otherwise dominate a queue of only 10 jobs.
; 0 = legacy unbounded byte usage, 128-512 MiB recommended for test.
; Oversized writes are skipped *only for this disposable file cache*.
; The value never caps the authoritative asset store or overall RSS.
MaxInFlightFileWriteMiB = 0
; How long {in hours} to keep assets cached in memory, .5 == 30 minutes
; even a few minutes may mean many assets loaded to memory, if not all.
; this is good if memory is not a problem.
; if memory is a problem then a few seconds may actually save same.
; see hit rates with console comand: fcache status
MemoryCacheTimeout = .016 ; one minute
; How long {in hours} to keep assets cached on disk, .5 == 30 minutes
; Specify 0 if you do not want your disk cache to expire
FileCacheTimeout = 48
; How often {in hours} should the disk be checked for expired files
; Specify 0 to disable expiration checking
FileCleanupTimer = 0.0 ; disabled
; If WAIT_ON_INPROGRESS_REQUESTS has been defined then this specifies how
; long (in miliseconds) to block a request thread while trying to complete
; an existing write to disk.
; NOTE: THIS PARAMETER IS NOT CURRENTLY USED BY THE CACHE
; WaitOnInprogressTimeout = 3000
; Number of tiers to use for cache directories (current valid
; range 1 to 3)
;CacheDirectoryTiers = 1
; Number of letters per path tier, 1 will create 16 directories
; per tier, 2 - 256, 3 - 4096 and 4 - 65K
;CacheDirectoryTierLength = 3
; Warning level for cache directory size
;CacheWarnAt = 30000