I have an application that queries a table, reads each row, does some processing, writes the formatted row to a JMS Q and then updates some columns of the row. The writing to the Q and row updates have to happen in a transaction. I commit after every 50 transactions.
Using Hibernate 2.0, I am getting a performance of 3 records processed per second. This is when the query returns 1000 rows. If I make 200 queries such that only 50 rows are returned at a time, the performance doubles.
What is going on here? Does Hibernate cache all rows when the query is executed. I am using "session.iterate()". Is it filling up the cache? (each row is huge). Is that why selecting in small batches runs fatser?
If I evict() each object as it is updated, will it help? Will the data get saved if I evict() the object before calling commit()?
Any performance improvement pointers will help!
Vaishali
P.S. I know the time is in the Hibernate calls because I ran this app with the profiler turned on.
|