Identify and Resolve Concurrency Problems Flashcards
What is Live Locking?
Shared locks prevent another process from acquiring exclusive locks (but one process wins, then the next process wins)
What is Deadlocking?
Two processes compete for the same resource
What is Blocking?
The second connection is blocked
How is a deadlock resolved?
One transaction is decided to be the “victim” by the server and is cancelled which opens up the resource.
How can we see where the deadlocks are occurring?
EXEC SP_WHO2
Column BLKBY shows who the process is being blocked by.
What is the System DM view that shows system locking?
sys.dm_tran_locks
What is the system DM that shows what queries a user is running and the wait_type that is occuring?
sys.dm_exec_requests
How do you see history of deadlocking?
Turn on Trace Flags using: DBCC traceon(1204, -1) DBCC traceon(1222, -1)
When do the settings for trace files get turned off?
If you manually run the DBCC command to shut it off or when you reboot the server.
How would you get SQL Server to automatically start up trace files when you reboot?
Go into SQL Server Configuration Manager
Right click the instance and go to Properties and then go to Startup Parameters
In the startup parameter type: -T1204 or -T1222
How do you see the trace log?
Management -> SQL Server Logs
What affects SQL Server Performance?
CPU Memory File I/O Blocking, Deadlocking, Locking Long queries/Stored Procedures
What is the system DM view that shows CPU usage?
sys.dm_os_schedulers
What does Current_Workers_count mean in sys.dm_os_schedulers?
The number of workers associated with each scheduler.
What does Work_Queue_count mean in sys.dm_os_schedulers?
the number of tasks waiting to be run. A high number here means that the disk is being overworked.