during some performance testing I noticed that flushes to the DB get
slower every time. Basically the time is O(N) with N being the number
of objects created in the session.
I create a lot of objects and do three lookups for each. Explicit
flushes occur every x objects so this behavior was pretty good to
detect. I use the 2nd level cache with pretty high sizes which should
keep a major portion of objects in mem; I also use query caches for my
Some profiling seems to indicate that every time a flush occurs
(either autoFlush due to executing a query or explicit TX commit) all
instances known to the session are visited to check their state.
Now, this makes things really slow for my scenario and I'd like to
check whether there is some kind of setting that I may have overlooked
and which can improve performance for this scenario (which I'm ready
to admit isn't probably the typical OR scenario). Is there maybe a way
to change Hibernate's behavior so that it records state in a way that
it does not need to visit all objects in the session when flushing?
Have a look: http://www.flickr.com/photos/fussel-foto/