OpenSearch/x-pack/plugin/security
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
..
cli Fix forbidden apis on FIPS (#33202) 2018-08-29 17:43:40 +03:00
forbidden Migrate x-pack-elasticsearch source to elasticsearch 2018-04-20 15:29:54 -07:00
licenses LOGGING: Upgrade to Log4J 2.11.1 (#32616) 2018-08-06 14:56:21 +02:00
src Security: reduce memory usage of DnRoleMapper (#34250) 2018-10-03 09:30:57 -06:00
build.gradle Structured audit logging (#31931) 2018-09-14 15:25:53 +03:00