How to avoid database locks

I have a clustered application that suffers from database locks.

This is a j2ee application using JPA and sleep mode. The DB2 8.1 database on Z / OS is set to page lock (this is a requirement for the company).

The problem is that the primary key is generated as a sequence and will often be blocked when trying to insert records if the system has a significant load.

Are there any “best practices” to reduce the likelihood of a dead end?

+4
source share
1 answer

"Are there any" best practices "to reduce the likelihood of a dead end?"

Deadlock means 2 (or more) processes, 2 (or more) resources and two different access orders.

Process 1 should get A and B.

Process 2 should get B and wait for A.

If each process first gets A, the deadlock frequency decreases.

Since you are at a dead end on the whole page, it’s hard to make sure everyone gets the same page to start their transaction.

You can try to reduce conflicts by making sure that the lines are widely scrambled between pages.

You can try to reduce conflicts by entering the line "You must get this first", which will be effectively single-threaded applications.

+6
source

Source: https://habr.com/ru/post/1299762/


All Articles