Repository navigation
rgw: Added caching for S3 credentials retrieved from keystone - #26095
Conversation
|
As an example our 700 30MB requests per second fully maxed out 12 CPU cores on keystone and generated around 30Mb/s of authentication traffic. Post this change the authentication traffic to and from keystone is now negligible (and the keystone cpu load is similarly negligible), and the latency of each of our S3 requests has dropped by about 40%. The benefit might well be even larger with smaller objects. |
|
This code is inspired by the Swift keystone-middleware s3 python code which provides a layer of token caching using memcached. In this patch a similar approach is applied within radosgw using C++ constructs. |
mattbenjamin
left a comment
There was a problem hiding this comment.
this seems like a valid complement to the STS integration with keystone, which avoids the need for a cache, but has different trade-offs--for an environment where keystone has ec2 credentials for an account, using sts::lite should be an option; did you folks look at that?
@jamesba See http://docs.ceph.com/docs/master/radosgw/STSLite/ @mattbenjamin In this situation we are not always in control of the client implementation so needing to patch boto would be unfortunate. The STS stuff is however interesting. |
|
@jamesba hacking boto3 was/is--I think, @pritha-srivastava?--attempts to make boto do the full STS round trip, but iiuc, the only thing it doesn't do unpatched is the GetSessionToken, so iiuc again, that step, which is done once/infrequently, could be done with something outboard? |
You are right Matt, only GetSessionToken requires boto to be patched, once the temporary creds are obtained, patching boto is not needed. |
|
@jamesba do you folks have a timeline for pushing some updates here? We'd like to incorporate this, when ready. |
@mattbenjamin we are also keen to get this merged as it is working very well for us, I would hope that we can get an update pushed early next week. We are suffering slightly from parallel builds failing for mimic which makes the turn-round time to test things very slow. |
|
@jamesba woot, thanks for the update |
…tials When providing an S3 compatible interface previous behaviour has been to cache the access token but request verification of the signature for every request from keystone. This causes keystone to be quite a performance bottleneck especially for instalations with high levels of S3 traffic. In this commit a change is made to perform the verification of S3 request signatures inside the radosgw process, thereby seriously reducing the number of requests that need to be made to keystone. To do this a shared S3 secret key is obtained from keystone and kept in a local cache. Signed-off-by: James Weaver <[email protected]>
Now makes use of existing method for generating a signature for an S3 request. Signed-off-by: James Weaver <[email protected]>
3c9e406 to
2e25485
Compare
|
@mattbenjamin Have made the requested changes. Now makes use of the existing signing mechanisms. |
mattbenjamin
left a comment
There was a problem hiding this comment.
this looks good to me, with ack from pritha and marcus; marcus has a parallel change that touches the keystone token cache, and I want him to elucidate how they interact
| lock(), | ||
| max(cct->_conf->rgw_keystone_token_cache_size), | ||
| s3_token_expiry_length(300) { | ||
| s3_token_expiry_length(300, 0) { |
There was a problem hiding this comment.
missed this in the first path; this should probably be configurable? I don't think that's a problem for now
There was a problem hiding this comment.
@mattbenjamin we did try to make this configurable during testing but that only led to segfaults, the proper way to add new config options is a bit opaque. Is there a good guide or example for that?
There was a problem hiding this comment.
Any progress on this?
|
@mdw-at-linuxbox can I get you to do your review of this? |
|
The main reservation I have about this is I think there will be sites that don't want to export all their user tokens to rgw this way - is there a way to maintain the ability for the "old" functionality as well? Token revocation may be an issue as well - doesn't appear to be any datapath for this. I don't think most sites will care about this - something to think about for the future. This change doesn't directly interact with anything I do. It duplicates the token cache to make a new "secret cache" - parallel logic to token_cache. It could benefit from the same set of changes I did for token_cache - and could also benefit from using a shared type instead of duplicating logic. |
|
@mdw-at-linuxbox @cbodley I think this is pass. There is, in addition to the mon and osd ones, a radosgw leak in a request pipeline; it doesn't seem to have any relationship to the PR: |
|
@mdw-at-linuxbox those suggestions make sense; I think we should merge now and improve rather than delaying further, however |
|
We are open to adding config options to enable/disable this function, and maybe tune the cache lifetime. We are however unable to add config options without the code segfaulting - see @jamesba requesting help with this in previous comments. Happy to add that to this PR or a subsequent one as required if we can get some guidance. |
|
@jrosser you're welcome to help; I'd like to take this now, @mdw-at-linuxbox may be able to help coordinate on adjustments, or work through the issues; great work here, sorry it took a long time to merge! |
When providing an S3 compatible interface previous behaviour has been to cache the
access token but request verification of the signature for every request from keystone.
This causes keystone to be quite a performance bottleneck especially for instalations
with high levels of S3 traffic.
In this commit a change is made to perform the verification of S3 request signatures
inside the radosgw process, thereby seriously reducing the number of requests that need
to be made to keystone. To do this a shared S3 secret key is obtained from keystone and
kept in a local cache.
Signed-off-by: James Weaver [email protected]