siddhantsangwan commented on PR #8707: URL: https://github.com/apache/ozone/pull/8707#issuecomment-3082828435
> This is indeed a problem. If the Container yaml is read when the Datanode is stopped, the stop will be slow, which will introduce new problems. Perhaps we can save the compressed String, for example, we can use LZ4 to compress the String, which should have a good compression effect for a String with a lot of repeated content. How do you think? I have some initial thoughts/ideas: 1. 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. 2. 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 https://docs.oracle.com/javaee/7/api/javax/json/stream/JsonParser.html. 3. We can compress the json file as well. -- 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]
