Skip to content

Intern IndexFieldCapabilities Type String on Read (#76405)#77754

Merged
original-brownbear merged 1 commit intoelastic:7.xfrom
original-brownbear:76405-7.x
Sep 15, 2021
Merged

Intern IndexFieldCapabilities Type String on Read (#76405)#77754
original-brownbear merged 1 commit intoelastic:7.xfrom
original-brownbear:76405-7.x

Conversation

@original-brownbear
Copy link
Copy Markdown
Contributor

In case of handling a large number of these messages, i.e. when fetching field caps
for many indices (and/or those indices contain lots of fields) the type string is repeated
many times over. As these strings are already interned because they are constants, taking
the performance hit of interning them on deserialization seems a reasonable trade-off
for the benefit of saving a non-trivial amount of memory for large clusters as well as
speeding up org.elasticsearch.action.fieldcaps.TransportFieldCapabilitiesAction#merge
which uses these strings in map lookup and will run significantly faster with interned strings
instead of fresh strings that do not have their hash values cached yet.

backport of #76405

In case of handling a large number of these messages, i.e. when fetching field caps
for many indices (and/or those indices contain lots of fields) the type string is repeated
many times over. As these strings are already interned because they are constants, taking
the performance hit of interning them on deserialization seems a reasonable trade-off
for the benefit of saving a non-trivial amount of memory for large clusters as well as
speeding up `org.elasticsearch.action.fieldcaps.TransportFieldCapabilitiesAction#merge`
which uses these strings in map lookup and will run significantly faster with interned strings
instead of fresh strings that do not have their hash values cached yet.
@original-brownbear original-brownbear added >non-issue :Search Foundations/Mapping Index mappings, including merging and defining field types backport labels Sep 15, 2021
@elasticmachine elasticmachine added the Team:Search Meta label for search team label Sep 15, 2021
@elasticmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-search (Team:Search)

@original-brownbear original-brownbear merged commit 720756c into elastic:7.x Sep 15, 2021
@original-brownbear original-brownbear deleted the 76405-7.x branch September 15, 2021 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport >non-issue :Search Foundations/Mapping Index mappings, including merging and defining field types Team:Search Meta label for search team v7.16.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants