Hadoop HDFS
  1. Hadoop HDFS
  2. HDFS-2362 More Improvements on NameNode Scalability
  3. HDFS-2477

Optimize computing the diff between a block report and the namenode state.


    • Type: Sub-task Sub-task
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.23.0
    • Fix Version/s: 2.0.0-alpha, 0.23.7
    • Component/s: namenode
    • Labels:
    • Target Version/s:
    • Hadoop Flags:


      When a block report is processed at the NN, the BlockManager.reportDiff traverses all blocks contained in the report, and for each one block, which is also present in the corresponding datanode descriptor, the block is moved to the head of the list of the blocks in this datanode descriptor.

      With HDFS-395 the huge majority of the blocks in the report, are also present in the datanode descriptor, which means that almost every block in the report will have to be moved to the head of the list.

      Currently this operation is performed by DatanodeDescriptor.moveBlockToHead, which removes a block from a list and then inserts it. In this process, we call findDatanode several times (afair 6 times for each moveBlockToHead call). findDatanode is relatively expensive, since it linearly goes through the triplets to locate the given datanode.

      With this patch, we do some memoization of findDatanode, so we can reclaim 2 findDatanode calls. Our experiments show that this can improve the reportDiff (which is executed under write lock) by around 15%. Currently with HDFS-395, reportDiff is responsible for almost 100% of the block report processing time.

      1. reportDiff.patch
        10 kB
        Tomasz Nykiel
      2. reportDiff.patch-2
        10 kB
        Tomasz Nykiel
      3. reportDiff.patch-3
        10 kB
        Tomasz Nykiel
      4. reportDiff.patch-4
        11 kB
        Tomasz Nykiel
      5. reportDiff.patch-5
        11 kB
        Tomasz Nykiel



          • Assignee:
            Tomasz Nykiel
            Tomasz Nykiel
          • Votes:
            0 Vote for this issue
            7 Start watching this issue


            • Created: