I am trying to troubleshoot a blocking issue which happens for less than a second.
The OLTP application is very sensitive and has to have an response time of less than 200ms for some transactions as per the agreed SLA.
We had some lock escalation issues with the new code release which we were able to solve with reducing the batch size in the updates.
Even with the small batch size, we suspect that the new sp is blocking the same rows that the OLTP transactions is updating.
I need to find the session that is getting blocked and the resource its waiting on. As per my understanding "blocked process threshold" can set for a minimum of 1 second and so this will not capture the blocking.
I am experimenting with wait_info and wait_completed x events.
Is there any other way we could track this. Thanks
Best Answer
As you are specifically interested in locking rather than general waits the
locks_lock_waits
extended event sounds more suitable.With a filter on
increment >= 200
The above gathers the statements waiting on locks for the threshold amount of time but doesn't give the specific lock resource.
I have never used this event and have no insight into how much overhead this session would cause on your production server.
I found this video on the topic. That does strongly recommend filtering on
counter
to reduce the number of events collected and I have done so above.It also mentions an old legacy undocumented command
Which (if trace flag 3605 is enabled) dumps out limited information such as the below to the SQL Server error log.
I just mention this in passing as extended events would be clearly preferable anyway as it is documented and much more powerful.