views:

76

answers:

1

Hello,

I'm writing an multi-threaded app which will live on two active-active load balanced servers and access a clustered database on another server. Obviously I don't want multiple threads writing to the same records at the same time and SQL provides locking to ensure this doesn't happen. What are the advantages and disadvantages of using mutexes within the application as well even though the active-active configuration means collisions can't be stopped completely?

Thanks, Patrick

A: 

What are the advantages and disadvantages of using mutexes within the application as well even though the active-active configuration means collisions can't be stopped completely?

You seem to wonder whether you can improve performance by reducing the amount of lock waiting in the database, by preferring to wait for locks within the application process. I don't see how that could yield any performance benefits. Waiting is waiting.

Also, if you only use database locking then your design will be simpler: you can think of each thread as a processing node, and you don't need to care whether your processing nodes live in the same process or even on the same machine.

Wim Coenen