Skip to content
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

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

Merged
merged 1 commit into from
Sep 15, 2021

Conversation

original-brownbear
Copy link
Member

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
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