argh ... deadlock
just when we were starting to feel really good about our chances of delivering a working and performant system, i get an email from the stress test guy of our client saying our transactions are causing table locks left and right.
what the .....
now i don't remember any process that involved locking tables or anything close to that. no one in the team has any knowledge of that either.
whipped out jmeter and started running some long running tests to try to pop the sucker out. the script was simple:
- login
- create a record
- save the record
- delete the record
- logout
after 3 minutes of continuously running the script, we were able to replicate the bugger.
%#$%, something was locking the tables.
after a lot of frantic google and hibernate forum searching, we come across this:
http://www.archaebacteria.net/?p=21
and got this from my boss:
http://www.mail-archive.com/hibernate-devel@lists.sourceforge.net/msg05495.html
in a nutshell, from lukas barton's blog:
If an index exists on the foreign key column of the child table, no DML locks, other than a lock over the rows being modified, are required.
If the index is not created, a share lock is taken out on the child table for the duration of the transaction.
woopeedoo. created the indices, deployed update @ client, resumed testing ...
... so far so good.