-
Notifications
You must be signed in to change notification settings - Fork 38.9k
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
Script to cache metadata requests on the jenkins master #24131
Conversation
GCE e2e build/test passed for commit 4f30fd72e7994561cfbe92c4a6dd70ad7d578105. |
if uri not in _global_cache: | ||
with LOCK: | ||
if uri not in _global_cache: | ||
r2, ok = proxy_request(uri) |
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.
do we want to hold the lock while running the request?
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.
yes, it is simple to understand and since we make each request once the impact is essentially zero.
GCE e2e build/test passed for commit c70387ad59cd76dc4151fee18ac25d26b5bc2002. |
GCE e2e build/test passed for commit 511dbdf1439ac2b197256687b47631f1654a4b6e. |
GCE e2e build/test passed for commit 78ed17a328a9bbbe77bfa83b7db18b7fa2de78de. |
MGI='metadata.google.internal' | ||
TARGET="/etc/hosts" | ||
|
||
grep "$MGI" "$TARGET" || fail "$MGI missing from $TARGET" |
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.
nit still not fixed (${MGI}
, ${TARGET}
, etc)
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.
Done
PTAL |
GCE e2e build/test passed for commit 34a5a47243f06e55aa0804542b059e85ce21d7b5. |
Are we planning on running this even after the underlying problem is fixed? (I'd be totally fine with that, but I wasn't sure if that's the plan) |
|
||
|
||
def cache_request(uri): | ||
if uri not in _global_cache: |
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.
Why check this outside the lock if we're just going to recheck once we lock?
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.
If it is already in the cache I don't want to bother waiting to acquire the lock.
See double-checked locking: https://en.wikipedia.org/wiki/Double-checked_locking
Yes, I think we should use the cache until we figure out whether the metadata server has an SLO and if that SLO meets our needs. |
For some reason the metadata server cache crashed on |
Appears to have crashed on |
Issue seems to be that both |
Let's get this merged. I can work on getting this started automatically on boot thereafter. |
SGTM. Probably a good idea to squash. |
GCE e2e build/test passed for commit 34a5a47243f06e55aa0804542b059e85ce21d7b5. |
GCE e2e build/test passed for commit 7605ff0. |
GCE e2e build/test passed for commit 7605ff0. |
#24661 is actually the cause of the previous flake. |
GCE e2e build/test passed for commit 7605ff0. |
Automatic merge from submit-queue |
Fixes #23545
Create an http server which caches most requests to the metadata server. Use special logic to cache access tokens such that the expires_on json field is correct. Add a script to simplify enabling/disabling the cache by editing
/etc/hosts