OpenSearch/x-pack/plugin
Jay Modi 3c1fdc9fc0
Security: reduce memory usage of DnRoleMapper (#34250)
The `DnRoleMapper` class is used to map distinguished names of groups
and users to role names. This mapper builds in an internal map that
maps from a `com.unboundid.ldap.sdk.DN` to a `Set<String>`. In cases
where a lot of distinct DNs are mapped to roles, this can consume quite
a bit of memory. The majority of the memory is consumed by the DN
object. For example, a 94 character DN that has 9 relative DNs (RDN)
will retain 4KB of memory, whereas the String itself consumes less than
250 bytes.

In order to reduce memory usage, we can map from a normalized DN string
to a List of roles. The normalized string is actually how the DN class
determines equality with another DN and we can drop the overhead of
needing to keep all of the other objects in memory. Additionally the
use of a List provides memory savings as each HashSet is backed by a
HashMap, which consumes a great deal more memory than an appropriately
sized ArrayList. The uniqueness we get from a Set is maintained by
first building a set when parsing the file and then converting to a
list upon completion.

Closes #34237
2018-10-03 09:30:57 -06:00
..
ccr TEST: Mute testFollowIndexAndCloseNode 2018-10-02 17:20:31 -04:00
core Test: remove awaitsfix incorrectly added in #34148 2018-10-02 10:02:20 -06:00
deprecation Remove unsupported Version.V_5_* (#32937) 2018-08-24 09:51:21 +02:00
graph Clean up "unused variable" warnings (#31876) 2018-09-26 14:09:32 +02:00
logstash Build: Rework shadow plugin configuration (#32409) 2018-08-21 20:03:28 -04:00
ml Removing unused ML parameters (#34159) 2018-10-01 08:09:46 -07:00
monitoring Updating test assertion (#34040) 2018-10-02 03:19:12 -07:00
rollup Allowing {index}/_xpack/rollup/data to accept comma delimited list (#34115) 2018-10-02 06:21:46 -07:00
security Security: reduce memory usage of DnRoleMapper (#34250) 2018-10-03 09:30:57 -06:00
sql SQL: Remove more ANTLR4 grammar ambiguities (#34074) 2018-10-02 15:26:04 +02:00
src/test Allowing {index}/_xpack/rollup/data to accept comma delimited list (#34115) 2018-10-02 06:21:46 -07:00
upgrade Tests: Add support for custom contexts to mock scripts (#34100) 2018-09-27 12:23:59 -07:00
watcher Scripting: Add watcher script contexts (#34059) 2018-09-28 07:58:17 -07:00
build.gradle Allow Integ Tests to run in a FIPS-140 JVM (#31989) 2018-07-24 12:48:14 +03:00