-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add vary-dynamic test #54
base: main
Are you sure you want to change the base?
Conversation
Hey, Yes, I'd very much like to see tests like this made; this area of caching is not well-specified or widely understood. I'll do a review of the pull; there are a couple of nits (nothing huge). WRT the server component -- yes, from memory the server-side is going to need some reworking to be able to serve traffic like this. I'm travelling right now but will do the review and take a closer look at the server ASAP. Thanks! |
Awesome, thanks @mnot. If there's things you'd rather i'd done on the PR, please let me know so i can make any future contributions better - i'm intending to investigate whether we have any other less/atypical cache use cases and contribute them if so. Cheers |
tests/vary.mjs
Outdated
name: 'An optimal HTTP cache stores and correctly serves multiple object variants when the `Vary` response header value depends on one or more request header values', | ||
id: 'vary-dynamic', | ||
kind: 'optional', | ||
browser_skip: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In theory this could apply to browsers too; it's just that they don't currently store more than one variant.
You could filter for that by making it depends_on: ['vary-invalidate']
tests/vary.mjs
Outdated
@@ -80,6 +80,72 @@ export default { | |||
} | |||
] | |||
}, | |||
{ | |||
name: 'An optimal HTTP cache stores and correctly serves multiple object variants when the `Vary` response header value depends on one or more request header values', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this be better stated as:
"... when responses have different Vary
response header values, depending on multiple request headers?"
Thanks for the feedback @mnot - i'll get those amended as soon as i get a mo :-) |
@mnot - apologies for the delay, busy times right now! |
No worries, apologies for the delay on this side too. I think this can be made to correctly function if the second request is removed -- all that's doing is checking to make sure the response is cached, correct? If so, that's already covered by other tests. If that's the case, my testing shows that varnish, squid, traffic server and apache all pass this (in the current I do still plan to make the server more robust (right now it isn't happy when there are cached requests followed by uncached requests), but if you remove the second request it means this won't be blocked on that work. |
|
Hi @mnot
I don't quite understand the output here, maybe I am being a bit dim but is this telling me that my test failed? (i see Also, is the test count ( The Docker setup you now have is awesome, by the way. Thanks for building that out, it's now infinitely simpler to run tests quickly and reliably 🙌. Cheers |
Hi @mnot
This is the PR I mentioned in #49 - adding a test to validate what I have called "dynamic vary". This issue came to my attention during building a traffic management system, we determined that nginx does not create cache object variants when the origin issues a
vary
header whose value is dependent on the value of a request header (we have some use cases which require this). Failure to support "dynamic vary" can result in flip-flopping - nginx simply overwrites the single cached object with the new object, this obviously ruins cache offload under transitional circumstances. As a ref for nginx, please see this ticket: https://trac.nginx.org/nginx/ticket/955.My intention through adding this PR is twofold:
Varnish does support "dynamic vary" according to our tests.
I'm sure you'll see what I'm trying to achieve by looking at the added test, I believe I've correctly defined the behaviour but please let me know if you think I've done the wrong thing. Currently I see an error on request 3 which I expect not to be cached and indeed it looks to me like nginx did not serve a cached response for that request (I added a custom response header to nginx whose value is
$upstream_cache_status
, this saysMISS
):I suspect that perhaps the server component of
cache-tests
might be doing the wrong thing here, would you agree? I'll happily do some work on it if you think that is likely to be the issue and if you're interested in this PR so if you could let me know when you have moment, that'd be great.Many thanks and apologies for the epic message :-)
Neil