Hi

Just wanted to share some impression on iBatis 2.x vs. iBatis 3.x performance.

Creating SqlSession appears to be very expensive vs. creating sqlMapClient. My 
application creates a SqlMapClient for each statement I run (inefficient I 
know, but I am accessing lots of tables spread across lots of databases, 
creating them when I need them saves me from having to manage lots of instances 
of SqlMapClient, across threads, etc...)

To test if I could speed things up I put in some code to store SqlSession() in 
a hash table (keyed by host/database/user/password/thread ID so that 
sqlSessions are not shared across threads) and performance is a lot better. In 
fact if a thread only runs selects, things are faster by a factor of 3 (nice !) 
On the other hand once inserts/updates/deletes occur, things are slower by a 
factor of 1.5 (which I can live with).

I did run into some issues with connection pooling. Creating a SqlSession() 
checks out a connection from the pool (I presume) and from what I can tell it 
does not check it back in until you close the session, so there is room for 
connections to timeout if I save them in a hash. With C3P0 I would get a 
"CommunicationsException: Communications link failure" when I used a connection 
which had timed out. On the other hand the built-in POOLED data source did not 
have this issue. I was not able to reliably get around this issue in C3P0 
either by extending the timeout at the server end, or by setting up a ping 
query. Maybe one way to deal with this would be to check-out a connection from 
the pool at the start of a transaction and check it back in at the end of the 
transaction.


Cheers

François

-- 
François Schiettecatte
35 Washington Square North, #2
Salem, MA, 01970
617-909-2504
http://fschiettecatte.wordpress.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org

Reply via email to