Update metrics tracking and enhance cache eviction strategies
Release Tag / release (push) Successful in 34s

- Added metrics for bytes saved from cache to improve performance insights.
- Updated cache eviction strategies in MemoryFS and DiskFS to include metrics tracking for hits and evictions.
- Enhanced README.md with updated garbage collection algorithm descriptions and recommendations for cache usage.
- Introduced new madviseSequential functionality for improved memory access hints on Unix systems.
- Adjusted validation configuration in examples to better reflect realistic usage scenarios.
This commit is contained in:
2026-05-28 10:31:23 -05:00
parent 3fd72705fc
commit b7e3a0da86
11 changed files with 184 additions and 41 deletions
+12 -9
View File
@@ -6,11 +6,14 @@
# "benchmark" commands.
#
# Why these values?
# - Both memory and disk tiers are enabled but deliberately small.
# A modest benchmark workload (a few hundred MB to low GB) will exercise:
# * Memory tier promotions
# * Disk tier attach + writes
# * GC / eviction pressure on at least one tier
# - Both tiers enabled. Memory is sized large enough to survive the disk attach
# window in mixed mode (see steamcache.go: the goroutine that blocks on d.Size()
# before SetSlow). With a realistic SteamPrefill benchmark (high rate of unique
# ~1MB chunks) the old tiny 128MB mem + 512MB disk caused almost all early
# content to live only in memory, get evicted by its GC, and never reach disk.
# Result: "never hitting", hit_rate 0, memory_size 0, despite files appearing
# on disk for late-arriving chunks. Larger mem + disk makes the validation
# actually exercise hits, promotions, disk tier, and GC as intended.
# - Conservative concurrency limits suitable for a developer laptop.
# - trusted_proxies set for 127.0.0.0/8 so that an external benchmark tool
# can simulate multiple distinct clients via X-Forwarded-For if desired.
@@ -31,7 +34,7 @@
listen_address: :80
max_concurrent_requests: 100
max_concurrent_requests: 1000
max_requests_per_client: 10
max_object_size: "0" # unlimited for validation (real Steam files can be large)
@@ -39,10 +42,10 @@ trusted_proxies: ["127.0.0.0/8"]
cache:
memory:
size: 128MB
gc_algorithm: lru # lru is somewhat recommeded in the project README and is better for validation since its not just using the same again
size: 1GB
gc_algorithm: largest
disk:
size: 512MB
size: 2GB
path: ./validate-disk # ephemeral; clean between runs if you want a fresh test
gc_algorithm: hybrid # recommended for disk in the project README