How to resolve deadlocks besides using retry?
783445Jul 7 2010 — edited Jul 8 2010We have a case to load 100 documents to the BDBXml containers, and we plan to use multi-threads.
Two tests were issued:
1) The 100 documents will be loaded to one container.
5 threads were spawned. While in one thread, the document was being loaded, in the other threads, the loading operations were blocked(DB_LOCK_DEADLOCK exception was thrown). So we introduce the retry strategy. Basically we did 20 times retry every 0.25 seconds.
Unfortunately, even we used up all the retries, there were still many loading operation failed.
2)The 100 document will be loaded to 100 containers.
5 threads were spawned. We didn't meet the deadlock issue. All the loading operation succeeded.
We prefer to using one container for all the 100 documents, but we could not resolve the deadlock issue even we use the retry.
Is there any other way to resolve this issue?