Quote:
We have a application which starts multiple threads. These threads call the same Db2 UDB stored procedure at the same time. The problem is due to locking of Db2 objects the process is running very slow.
|
Why are they locking each other ? Are they trying to update the same record ? or is one of the threads trying to read a record which is being updated ?
In either of the circumstances, I guess you'll have to revisit your application design ..
Or, if the locking is caused by tablescans ? Consider the use of indexes to avoid tablescan ..
Quote:
Right now the isolation level used is default
Certain things that can be taken care to avoid this are:
1. Use of DB2_SQLROUTINE_PREPOPTS for setting isolation at session level
2. Tuning the stored procedure code to avoid locks
|
And, also making sure you are using Type-2 indexes to avoid next key locking or setting DB2_RR_TO_RS to YES.
Quote:
|
One thing which i feel might be a problem is that when we call a SP the SYSPROCEDURE table is read and if the isolation level at the database level is RR, then this might create a lock on the row. When the same procdure is again called from a different thread then this might cause wait state.
|
If my understanding is right, using RR as an isolation level will not impact the 'system level' read of the system catalog tables .. If you are calling a procedure, the row is locked in read-mode ..
Do a lock snapshot and that should show why the waits ...
Cheers
Sathyaram