Skip to content
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

Notify PkgServer.jl about nginx cache hits #200

Merged
merged 1 commit into from
Dec 27, 2023
Merged

Conversation

fredrikekre
Copy link
Member

As described in #198, the file cache is unaware of cache hits for files served directly by nginx. This patch notifies PkgServer.jl about nginx cache hits by sending a mirrored request to the internal /notify endpoint. The original request URI is sent through the X-Original-URI header and is used to record the cache hit. In addition, since any cache hits are for files already existing in the cache we can record the size as bytes sent by nginx in a Prometheus counter.

Comment on lines +34 to +36
# Notify PkgServer about this cache hit
mirror /notify;
mirror_request_body off;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I verified that nginx only send the mirror request if this block was selected (i.e. if try_files was succesful).

As described in #198, the file cache is unaware of cache hits for files
served directly by nginx. This patch notifies PkgServer.jl about nginx
cache hits by sending a mirrored request to the internal /notify
endpoint. The original request URI is sent through the `X-Original-URI`
header and is used to record the cache hit. In addition, since any cache
hits are for files already existing in the cache we can record the size
as bytes sent by nginx in a Prometheus counter.
@fredrikekre fredrikekre merged commit c122c0a into master Dec 27, 2023
4 checks passed
@fredrikekre fredrikekre deleted the fe/cache-counter branch December 27, 2023 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants