Skip to content

Multiple Origin Requests Due to Cache Write Lock Failure #12166

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

Open
gy1082 opened this issue Apr 6, 2025 · 2 comments
Open

Multiple Origin Requests Due to Cache Write Lock Failure #12166

gy1082 opened this issue Apr 6, 2025 · 2 comments
Labels

Comments

@gy1082
Copy link

gy1082 commented Apr 6, 2025

Description:
When multiple concurrent requests are made for the same expired cached resource, and the origin content hasn't been modified:

  1. Current behavior:
    • The handle_cache_write_lock function removes the IMS (If-Modified-Since) header
    • This results in multiple origin requests for the same resource
    • These requests are logged with TCP_REFRESH_MISS status

Question:
For this specific scenario where concurrent requests are made for an expired cached resource and the origin content hasn't been modified, can we preserve the IMS headers in handle_cache_write_lock? This would potentially reduce unnecessary origin requests.

Version: Apache Traffic Server 9.2.3

@gy1082 gy1082 changed the title IMS Header Removal During Cache Write Lock Failure Breaks Read-While-Write Pattern Multiple Origin Requests Due to Cache Write Lock Failure Apr 6, 2025
@ezelkow1
Copy link
Member

ezelkow1 commented Apr 7, 2025

One option you can try is setting the write lock failure option to setting 5, https://docs.trafficserver.apache.org/en/9.2.x/admin-guide/files/records.config.en.html#proxy-config-http-cache-open-write-fail-action

It is still considered experimental because in previous versions of ATS we could see eventual crashes with it enabled on specific content but it may be worth trying (I have some test production machines running with this enabled for the past 3 months and have yet to see these crashes again). This enables ATS to jump backwards in the state machine so when the write lock fails it can go back to the read state and wait in line.

This wont directly address the IMS question but it would bring down the multiple origin requests as long as you have read while writer enabled.

We discussed this a bit during our bug scrub call and it looks like while it removes the IMS header it does re-insert it based on the request, so an IMS header should end up existing in the cached copy, but it would still make the upstream request in your case.

@gy1082
Copy link
Author

gy1082 commented Apr 11, 2025

Hi @ezelkow1
Thank you for the suggestion to set proxy.config.http.cache.open_write_fail_action to 5, but I'm still experiencing the issue with multiple origin requests (TCP_REFRESH_MISS) for the same expired cached resource.
Any additional guidance would be appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants