[jboss-jira] [JBoss JIRA] Created: (JBCACHE-1301) Checking debug level can improve performance under heavy load
Martin Landua (JIRA)
jira-events at lists.jboss.org
Fri Feb 29 11:28:00 EST 2008
Checking debug level can improve performance under heavy load
-------------------------------------------------------------
Key: JBCACHE-1301
URL: http://jira.jboss.com/jira/browse/JBCACHE-1301
Project: JBoss Cache
Issue Type: Quality Risk
Security Level: Public (Everyone can see)
Affects Versions: 1.4.1.SP8
Environment: Any
Reporter: Martin Landua
Assigned To: Manik Surtani
In the source file ActivationInterceptor.java we experienced severe performance downgrade due to the fact that the debug level is not being checked. The two log statements in lines 152 and 156 result in a call to toString() for the DataNode object. Worst case this can create a huge string which is obsolete if debug is turned off in log4j. Since this occurs in a synchronized block, performance slows down in a multithreaded environment.
Please consider the following change (checking for debug level):
synchronized(this) {
if (fqn != null && nodeRemoved)
// If the node is being removed, just remove it and don't perform
// activation processing
loader.remove(fqn);
else if (fqn != null && cache.exists(fqn) && loader.exists(fqn)) {
// Remove the node from the cache loader if it exists in memory,
// its attributes have been initialized, its children have been loaded,
// AND it was found in the cache loader (nodeLoaded = true).
// Then notify the listeners that the node has been activated.
DataNode n = getNode(fqn); // don't load
// node not null and attributes have been loaded?
if (n != null && !n.containsKey(TreeCache.UNINITIALIZED)) {
if (n.hasChildren()) {
if (allInitialized(n)) {
if (log.isDebugEnabled()) log.debug("children all initialized");
remove(fqn);
}
} else if (loaderNoChildren(fqn)) {
if (log.isDebugEnabled()) log.debug("no children " + n);
remove(fqn);
}
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list