Return-Path: X-Original-To: apmail-hadoop-hdfs-issues-archive@minotaur.apache.org Delivered-To: apmail-hadoop-hdfs-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DC4E211EB2 for ; Tue, 9 Sep 2014 10:43:35 +0000 (UTC) Received: (qmail 1311 invoked by uid 500); 9 Sep 2014 10:43:30 -0000 Delivered-To: apmail-hadoop-hdfs-issues-archive@hadoop.apache.org Received: (qmail 1266 invoked by uid 500); 9 Sep 2014 10:43:30 -0000 Mailing-List: contact hdfs-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hdfs-issues@hadoop.apache.org Delivered-To: mailing list hdfs-issues@hadoop.apache.org Received: (qmail 1236 invoked by uid 99); 9 Sep 2014 10:43:30 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Sep 2014 10:43:30 +0000 Date: Tue, 9 Sep 2014 10:43:30 +0000 (UTC) From: "Yongjun Zhang (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HDFS-6621) Hadoop Balancer prematurely exits iterations MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HDFS-6621?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14126848#comment-14126848 ] Yongjun Zhang commented on HDFS-6621: ------------------------------------- Hi [~ravwojdyla], Thanks for earlier discussion. Would you please providing a patch for problem 1 alone here as soon as possible? and then file a separate jira for problem 2 and we continue the discussion from there? thanks a lot. BTW, if you had luck reproducing the issue, I'd love to hear. Hi [~andrew.wang], thanks for your earlier review. I think it would be a good idea to commit the problem 1 fix first. Need your help to review and commit problem 1 fix once Rafal uploads it. The credit of problem 1 fix should go to both [~bbowman410] and [~ravwojdyla]. Thanks Benjamin for filing this jira, and thanks both of them for the fix. > Hadoop Balancer prematurely exits iterations > -------------------------------------------- > > Key: HDFS-6621 > URL: https://issues.apache.org/jira/browse/HDFS-6621 > Project: Hadoop HDFS > Issue Type: Bug > Components: balancer > Affects Versions: 2.2.0, 2.4.0 > Environment: Red Hat Enterprise Linux Server release 5.8 with Hadoop 2.4.0 > Reporter: Benjamin Bowman > Labels: balancer > Attachments: HDFS-6621.patch, HDFS-6621.patch_2, HDFS-6621.patch_3, HDFS-6621.patch_4 > > > I have been having an issue with the balancing being too slow. The issue was not with the speed with which blocks were moved, but rather the balancer would prematurely exit out of it's balancing iterations. It would move ~10 blocks or 100 MB then exit the current iteration (in which it said it was planning on moving about 10 GB). > I looked in the Balancer.java code and believe I found and solved the issue. In the dispatchBlocks() function there is a variable, "noPendingBlockIteration", which counts the number of iterations in which a pending block to move cannot be found. Once this number gets to 5, the balancer exits the overall balancing iteration. I believe the desired functionality is 5 consecutive no pending block iterations - however this variable is never reset to 0 upon block moves. So once this number reaches 5 - even if there have been thousands of blocks moved in between these no pending block iterations - the overall balancing iteration will prematurely end. > The fix I applied was to set noPendingBlockIteration = 0 when a pending block is found and scheduled. In this way, my iterations do not prematurely exit unless there is 5 consecutive no pending block iterations. Below is a copy of my dispatchBlocks() function with the change I made. > {code} > private void dispatchBlocks() { > long startTime = Time.now(); > long scheduledSize = getScheduledSize(); > this.blocksToReceive = 2*scheduledSize; > boolean isTimeUp = false; > int noPendingBlockIteration = 0; > while(!isTimeUp && getScheduledSize()>0 && > (!srcBlockList.isEmpty() || blocksToReceive>0)) { > PendingBlockMove pendingBlock = chooseNextBlockToMove(); > if (pendingBlock != null) { > noPendingBlockIteration = 0; > // move the block > pendingBlock.scheduleBlockMove(); > continue; > } > /* Since we can not schedule any block to move, > * filter any moved blocks from the source block list and > * check if we should fetch more blocks from the namenode > */ > filterMovedBlocks(); // filter already moved blocks > if (shouldFetchMoreBlocks()) { > // fetch new blocks > try { > blocksToReceive -= getBlockList(); > continue; > } catch (IOException e) { > LOG.warn("Exception while getting block list", e); > return; > } > } else { > // source node cannot find a pendingBlockToMove, iteration +1 > noPendingBlockIteration++; > // in case no blocks can be moved for source node's task, > // jump out of while-loop after 5 iterations. > if (noPendingBlockIteration >= MAX_NO_PENDING_BLOCK_ITERATIONS) { > setScheduledSize(0); > } > } > // check if time is up or not > if (Time.now()-startTime > MAX_ITERATION_TIME) { > isTimeUp = true; > continue; > } > /* Now we can not schedule any block to move and there are > * no new blocks added to the source block list, so we wait. > */ > try { > synchronized(Balancer.this) { > Balancer.this.wait(1000); // wait for targets/sources to be idle > } > } catch (InterruptedException ignored) { > } > } > } > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)