Wait Events - Request Lifecycle

From SQLServerPedia

Jump to: navigation, search

See Also: Main_Page - Monitoring & Tuning - Wait Events


In order to utilize wait event statistics effectively, you should first become familiar with the way SQL Server handles requests (sometimes also referred to as "tasks") to read and write data or execute other types of database related activities.



SQL Server uses schedulers to manage requests that user connections submit. Each scheduler is mapped to a CPU. Only one user connection (or session) can be running per each scheduler. Running status denotes that the session has been supplied the necessary resources and it is not waiting on any additional resource. The request is currently being executed. Runnable status means that the request is waiting on CPU resources; at any given point there might be multiple runnable connections so they're placed in the "runnable" queue. Finally, suspended status indicates that the request is placed in a "waiting" queue. For example, if a connection requests a data page that is currently being modified such data page cannot be retrieved; therefore the connection is placed in the "waiting" queue. Connections placed in the waiting queue could be waiting on different resources, including network, disk, locks, memory and so forth. For each waiting session SQL Server assigns a wait type and tracks the time the session spends in the waiting mode. Once the necessary resource is available, the session is relocated to the runnable queue and continues to wait until a scheduler is available to execute the request. Once the scheduler becomes available, the request is executed.