This is a mirror of official site: http://jasper-net.blogspot.com/

Hibernate is faster than I thought it was.

| Sunday, March 7, 2010
I was playing around with a speed test of Gigaspaces XAP, and got some pretty good numbers out of it – but I couldn’t escape the thought that I was missing something. Then I had it: a comparison point!

If GigaSpaces is X, then… it’s X. But if we compare it to something else – a Y, if you will – then we get a better sense of whether it’s actually fast or not.

Timings capture only the time spent in the DAO, as captured by a dynamic proxy. Therefore, a given test might take four minutes, but yield only 60 seconds’ worth of measurements, because none of the non-DAO stuff was measured. The idea was to isolate any testing code away from the actual focus of the speed test, which was: “How fast do read/write/delete operations run under simple transactions, when connecting to external servers?”

The tests are serial – one operation at a time, over and over again. This is way not real-world. I know it, you should know it, if you take these benchmarks as anything other than a “hmm, that’s interesting” data point, a yeti will hunt you down and eat your toes.

So I created a simple 1:M mapping, an Owner to OwnerAttribute model, and created mappings for Hibernate and GigaSpaces. (Same object, just annotated for both GigaSpaces and Hibernate.) The test ran over four basic operations in bulk, using transactions on every operation, based around a common DAO interface.

When I first ran the tests, I was horrified: Hibernate was so freakin’ bleedin’ farglin’ bleepin’ slow SLOW SLOW! Amazingly slow. Horrifyingly slow. I isolated the cause to two reasons: session acquisition and object model. The session acquisition surprised me: I was acquiring one session and using it for all operations, which I thought would be faster.

After all, it takes time to acquire a session, does it not? Boy, was I wrong.

Read more: Enigmastation.com

Posted via email from jasper22's posterous

0 comments: