Deadlock analysis

If you are doing the stress test and you find some problems during the test, you should check if there are deadlock of the database before you quite the stress test mode. By the way, if you find the performance problem when doing the database related operation, you should also check the deadlock in database.

Take SQL Server database as an example, if you want to check whether there are deadlocks or not, you can use the following way:

  • Execute sp_lock in SQL query analyzer. If you find there are ‘X’ or ‘IX’ of the Mode field, then it means there are deadlocks. You can find out the deadlocks occurred in which tables by the information in Resource field.

  • Execute sp_who spid in SQL query analyzer, then you can find out the host name of spid and commands being executed.