Skip to content

Support better re-use of API key role caching #53939

@ywangd

Description

@ywangd

The caching of API key role is indexed by the role names and the key ID. Therefore, even when two keys have exactly the same set of role descriptors, their roles must be calculated separately and also counted as two independant cache item. In addition, a single key's role descriptors and and limiting role descriptors are also cached seperately. This means we need at least 2 caching slots for every API key.

When there is a large amount of API keys, we could face a role cache thrashing problem. The default cache size is 10k so that 5k keys will be able to saturate it. If any of the role descriptor includes a non-empty application privilege, it could further saturate the search thread pool, which in turns leads to an overloaded cluster.

It is reasonable to assume that most of the 5k keys share the same privilege definitions. Hence the caching problem can be improved if a Role built from the same set of role descriptors can be re-used. That is, despite different API key IDs and possibly different role descriptor names, if the content of a set of role descriptors are the same, we should be able to cach and re-use it.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions