-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Reduce memory usage in field-caps responses #88042
Conversation
Pinging @elastic/es-search (Team:Search) |
Hi @dnhatn, I've created a changelog YAML for you. |
Heya @dnhatn, this change makes sense to me, good catch! Do you have numbers on the improvements when it comes to memory usage? Did you assess whether the change also has some effect on response time of field_caps? |
@javanna Thanks for looking. This PR doesn't reduce the latency significantly as we still send a full map over the wire. The current version hits OOM with 10 concurrent field-caps requests, but this change doesn't. |
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.
Asked a question around testing, LGTM otherwise. The reason why I asked about numbers is that it would be nice to understand what to expect with this changes. Is it a 1%, 10% or 50% memory usage reduction approximately?
server/src/main/java/org/elasticsearch/action/fieldcaps/FieldCapabilitiesIndexResponse.java
Show resolved
Hide resolved
I expect this PR reduces the memory usage by around 40%. |
@javanna Thanks for review. |
This will be in 7.17.6. |
We have reduced the memory usage of field-caps requests targeting many indices in 8.2+ (see #83494). Unfortunately, we still receive OOM reports in 7.17. I think we should push some contained improvements to reduce the memory usage for those requests in 7.17. I have looked into several options. This PR can reduce the memory usage of field-caps responses by replace HashMap with ArrayList for the field responses to eliminate duplicated string names and internal nodes of Map. I will look into other options, such as deduplicating field-name strings or field-responses.