sodonnel commented on code in PR #8966:
URL: https://github.com/apache/hadoop/pull/8966#discussion_r4523968610


##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNodeLayoutSubLockStrategy.java:
##########
@@ -18,16 +18,21 @@
 
 package org.apache.hadoop.hdfs.server.datanode;
 
+import java.util.Collections;
 import java.util.List;
 
 public class DataNodeLayoutSubLockStrategy implements DataSetSubLockStrategy {
+  /** The block directory layout is fixed, so compute the sub lock names once. 
*/
+  private static final List<String> ALL_SUB_LOCK_NAMES =
+      
Collections.unmodifiableList(DatanodeUtil.getAllSubDirNameForDataSetLock());

Review Comment:
   I am not sure if it makes sense to cache the subdir names. Adding / removing 
a volume or a blockpool is a rare operation outside of startup. While its 
inefficient to create the list of sub dirs for each volume, after the DN is 
started we are retaining about 65 - 85kb of heap forever. While its not much, 
these sort of things add up and generating the list is not on any hot path 
where it is worth paying for memory to get a tiny bit more speed in this area.
   
   It is unfortunate that the way the code is structured, we have to get the 
list of subDirs once for each volume, as otherwise we could share a temp array 
for the startup process, but even then its probably not worth complicating the 
code to pass this through all the call sites to speed up startup by a 
negligible amount.



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