View Single Post
  #2 (permalink)  
Old 05-28-03, 13:02
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,473
First, just a refresher of an example of what constitues a deadlock:

ProcessA wants resource1, locks it
ProcessB wants resource2, locks it
ProcessA wants resource2, waits for lock to finish
ProcessB wants resource1, waits for lock --> deadlock

Suggestions:

1) have your processes access (insert,update, delete) tables in the same order. e.g. Always access TableA, then TableB.
2) have shorter Units of Work (UOW) when possible. This prevents locks being held that are no longer needed.
3) specify a small lock wait timeout. Better to timeout on obtaining a lock, then deadlocking.

HTH

Andy
Reply With Quote