hadoop-common-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raghu Angadi <rang...@yahoo-inc.com>
Subject Cost of debug statements.
Date Thu, 29 Mar 2007 18:00:04 GMT

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.

Mime
View raw message