-
Notifications
You must be signed in to change notification settings - Fork 67
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
Don't use io.ReadAll while recycling indices #878
Conversation
These calls to
Other place that may be copying too many objects is |
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.
👍 only by not keeping the whole index response in memory there should be improvements in memory usage.
It depends on how json manages the decode cache inside, but I'm not master of that area, so can't answer if we can spot fields to improve there.
Agree, but I don't see this part "hot" in the calltree graph. Only 500 KB is used there. I don't know if there is any json marshaller that deallocates used memory. I tried to play with jsoniter, but it gave similar results (as the logic doesn't jump over fields). Still 👍 to merge it, @jsoriano? :) |
Change makes sense to me, so ok to merge :) Though not sure if it will solve all the problems. But we can iterate. Do you have a profile with the new code? |
Do you mean |
This PR replaces
io.ReadAll
withjson.Decode
as the routine doesn't need the index content. I'm not convinced about this structure as it usesjson.Unmarshaller
, but I don't have an idea how to improve it.Right now:
If you can observe some other places to refactor, feel free to comment.
Testing (if you want to play):
mtojek-temp
is in theelastic-observability
namespace.