Is blocking to handle concurrency a good idea?

To deal with the concurrency problem, is locking - any form of locking, be it a row, table, or database, blocking a good solution?

If not, how to handle the concurrency problem?

+5
source share
6 answers

If you believe Oracle, no, not at all. This is because Oracle has tried to avoid this.

The problem is that readers can block writers and writers blocking readers, and the writer has to wait until all readers finish the line before it can write. This delays the recording process and its caller. Exceptional locks (for writing) are held until the end of the transaction, in case the transaction should be discarded - this stops other transactions, seeing a new value until the transaction is completed.

In practice, locking is usually fine, if not too many conflicts, as with any parallel programming. If there are too many conflicts for the row / page / table (not many database servers block the whole database), this will lead to the fact that transactions will be executed sequentially, and not simultaneously.

Oracle , . , , , . , , , , , ​​ , ; . , , , SELECT FOR FORDATE; , - FOR UPDATE , .

SQL Server 2005 Snapshot, . , , , , - SQL Server WITH (UPDLOCK).

- . , , , , , , . , , , - . , , , . , ; , ( , , ).

, , , - , , , , .

+8

. . , , . / .

+2

, , "" . concurrency, - , concurrency "".

concurrency Java: http://java.sun.com/docs/books/tutorial/essential/concurrency/index.html

+1

- - concurrency; concurrency.

+1

, DMBS-. , - ( ..), , , . , . - , . , /, , (Dirty bit pattern) , , . , , , , concurrency, concurrency . , , , , . TopLink Oracle Hibernate, concurrency , , . , . , .

+1

Do you want to handle concurrency in your application or solve the concurrency problem you have with the database. If the first, this does not seem to me a good approach. If the latter, this may be your only answer without re-designing your circuits.

0
source

All Articles