The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

SivaMani (1) [Avatar] Offline
This question is regarding locking at the application layer versus locking at the database layer.
I am going to use pessimistic concurrency at the database – which locks a row and doesn’t allow any other transactions on it. I know this is not really scalable. But using optimistic concurrency involves addition of either a timestamp column or checking for concurrency violations when using ADO.Net Dataset. We decided pessimistic would be the way to go, since row locks are going to be minimal and for short time
My question is: Is locking the object on application layer before it does the DB operation better or is locking the row on database better? Which one has better performance?
Any articles to illustrate this?

I would appreciate a good explanation for this comparison.

Thanks in advance.