xichen01 commented on PR #6656:
URL: https://github.com/apache/ozone/pull/6656#issuecomment-2102940045

   @szetszwo Thanks for your reply
   > If there are many DatanodeDetails instances , we probably should cache 
DatanodeDetails instances instead of the ByteString inside the DatanodeDetails.
   
   - But `DatanodeDetails` is not an immutable object, so it is not possible to 
simply cache `DatanodeDetails`, which would require considerable modification, 
and possibly have some compatibility issues.
   
   - Moreover, `DatanodeDetails` not only consumes memory space for its own 
objects, but also consumes a lot of resources during the encode/decode of 
`DatanodeDetails`, this PR is to reduce the consumption of `DatanodeDetails` 
encode.
   
   
   > @xichen01 , do you have comparison before and after this change? What is 
the memory saving? Is it in MBs or GBs?
   
   Here's an `alloc` flame graph that shows the effect of the optimization
   
   Before
   
https://issues.apache.org/jira/secure/attachment/13068731/om-create-key-alloc-profiler-setxxxString.html
   After
   The `com/google/protobuf/ByteString.copyFromUtf8` in the `DatanodeDetail` 
disappear.
   
https://issues.apache.org/jira/secure/attachment/13068732/om-create-key-alloc-profiler-setxxbytes.html
   
   
   Of course, this PR is only a small improvement, and it would be a big 
improvement to be able to cache the `DatanodeDetails`, which may require more 
work.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to