Stale-while-revalidate and cache MISSes question


I am wondering if there are any other reasons why we’d get a MISS when we have stale-while-revalidate other than a cache not being warmed?


❯ curl -s -D - -X GET -H "x-access-token: xxxxx" -H "Accept: application/json" -H "Cache-Control: no-cache" -H "Postman-Token: 8a5602fb-0fe9-8cf0-3380-47c6093f46d1" 'https://xx.xx.xx/v1/views/xxx-xxx-xxx-xxxxx-xxxxx?include=true' -o /dev/null
HTTP/1.1 200 OK
Server: Cowboy
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET,PUT,POST,DELETE,OPTIONS
Access-Control-Allow-Headers: Origin, X-Access-Token, X-Requested-With, Content-Type, Accept, Cache-Control
Access-Control-Max-Age: 600
Cache-Control: public, max-age=600, stale-while-revalidate=604800, stale-if-error=604800
X-Geo-Country-Code: US
Content-Type: application/json; charset=utf-8
Etag: W/"12ce0-BUD9oR6E/ZARoaabzbRlEg"
Via: 1.1 vegur
Content-Length: 77024
Accept-Ranges: bytes
Date: Thu, 01 Oct 2015 14:10:34 GMT
Via: 1.1 varnish
Age: 0
Connection: keep-alive
X-Served-By: cache-iad2138-IAD
X-Cache: MISS
X-Cache-Hits: 0
X-Timer: S1443708633.882089,VS0,VE220
Vary: x-a



At the risk of being “that person” who gives nonanswers, it depends :smile:

If the object is highly requested, there shouldn’t be user-facing cache misses, but it’s hard to tell from one request alone.


Why are you sending a -H "Cache-Control: no-cache"?
I don’t know what that does from when in a request and it probably has nothing to do with the miss but it might.


I think the reason for the MISS can be found here:

Cache-Control: public, max-age=600

Objects that have TTL of less than 3700 seconds don’t get written to disk and are only stored in RAM which means the object will get lost to churn in less time than the week-long SWR timer.

How often does the object actually change?