Volker Malzahn created TRINIDAD-2434:
----------------------------------------
Summary: Usage of Class.getMethod in
TreeRenderer.retrieveGetNodeTypeMethod is a critical performance issue
Key: TRINIDAD-2434
URL: https://issues.apache.org/jira/browse/TRINIDAD-2434
Project: MyFaces Trinidad
Issue Type: Bug
Components: Components, Facelets
Affects Versions: 2.0.1-core
Environment: WebSphere, IBM JRE.
Reporter: Volker Malzahn
Priority: Critical
We have a webapp with SWF 2.3.0, JSF 2.1 and Trinidad 2.0.1 and have done
performance tests in an environment with WebSphere and IBM JRE. When we reached
a number of concurrent users of around 80 we get hot spots in calls of
Class.getMethod. The stack trace contains following Trinidad method which
perform this call often:
org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.TreeRenderer.getNodeType(UIXHierarchy)
Inspecting the source of this method I detected that it calls
rowClass.getMethod("getNodeType") every time it's called - without caching the
method handles reached in previous calls.
After doing a quick fix for this by caching the method handles we have solved
this hot spot:
private final Map<Class<?>, Method> getNodeTypeMethodMap = new
HashMap<Class<?>, Method>();
private Method retrieveGetNodeTypeMethod(Class rowClass) {
try {
synchronized (getNodeTypeMethodMap) {
if (getNodeTypeMethodMap.containsKey(rowClass)) {
return getNodeTypeMethodMap.get(rowClass);
}
Method getNodeTypeMethod = rowClass.getMethod("getNodeType");
getNodeTypeMethodMap.put(rowClass, getNodeTypeMethod);
return getNodeTypeMethod;
}
} catch (Exception e) { return null; }
}
Could you please fix this for the next Trinidad release?
--
This message was sent by Atlassian JIRA
(v6.1.4#6159)