-
Notifications
You must be signed in to change notification settings - Fork 24.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
Increase Size and lower TTL on DLS BitSet Cache #50535
Conversation
The Document Level Security BitSet Cache (see elastic#43669) had a default configuration of "small size, long lifetime". However, this is not a very useful default as the cache is most valuable for BitSets that take a long time to construct, which is (generally speaking) the same ones that operate over a large number of documents and contain many bytes. This commit changes the cache to be "large size, short lifetime" so that it can hold bitsets representing billions of documents, but releases memory quickly. The new defaults are 10% of heap, and 2 hours. This also adds some logging when a single BitSet exceeds the size of the cache and when the cache is full.
Pinging @elastic/es-security (:Security/Authorization) |
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.
LGTM - the prev value of 50Mb
was too low and a ratio value makes sense to me. I don't feel qualified to answer about the 10%
I don't have enough practical experience with real life memory numbers.
I sense it might be rather large, but the 2hrs
expiry time should mitigate it.
I think we can expose to the DocumentSubsetBitsetCache
that this roleQuery
pertains from a script, and have a dedicated cache for those, i.e. a new Cache
instance member. The original TTL of 1 week makes sense for non-templated role queries. However, templated role queries are rather difficult to set up and users that employ them really need them, which makes me assume they most likely use dynamic attributes of the user, or time, thereby flooding the cache which turns our 1 week TTL assumptions on their head.
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.
The proposed size and TTL look good to me.
...ava/org/elasticsearch/xpack/core/security/authz/accesscontrol/DocumentSubsetBitsetCache.java
Outdated
Show resolved
Hide resolved
…security/authz/accesscontrol/DocumentSubsetBitsetCache.java Co-Authored-By: Adrien Grand <jpountz@gmail.com>
@elasticmachine run elasticsearch-ci/bwc |
The Document Level Security BitSet Cache (see elastic#43669) had a default configuration of "small size, long lifetime". However, this is not a very useful default as the cache is most valuable for BitSets that take a long time to construct, which is (generally speaking) the same ones that operate over a large number of documents and contain many bytes. This commit changes the cache to be "large size, short lifetime" so that it can hold bitsets representing billions of documents, but releases memory quickly. The new defaults are 10% of heap, and 2 hours. This also adds some logging when a single BitSet exceeds the size of the cache and when the cache is full. Resolves: elastic#49260 Backport of: elastic#50535
The Document Level Security BitSet Cache (see #43669) had a default configuration of "small size, long lifetime". However, this is not a very useful default as the cache is most valuable for BitSets that take a long time to construct, which is (generally speaking) the same ones that operate over a large number of documents and contain many bytes. This commit changes the cache to be "large size, short lifetime" so that it can hold bitsets representing billions of documents, but releases memory quickly. The new defaults are 10% of heap, and 2 hours. This also adds some logging when a single BitSet exceeds the size of the cache and when the cache is full. Backport of: #50535
The Document Level Security BitSet Cache (see elastic#43669) had a default configuration of "small size, long lifetime". However, this is not a very useful default as the cache is most valuable for BitSets that take a long time to construct, which is (generally speaking) the same ones that operate over a large number of documents and contain many bytes. This commit changes the cache to be "large size, short lifetime" so that it can hold bitsets representing billions of documents, but releases memory quickly. The new defaults are 10% of heap, and 2 hours. This also adds some logging when a single BitSet exceeds the size of the cache and when the cache is full. Resolves: elastic#49260
In elastic#50535 (ES v7.6) the default values for the `DocumentSubsetBitsetCache` settings were changed. However, the docs were not updated at that tim, and still reflect the old values for these settings
In #50535 (ES v7.6) the default values for the `DocumentSubsetBitsetCache` settings were changed. However, the docs were not updated at that time, and still reflect the old values for these settings
In elastic#50535 (ES v7.6) the default values for the `DocumentSubsetBitsetCache` settings were changed. However, the docs were not updated at that time, and still reflect the old values for these settings
In elastic#50535 (ES v7.6) the default values for the `DocumentSubsetBitsetCache` settings were changed. However, the docs were not updated at that time, and still reflect the old values for these settings
In elastic#50535 (ES v7.6) the default values for the `DocumentSubsetBitsetCache` settings were changed. However, the docs were not updated at that time, and still reflect the old values for these settings
The Document Level Security BitSet Cache (see #43669) had a default
configuration of "small size, long lifetime". However, this is not
a very useful default as the cache is most valuable for BitSets that
take a long time to construct, which is (generally speaking) the same
ones that operate over a large number of documents and contain many
bytes.
This commit changes the cache to be "large size, short lifetime" so
that it can hold bitsets representing billions of documents, but
releases memory quickly.
The new defaults are 10% of heap, and 2 hours.
This also adds some logging when a single BitSet exceeds the size of
the cache and when the cache is full.
Resolves: #49260