Thanks. There is a isDebugEnabled() also. We should convert many of our debug statements into this. I will do as I submit patches.

Raghu.

Dhruba Borthakur wrote:
There are portions code in the Namenode:

if (NameNode.stateChangeLog.isInfoEnabled()) {
   ...
}

-----Original Message-----
From: Raghu Angadi [mailto:[EMAIL PROTECTED] Sent: Thursday, March 29, 2007 11:00 AM
To: [email protected]
Subject: Cost of debug statements.


Is there a way to test to if debug is enabled before invoking a statement like :

NameNode.stateChangeLog.debug(
                         "BLOCK* NameSystem.UnderReplicationBlock.add:"
                       + block.getBlockName()
                       + " has only "+curReplicas
                       + " replicas and need " + expectedReplicas
                       + " replicas so is added to neededReplications"
                       + " at priority level " + priLevel );

It looks like we pay the cost of constructing the string for this call all the time. This seems to involve multiple allocations and deallocations, int to string conversions, and string concatenations etc. Since there are multiple such statements in various critical code paths on namenode, it could affect quite a bit of performance. Should we have something like :

if ( debugEnabled ) {
   NameNode.stateChangeLog.debug( ...
}

Raghu.


Reply via email to