ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Clinton Begin" <clinton.be...@gmail.com>
Subject RE: How does RowHandler help performance?
Date Thu, 31 Jan 2008 20:01:29 GMT
Row handlers are not necessarily faster... they just use less memory.  Thus,
if you count the time to resize arrays, grow the heap and possibly garbage
collect, they will be faster for indirect reasons.  

 

Internally, by default, iBATIS uses a RowHandler that simply gathers up all
of the result objects and adds them to a list to be returned (it actually
uses it even for a single queryForObject as well).

 

So if you write your own RowHandler implementation, it's possible to process
row-by-row... 

 

That's a pretty rare thing to do in most transactional and/or web based
systems.  It's more for batch processing of lots of rows.

 

One example of where I used a row handler was for an integration task
between a MySQL database and a SQL Server... ETL of sorts.  The RowHandler
would read from MySQL, transform the record, perform some simple
calculations, and batch inserts into SQL Server.  On my test machine running
both databases (3GHz 2GB RAM 2x10k HDD), I was able to achieve throughput of
15,000 records per second on millions of rows.

 

So they CAN be fast.  They aren't just fast by default, and they're not for
every situation.

 

Clinton

 

From: Hugh Ross [mailto:hh4ross@gmail.com] 
Sent: January-31-08 12:39 PM
To: user-java@ibatis.apache.org
Subject: How does RowHandler help performance?

 

 

I've looked at the docs (In Action book, Developer Guide 2.0, and wiki), and
somehow I've missed this.

 

I have seen threads in the user-java Mail Archive saying that it can, but
I'm not clear on how.

 

Thanks...

 

P.S.  Actually, I believe only the Dev Guide mentions RowHandler
specifically, and there only briefly.


Mime
View raw message