You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by "masaori335 (via GitHub)" <gi...@apache.org> on 2025/04/24 07:34:26 UTC
[PR] Add proxy.config.http.negative_revalidating_list [trafficserver]
masaori335 opened a new pull request, #12212:
URL: https://github.com/apache/trafficserver/pull/12212
Recently, I got a request to make negative revalidation feature more flexible.
This makes HTTP status code list to do negative revalidation configurable. Prior to this change, it's hard coded in `HttpTransact::handle_cache_operation_on_forward_server_response`.
For now, this new config is not overridable. Ideally, it's should be overridable, but has the same issue with `proxy.config.http.negative_caching_list` (#12206).
--
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.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add proxy.config.http.negative_revalidating_list [trafficserver]
Posted by "cmcfarlen (via GitHub)" <gi...@apache.org>.
cmcfarlen commented on PR #12212:
URL: https://github.com/apache/trafficserver/pull/12212#issuecomment-2845142418
Cherry-picked to 10.1.x branch
--
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.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add proxy.config.http.negative_revalidating_list [trafficserver]
Posted by "bneradt (via GitHub)" <gi...@apache.org>.
bneradt commented on code in PR #12212:
URL: https://github.com/apache/trafficserver/pull/12212#discussion_r2064915431
##########
tests/gold_tests/cache/replay/negative-revalidating-list.replay.yaml:
##########
@@ -0,0 +1,155 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#
+# Verify negative_revalidating disabled behavior. This replay file assumes:
+# * ATS is configured with negative_revalidating disabled.
+# * max_stale_age is set to 6 seconds.
+#
+
+meta:
+ version: "1.0"
+
+sessions:
+- transactions:
+
+ #
+ # Test 1: Negative revalidating for a cached content-length response.
+ #
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ scheme: "http"
+ url: /path/reques_item
+ headers:
+ fields:
+ - [ Host, example.com ]
+ - [ uuid, 31 ]
+
+ # Populate the cache with a 200 response.
+ server-response:
+ status: 200
+ reason: "OK"
+ headers:
+ fields:
+ - [ Content-Length, 32 ]
+ - [ Cache-Control, max-age=2 ]
+
+ proxy-response:
+ status: 200
+
+ # Verify we serve the 200 OK out of the cache if it is not stale.
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ scheme: "http"
+ url: /path/reques_item
+ headers:
+ fields:
+ - [ Host, example.com ]
+ - [ uuid, 32 ]
+
+ # Give cache IO enough time to finish.
+ delay: 100ms
+
+ # This should not reach the origin server.
+ server-response:
+ status: 503
+ reason: "Service Unavailable"
+ headers:
+ fields:
+ - [ Content-Length, 32 ]
+
+ # Again, we should serve this out of the cache.
+ proxy-response:
+ status: 200
+
+ # Verify that with negative_revalidating enabled, we serve the 200 OK out of
+ # the cache even though it is stale (but younger than max_stale_age) for configured status code.
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ scheme: "http"
+ url: /path/reques_item
+ headers:
+ fields:
+ - [ Host, example.com ]
+ - [ uuid, 33 ]
+
+ # Make sure the item is stale per it's 2 second max-age.
+ delay: 4s
+
+ server-response:
+ status: 403
+ reason: "Forbidden"
+ headers:
+ fields:
+ - [ Content-Length, 32 ]
+
+ # With negative_revalidating enabled, the cached response should be served
+ # even though it is stale.
+ proxy-response:
+ status: 200
+
+ # Verify that with negative_revalidating enabled, we serve the response from origin if it's not configured status code.
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ scheme: "http"
+ url: /path/reques_item
+ headers:
+ fields:
+ - [ Host, example.com ]
+ - [ uuid, 34 ]
+
+ server-response:
+ status: 503
+ reason: "Service Unavailable"
+ headers:
+ fields:
+ - [ Content-Length, 32 ]
+
+ # With negative_revalidating enabled, but status code is not configured one, return it directly
+ proxy-response:
+ status: 503
+
+ # Verify that max_stale_age is respected.
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ scheme: "http"
Review Comment:
`scheme` isn't needed in these transaction nodes. It's controlled by the network specification of the session. It's best to just leave them out here.
--
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.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add proxy.config.http.negative_revalidating_list [trafficserver]
Posted by "masaori335 (via GitHub)" <gi...@apache.org>.
masaori335 merged PR #12212:
URL: https://github.com/apache/trafficserver/pull/12212
--
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.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add proxy.config.http.negative_revalidating_list [trafficserver]
Posted by "bneradt (via GitHub)" <gi...@apache.org>.
bneradt commented on code in PR #12212:
URL: https://github.com/apache/trafficserver/pull/12212#discussion_r2064912119
##########
src/proxy/http/HttpTransact.cc:
##########
@@ -4319,15 +4319,12 @@ HttpTransact::handle_cache_operation_on_forward_server_response(State *s)
SET_VIA_STRING(VIA_SERVER_RESULT, VIA_SERVER_SERVED);
SET_VIA_STRING(VIA_PROXY_RESULT, VIA_PROXY_SERVED);
- /* if we receive a 500, 502, 503 or 504 while revalidating
+ /* In default, if we receive a 500, 502, 503 or 504 while revalidating
Review Comment:
By default
##########
tests/gold_tests/cache/replay/negative-revalidating-list.replay.yaml:
##########
@@ -0,0 +1,155 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#
+# Verify negative_revalidating disabled behavior. This replay file assumes:
+# * ATS is configured with negative_revalidating disabled.
+# * max_stale_age is set to 6 seconds.
+#
+
+meta:
+ version: "1.0"
+
+sessions:
+- transactions:
+
+ #
+ # Test 1: Negative revalidating for a cached content-length response.
+ #
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ scheme: "http"
+ url: /path/reques_item
+ headers:
+ fields:
+ - [ Host, example.com ]
+ - [ uuid, 31 ]
+
+ # Populate the cache with a 200 response.
+ server-response:
+ status: 200
+ reason: "OK"
+ headers:
+ fields:
+ - [ Content-Length, 32 ]
+ - [ Cache-Control, max-age=2 ]
+
+ proxy-response:
+ status: 200
+
+ # Verify we serve the 200 OK out of the cache if it is not stale.
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ scheme: "http"
+ url: /path/reques_item
+ headers:
+ fields:
+ - [ Host, example.com ]
+ - [ uuid, 32 ]
+
+ # Give cache IO enough time to finish.
+ delay: 100ms
+
+ # This should not reach the origin server.
+ server-response:
+ status: 503
+ reason: "Service Unavailable"
+ headers:
+ fields:
+ - [ Content-Length, 32 ]
+
+ # Again, we should serve this out of the cache.
+ proxy-response:
+ status: 200
+
+ # Verify that with negative_revalidating enabled, we serve the 200 OK out of
+ # the cache even though it is stale (but younger than max_stale_age) for configured status code.
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ scheme: "http"
+ url: /path/reques_item
+ headers:
+ fields:
+ - [ Host, example.com ]
+ - [ uuid, 33 ]
+
+ # Make sure the item is stale per it's 2 second max-age.
+ delay: 4s
+
+ server-response:
+ status: 403
+ reason: "Forbidden"
+ headers:
+ fields:
+ - [ Content-Length, 32 ]
+
+ # With negative_revalidating enabled, the cached response should be served
+ # even though it is stale.
+ proxy-response:
+ status: 200
+
+ # Verify that with negative_revalidating enabled, we serve the response from origin if it's not configured status code.
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ scheme: "http"
+ url: /path/reques_item
+ headers:
+ fields:
+ - [ Host, example.com ]
+ - [ uuid, 34 ]
+
+ server-response:
+ status: 503
+ reason: "Service Unavailable"
+ headers:
+ fields:
+ - [ Content-Length, 32 ]
+
+ # With negative_revalidating enabled, but status code is not configured one, return it directly
+ proxy-response:
+ status: 503
+
+ # Verify that max_stale_age is respected.
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ scheme: "http"
Review Comment:
`sheme` isn't needed in these.
##########
doc/admin-guide/files/records.yaml.en.rst:
##########
@@ -1928,6 +1928,12 @@ Negative Response Caching
This configuration defaults to 1,800 seconds (30 minutes).
+.. ts:cv:: CONFIG proxy.config.http.negative_revalidating_list STRING 500 502 503 504
+ :reloadable:
+
+ The HTTP status code for negative revalidating. Default values are mentioned above. The unwanted status codes can be
+ taken out from the list. Other status codes can be added. The variable is a list but parsed as STRING.
Review Comment:
A suggestion:
```
The HTTP status codes for which the negative revalidating feature applies.
Note that this is a `STRING` configuration containing a space separated list
of the desired HTTP status codes.
```
--
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.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add proxy.config.http.negative_revalidating_list [trafficserver]
Posted by "bneradt (via GitHub)" <gi...@apache.org>.
bneradt commented on code in PR #12212:
URL: https://github.com/apache/trafficserver/pull/12212#discussion_r2064915431
##########
tests/gold_tests/cache/replay/negative-revalidating-list.replay.yaml:
##########
@@ -0,0 +1,155 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#
+# Verify negative_revalidating disabled behavior. This replay file assumes:
+# * ATS is configured with negative_revalidating disabled.
+# * max_stale_age is set to 6 seconds.
+#
+
+meta:
+ version: "1.0"
+
+sessions:
+- transactions:
+
+ #
+ # Test 1: Negative revalidating for a cached content-length response.
+ #
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ scheme: "http"
+ url: /path/reques_item
+ headers:
+ fields:
+ - [ Host, example.com ]
+ - [ uuid, 31 ]
+
+ # Populate the cache with a 200 response.
+ server-response:
+ status: 200
+ reason: "OK"
+ headers:
+ fields:
+ - [ Content-Length, 32 ]
+ - [ Cache-Control, max-age=2 ]
+
+ proxy-response:
+ status: 200
+
+ # Verify we serve the 200 OK out of the cache if it is not stale.
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ scheme: "http"
+ url: /path/reques_item
+ headers:
+ fields:
+ - [ Host, example.com ]
+ - [ uuid, 32 ]
+
+ # Give cache IO enough time to finish.
+ delay: 100ms
+
+ # This should not reach the origin server.
+ server-response:
+ status: 503
+ reason: "Service Unavailable"
+ headers:
+ fields:
+ - [ Content-Length, 32 ]
+
+ # Again, we should serve this out of the cache.
+ proxy-response:
+ status: 200
+
+ # Verify that with negative_revalidating enabled, we serve the 200 OK out of
+ # the cache even though it is stale (but younger than max_stale_age) for configured status code.
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ scheme: "http"
+ url: /path/reques_item
+ headers:
+ fields:
+ - [ Host, example.com ]
+ - [ uuid, 33 ]
+
+ # Make sure the item is stale per it's 2 second max-age.
+ delay: 4s
+
+ server-response:
+ status: 403
+ reason: "Forbidden"
+ headers:
+ fields:
+ - [ Content-Length, 32 ]
+
+ # With negative_revalidating enabled, the cached response should be served
+ # even though it is stale.
+ proxy-response:
+ status: 200
+
+ # Verify that with negative_revalidating enabled, we serve the response from origin if it's not configured status code.
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ scheme: "http"
+ url: /path/reques_item
+ headers:
+ fields:
+ - [ Host, example.com ]
+ - [ uuid, 34 ]
+
+ server-response:
+ status: 503
+ reason: "Service Unavailable"
+ headers:
+ fields:
+ - [ Content-Length, 32 ]
+
+ # With negative_revalidating enabled, but status code is not configured one, return it directly
+ proxy-response:
+ status: 503
+
+ # Verify that max_stale_age is respected.
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ scheme: "http"
Review Comment:
`sheme` isn't needed in these transaction nodes. It's controlled by the network specification of the session. It's best to just leave them out here.
--
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.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org