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

   @siddhantsangwan 
   > Instead of keeping the yaml as a string in-memory, or reading the yaml 
from the disk during shutdown (to create the json), can we not create the json 
using ContainerData directly, which is already the in-memory representation of 
the on-disk yaml file? This avoids both the memory impact of having the yaml in 
memory and the performance impact of reading the yaml from disk.
   
   My main concern is that the `KeyValueContainer` in 
`ContainerSet#containerMap` will be inconsistent with the memory and yaml file. 
When the Datanode restarts, the Container will be reloaded from the yaml. So 
caching the yaml file can ensure the same logic as before. If you create a 
cache directly from `ContainerData`, it may be different from the cause logic.
   Perhaps we can filter the cached Container, for example, only cache the 
Container in the CLOSED state
   
   > While reading from the json during startup, instead of reading the whole 
json object into memory, how about we stream it chunk by chunk into memory? For 
example, by creating one ContainerData object at a time. This will avoid having 
to create the entire CacheMetadata object in memory first. I estimate this 
CacheMetadata object will be 100s of megabytes, so this will save 100s of 
megabytes of RAM. I have not used it before, but maybe we can use.
   
   That's a nice approach, but the json is only loaded when the Datanode starts 
up, and that memory is reclaimed quickly, so it shouldn't have a noticeable 
impact for the OM.
   
   > We can compress the json file as well.
   
   In my test, If there are 100K Containers on a Datanode Volume (disk), the 
cache file is about 60M, which should not be too large (each Volume's cache 
file is independent)


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