cache: Serve Range GET from disk when present
Steam clients lean on Range requests. Hit/miss looked fine while downloads still felt cold when a Range miss returned the full upstream body as 200. Add range_cache / range_upstream metrics. HIT path already sliced 206 from the cached full object; count range_cache there. On MISS, keep stripping Range for the upstream fetch (full object still cached) but serve the client's requested slice as 206 and count range_upstream. Tests in steamcache/range_test.go cover Range HIT (local, no upstream), Range MISS (206 + full object cached), and /metrics emission.
This commit is contained in:
@@ -81,11 +81,14 @@ curl -s -i http://localhost/lancache-heartbeat
|
||||
| Field | Meaning |
|
||||
| --- | --- |
|
||||
| `cache_hits` / `cache_misses` / `hit_rate` | Whether later requests were served from cache |
|
||||
| `range_cache` / `range_upstream` | Range GETs served as 206 from a cached object vs after a full upstream fetch |
|
||||
| `memory_cache_hits` / `disk_cache_hits` | Which tier served the hits |
|
||||
| `total_requests` / `errors` | Volume and failures |
|
||||
|
||||
A first pass through new content is mostly misses (`hit_rate` near 0). Repeat the same content and `cache_hits` / `hit_rate` should rise.
|
||||
|
||||
Steam clients lean on Range requests. When an object is already cached, a Range GET is served locally as 206 from that full object (`range_cache`). On a Range miss the cache still fetches and stores the full upstream body, then returns the requested byte range as 206 (`range_upstream`).
|
||||
|
||||
To confirm the process is up (HTTP 204 and `X-LanCache-Processed-By: SteamCache2`):
|
||||
|
||||
```bash
|
||||
@@ -179,7 +182,7 @@ The recommended validation config is at [docs/examples/validate-config.yaml](doc
|
||||
Running a realistic SteamPrefill benchmark workload through a built steamcache2 exercises the complete public surface that matters for production use:
|
||||
- Steam User-Agent detection and depot/manifest/chunk URL patterns
|
||||
- Full MISS → cache write → HIT (and HIT-COALESCED) paths
|
||||
- Range request handling from cached full responses
|
||||
- Range request handling from cached full responses (local 206 on HIT via `range_cache`; MISS fetches the full object then serves the requested slice as 206 via `range_upstream`)
|
||||
- Request coalescing under concurrent load
|
||||
- Memory tier + disk tier interaction (including async disk attach)
|
||||
- Garbage collection and eviction under pressure
|
||||
|
||||
Reference in New Issue
Block a user