Skip to content

Improve role cache efficiency for API key roles (#58156)#59397

Merged
ywangd merged 2 commits intoelastic:7.xfrom
ywangd:es-53939-api-key-roles-cache-7.x
Jul 13, 2020
Merged

Improve role cache efficiency for API key roles (#58156)#59397
ywangd merged 2 commits intoelastic:7.xfrom
ywangd:es-53939-api-key-roles-cache-7.x

Conversation

@ywangd
Copy link
Copy Markdown
Member

@ywangd ywangd commented Jul 13, 2020

This PR ensure that same roles are cached only once even when they are from different API keys.

API key role descriptors and limited role descriptors are now saved in Authentication#metadata
as raw bytes instead of deserialised Map<String, Object>.
Hashes of these bytes are used as keys for API key roles. Only when the required role is not found
in the cache, they will be deserialised to build the RoleDescriptors. The deserialisation is directly
from raw bytes to RoleDescriptors without going through the current detour of
"bytes -> Map -> bytes -> RoleDescriptors".

ywangd added 2 commits July 13, 2020 21:31
This PR ensure that same roles are cached only once even when they are from different API keys.
API key role descriptors and limited role descriptors are now saved in Authentication#metadata
as raw bytes instead of deserialised Map<String, Object>.
Hashes of these bytes are used as keys for API key roles. Only when the required role is not found
in the cache, they will be deserialised to build the RoleDescriptors. The deserialisation is directly
from raw bytes to RoleDescriptors without going through the current detour of
"bytes -> Map -> bytes -> RoleDescriptors".
@ywangd
Copy link
Copy Markdown
Member Author

ywangd commented Jul 13, 2020

@elasticmachine run elasticsearch-ci/2

@ywangd ywangd merged commit a844697 into elastic:7.x Jul 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant