Repository navigation
Conversation
Build SecretCache on WebCache and once_result, the parts the sse-kms secrets cache is made of. A miss now fetches once and every concurrent request for the same access key waits for that result instead of sending its own s3tokens and credential requests to keystone. Failures are not cached. Signed-off-by: Matthew N. Heler <[email protected]>
|
@mheler I will do a detailed review later, but some quick thoughts. Some unit tests would be good to have. Also, could you share whether you tested this against the reproducer in the tracker? I was working on a possible solution for the same tracker While investigating I found other places where the same keystone stampede happens:
None of these are in 67793, which is specifically about concurrent s3 requests causing repeated get_secret_from_keystone(). This PR covers that. So I would open a separate tracker per path and do them on top of this rather than growing this PR. Happy to take them on, or to hand them over if you would rather. |
get_admin_token sends its own v3/auth/tokens request for every caller that misses the cache, so when the admin token expires every request in flight asks keystone for a new one at the same time. Hold the request in flight in TokenCache and run it through call_once, so callers that miss together wait on the same one. Signed-off-by: Matthew N. Heler <[email protected]>
I added a second commit to cover the admin token path. I am not sure there's a huge benefit for the service token path though, and I am skeptical there is significant use of swift to warrant this work (I would love to see swift completely disabled someday though). |
| for (;;) { | ||
| auto value = secret_cache.lookup_or_insert(key); | ||
| bool fetched = false; | ||
| result = call_once(*value, y, [&] { fetched = true; return fetch(); }); |
There was a problem hiding this comment.
Nit: fetch() only catches int, so an unexpected std::exception (e.g. bad_alloc) would be stored by call_once and skip the remove() calls below, leaving the entry replaying that exception. Unlikely, but a catch (...) { secret_cache.remove(key, value); throw; } around call_once would make it robust. Same for admin_request_done() in get_admin_token().
|
Please find some more comments on the PR.
Did you run this PR against the reproducer at https://github.com/kayrus/ceph-auth-poc. The original report in https://tracker.ceph.com/issues/67793 shows 1000 simultaneous requests producing 2000 simultaneous requests to Keystone. Could you share how many Keystone requests you see with this PR applied? I can also run it later against my local keystone docker that I use for testing.
In the current code, an access key is added to the secret cache only after Keystone has validated it: ceph/src/rgw/rgw_auth_keystone.cc Lines 635 to 638 in d732a9b In this PR, With the default Suggestion: keep in-flight lookups in a separate map whose entries only exist while the fetch is running, and add to the secret cache only on success. That keeps the coalescing and avoids evicting good entries on failed lookups.
|
|
This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days. |
|
/unstale |
|
I plan to revisit this shortly. |
Build the keystone EC2 secret cache on the WebCache and once_result parts from the sse-kms secrets cache in #61256, so concurrent requests for the same access key share one keystone lookup.
Fixes: https://tracker.ceph.com/issues/67793
Fixes: https://tracker.ceph.com/issues/80504
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.