Blocking detector


Job details

Name: Blocking detector
Platform: Sqlserver
Category: Performance
Description: Checks whether there exists blocked session.
Long description:
Version: 1.2
Default schedule: 0,5,10,15,20,25,30,35,40,45,50,55 7-17 * *
Requires engine install: Yes
Compatibility tag: .[type=‘instance’ & databasetype=‘sqlserver’]/instance[maj_version < ‘2012′ & hasengine=‘YES’ & engine_edition = ‘Microsoft SQL Server’]

Parameters

Name Default value Description
warning threshold 5 The maximum number of minutes a session can be blocked before a warning is triggered.

Job Summary

SELECT spid, blocked, waittype, waittime, dbname = DB_NAME(dbid), loginame   
FROM master.dbo.sysprocesses 
WHERE blocked != 0

Deployment Details

This monitoring job targets SQL Server instances of specific older versions (below SQL Server 2012), which might require more frequent checks due to lack of advanced deadlock resolution in earlier SQL Server versions.

Technical Implementation

The primary stored procedure used by this job, dbw_blocker_check, implements a blocking detection mechanism where:

Tables and Dependencies

The job uses several system tables and custom procedures, including:

Object Name Type Description
dbw_blocker_check Stored Procedure Main logic for the blocking detection
sysprocesses System Table Contains information about current processes and their state
syslockinfo System Table Contains information about locks, including owner and object
sysdatabases System Table Contains information about databases, referenced to obtain database names

This information is crucial as these elements work together to ascertain which sessions are blocked and need immediate attention.

Reports and Presentation

The job generates several reports and visual presentations, such as:

Overall, this monitoring job is pivotal for maintaining high performance in legacy SQL Server environments by timely addressing the blocking issues in database sessions.