hadoop-common-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dhruba Borthakur" <dhr...@yahoo-inc.com>
Subject RE: Cost of debug statements.
Date Thu, 29 Mar 2007 18:02:58 GMT
There are portions code in the Namenode:

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

-----Original Message-----
From: Raghu Angadi [mailto:rangadi@yahoo-inc.com] 
Sent: Thursday, March 29, 2007 11:00 AM
To: hadoop-dev@lucene.apache.org
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.


Mime
View raw message