lukenowak commented on issue #7425:
URL: https://github.com/apache/trafficserver/issues/7425#issuecomment-762242762


   I have some cases (note: I am using version patched with 
https://github.com/apache/trafficserver/pull/7422)
   
   # Cases
   ## Case 1 - origin returns 502, negative_revalidating_enabled = 0
   `negative_revalidating_enabled = 0`
   `negative_revalidating_lifetime = 0`
   `max_stale_age = 30`
   
   1. configure origin to reply 200 with max-age = 15
   2. GET results with 200 from origin
   3. sleep 2
   4. configure origin to reply 502 with max-age = 15
   5. GET results with 200 from origin
   6. sleep 15 (so it is 2 seconds more > `max-age` < `max_stale_age`)
   7. GET results with 502 from origin, I see response being updated as max-age 
passes (due to patch)
   
   This case, TrafficServer does not simulate "stale-if-error", expected.
   
   Setting `negative_revalidating_lifetime` to some value impacts nothing.
   
   ## Case 2 - origin not available anymore, negative_revalidating_enabled = 0
   `negative_revalidating_enabled = 0`
   `negative_revalidating_lifetime = 0`
   `max_stale_age = 30`
   
   1. configure origin to reply 200 with max-age = 15
   2. GET results with 200 from origin
   3. sleep 2
   4. origin stopped
   5. GET results with 200 from origin
   6. sleep 15 (so it is 2 seconds more > `max-age` < `max_stale_age`)
   7. GET results with 200 from ATS with Warning: 111 ApacheTrafficServer/8.1.1
   8. sleep 15+2 (so it is > `max_stale_age`)
   9. 502 from Apache Traffic Server
   
   This case, TrafficServer simulates a bit "stale-if-error", but only when 
backend is down (replies nothing).
   
   Setting `negative_revalidating_lifetime` to some value impacts nothing.
   
   ## Case 3 - origin returns 502, negative_revalidating_enabled = 1
   `negative_revalidating_enabled = 1`
   `negative_revalidating_lifetime = 0`
   `max_stale_age = 30`
   
   1. configure origin to reply 200 with max-age = 15
   2. GET results with 200 from origin
   3. sleep 2
   4. configure origin to reply 502 with max-age = 15
   5. GET results with 200 from TrafficServer
   6. sleep 15 (so it is 2 seconds more, > `max-age` < `max_stale_age`)
   7. GET results with 200 from TrafficServer
   8. sleep 15+2 (so it is > `max_stale_age`)
   9. GET results with 502 from the origin, I see response being updated as 
max-age passes (due to patch)
   
   In this case, TrafficServer simulates "stale-if-error", expected. 
`max_stale_age` is the switch to control the time frame of the feature.
   
   Setting `negative_revalidating_lifetime` to some value impacts case of step 
7 with `Expires` header becoming `Date + negative_revalidating_lifetime`, but 
in step 9 there is no more `Expires` header.
   
   ## Case 4 - origin not available anymore, negative_revalidating_enabled = 1
   `negative_revalidating_enabled = 1`
   `negative_revalidating_lifetime = 0`
   `max_stale_age = 30`
   
   1. configure origin to reply 200 with max-age = 15
   2. GET results with 200 from origin
   3. sleep 2
   4. configure origin to reply 502 with max-age = 15
   5. GET results with 200 from TrafficServer
   6. sleep 15 (so it is 2 seconds more, > `max-age` < `max_stale_age`)
   7. GET results with 200 from ATS with Warning: 111 ApacheTrafficServer/8.1.1
   8. sleep 15+2 (so it is > `max_stale_age`)
   9. GET results with 502 from the origin, I see response being updated as 
max-age passes (due to patch)
   
   In this case, TrafficServer simulates "stale-if-error", expected. 
`max_stale_age` is the switch to control the time frame of the feature.
   
   Setting `negative_revalidating_lifetime` to some value impacts nothing
   
   # Conclusion
   
   So currently the documentation (in records.config) could state:
   
   - `proxy.config.http.negative_revalidating_enabled`
   
   Add something like "`proxy.config.http.cache.max_stale_age` can be used to 
configure how long the stale response will be given for available backend 
returning 5xx response."
   
   - `proxy.config.http.negative_revalidating_lifetime`
   
   "...during revalidation, by setting Expire: header to value of Date: + value 
of the option"
   
   - `proxy.config.http.cache.max_stale_age`
   
   "...cannot be cached. Is enabled by 
`proxy.config.http.negative_revalidating_enabled`"
   Well, I am not sure about this, maybe such documentation shall be kept in 
cache-basics as some kind of scenario, anyway this is how I understood and 
configure TrafficServer "negative revalidation" now.
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to