ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leon Liu <ljw2...@alibaba-inc.com>
Subject about bean with no GET method performance
Date Tue, 18 Mar 2008 16:32:21 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<body bgcolor="#ffffff" text="#000000">
Hi ,<br>
&nbsp;&nbsp; These days I test ibatis&nbsp; performance with large result set
large bean. I do following step,<br>
&nbsp;&nbsp; 1.&nbsp; A bean have&nbsp; 84 properties&nbsp; and a tabble
have 84 columns.<br>
&nbsp;&nbsp; 2. and I set enhencmentEnable=true,&nbsp; <br>
&nbsp;&nbsp; 3. I query 10000 result from oracle database. Oracle database with
JDBC driver set&nbsp; defaultRowFetch=50. <br>
&nbsp; Above calling take about 1700ms -1800ms. JDBC query take about 200ms.<br>
&nbsp; But&nbsp; when I check my bean code, I found there is a property with no
get method, so I add the property's Getter Method.&nbsp; <br>
&nbsp; Then I get a surprised, The query formance got a great improvement.&nbsp;
It is take about 1200ms-1300ms.&nbsp; <br>
&nbsp; I debug ibatis code, I find follwing code may cause&nbsp; big performance:<br>
&nbsp; com.ibatis.sqlmap.engine.accessplan.AccessPlanFactory Line 60<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#3333ff"> if (bytecodeEnhancementEnabled)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try {<br>
plan = new EnhancedPropertyAccessPlan(clazz, propertyNames);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } catch (Throwable
t) {<br>
try {<br>
plan = new PropertyAccessPlan(clazz, propertyNames);<br>
} catch (Throwable t2) {<br>
plan = new ComplexAccessPlan(clazz, propertyNames);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <br>
</font>com.ibatis.common.beans.ClassInfo Line256<font color="#3333ff"><br>
&nbsp;public Method getGetter(String propertyName) {<br>
&nbsp;&nbsp;&nbsp; Method method = (Method) getMethods.get(propertyName);<br>
&nbsp;&nbsp;&nbsp; if (method == null) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw new ProbeException("There is no READABLE
property named '"
+ propertyName + "' in class '" + className + "'");<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; return method;<br>
&nbsp; }<br>
class EnhancedPropertyAccessPlan/PropertyAccessPlan&nbsp; call
com.ibatis.common.beans.ClassInfo.getGetter(String) that&nbsp; cause an
exception&nbsp; when a bean have no Getter method, AccessPlan object choose
&nbsp;I think ComplexAccessPlan cause the performance problem.<br>
&nbsp;IBtatis automatic decide a simple bean that property have no Getter
method to be&nbsp; Complex type.&nbsp; IBatis does not prompt any warning&nbsp;
enhancementEnable option will be skipped. I think these ibatis
exception handling is not smooth.&nbsp; and If user's bean loose some Getter
method,&nbsp; a common user does not know why&nbsp; ibatis performance become bad.<br>
Leon Liu<br>
<font color="#3333ff"><br>
</font>&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; <br>
&nbsp; <br>
&nbsp;&nbsp; <br>

View raw message