Ok, I will test 5 properties bean to validate if the performance issue
will happen.
I think ibatis is pretty on performance, We use it on our site, every
day, our page hit more than 110 m times, IBatis do all these very
pretty:)
Some tables in our site have than 80 column, and were queried millions
of times every hour. So, performance is very critical for me .
Every SQL request handle quickly will get less waiting connection and
more user expierence.
Query 10000 results are only my test case, In product env , We fetch
data 20-50 results every query .
We have more than 200 sql map files, So I can not change any to my
product system. Improve performance only by tuning sql, modify some
bean model.
Leon Liu
Clinton Begin 写道:
Above calling take about 1700ms -1800ms. JDBC query take about 200ms.
Does your JDBC example include creating all of the classes and setting
all of the properties? Calling resultSet.getXxxxx() and setting
properties 840,000 times in 1.8 seconds actually sounds pretty good.
I hate to discourage you from using iBATIS, but honestly if you're
worried about a 500ms difference in performance of a query of nearly
1,000,000 values, you might be better off without iBATIS. :-/
Clinton
On Tue, Mar 18, 2008 at 10:32 AM, Leon Liu <[EMAIL PROTECTED]> wrote:
Hi ,
These days I test ibatis performance with large result set and large
bean. I do following step,
1. A bean have 84 properties and a tabble have 84 columns.
2. and I set enhencmentEnable=true,
3. I query 10000 result from oracle database. Oracle database with JDBC
driver set defaultRowFetch=50.
Above calling take about 1700ms -1800ms. JDBC query take about 200ms.
But when I check my bean code, I found there is a property with no get
method, so I add the property's Getter Method.
Then I get a surprised, The query formance got a great improvement. It
is take about 1200ms-1300ms.
I debug ibatis code, I find follwing code may cause big performance:
com.ibatis.sqlmap.engine.accessplan.AccessPlanFactory Line 60
if (bytecodeEnhancementEnabled) {
try {
plan = new EnhancedPropertyAccessPlan(clazz, propertyNames);
} catch (Throwable t) {
try {
plan = new PropertyAccessPlan(clazz, propertyNames);
} catch (Throwable t2) {
plan = new ComplexAccessPlan(clazz, propertyNames);
}
}
}
com.ibatis.common.beans.ClassInfo Line256
public Method getGetter(String propertyName) {
Method method = (Method) getMethods.get(propertyName);
if (method == null) {
throw new ProbeException("There is no READABLE property named '" +
propertyName + "' in class '" + className + "'");
}
return method;
}
class EnhancedPropertyAccessPlan/PropertyAccessPlan call
com.ibatis.common.beans.ClassInfo.getGetter(String) that cause an exception
when a bean have no Getter method, AccessPlan object choose
ComplexAccessPlan.
I think ComplexAccessPlan cause the performance problem.
IBtatis automatic decide a simple bean that property have no Getter method
to be Complex type. IBatis does not prompt any warning enhancementEnable
option will be skipped. I think these ibatis exception handling is not
smooth. and If user's bean loose some Getter method, a common user does
not know why ibatis performance become bad.
BR
Leon Liu
|