Presentation is loading. Please wait.

Presentation is loading. Please wait.

Using Correlated Tracing to Diagnose Query Level Performance What’s slowing down my app? Jerome Halmans Senior Software Development Engineer Microsoft.

Similar presentations


Presentation on theme: "Using Correlated Tracing to Diagnose Query Level Performance What’s slowing down my app? Jerome Halmans Senior Software Development Engineer Microsoft."— Presentation transcript:

1 Using Correlated Tracing to Diagnose Query Level Performance What’s slowing down my app? Jerome Halmans Senior Software Development Engineer Microsoft

2 Opcode: Begin Exploring the problem space Connection and Batch identifiers Use connection identifiers to find performance problems during login Locate server activity corresponding to client activity Use wait information to find concurrency issues

3 Problem Space –Performance problems are typically reported by app users –App performance problems involve at least 2 tiers Client Server –The problem is finding the queries most important to a particular piece of app functionality and then finding why it is slow –No direct methods to tie app functionality to queries on the server

4 (A few) Sources of Performance Problems Client App code Drivers Network SQL Server Query Plan Blocking CPU Memory Disk Network

5 Help in finding where to start Client App code Drivers Network SQL Server Query Plan Blocking CPU Memory Disk Network Trace Connection Id Activity Id Diagnostics

6 Connection Id and Activity Id Explained –Connection Id A single Guid Created by the client Assigned at connection open time Sent to the server at pre-login Bound to the lifetime of the physical connection –Activity Id Tuple of guid, sequence number Maintained per thread Sent at pre-login and with each batch or rpc request Used to track cross thread transfers and maintain ordering –Both are new provisions to the TDS protocol and require new drivers/providers

7 Login Process Open Socket/Pipe Basic connection Connid Assigned New physical connection gets a unique id Prelogin Connection id and activity id sent Send Login Packet Authentication information sent Server Login Process Server assigns thread to process login, authenticates credentials and enters requested database

8 Using ConnectionId to troubleshoot connection failures Open Socket/Pipe No entry in client trace Connid Assigned Cannot fail Prelogin Connection id and activity id present in client trace, present in server extended events trace Send Login Packet Client trace contains entries pertaining to login Server Login Process Server extended events log will report numerous events with matching client_connection_id

9 Demo: Using Client Diagnostics and server traces to resolve login failure

10 Activity Id Usage for Causality Tracking Process 1 Event A: 1.1 P: NULL Process 2 Event A: 2.1 P: 1.2 Event A: 1.2 P: NULL Event A: 2.2 P: NULL Event A: 1.3 P: NULL Event A: 1.4 P: NULL Event A: 1.5 P: NULL Event A: 1.6 P: NULL Event A: 2.3 P: NULL Event A: 2.4 P: NULL Event A: 2.5 P: NULL Process 1 requests work on new thread.

11 Demo: Using Client and server traces to resolve application performance problem

12 Analyzing waits within a query –At a high level a query can be in 2 states Working Waiting –Working means the query is actively producing data –Waiting means the query has stopped to wait for a resource (Disk, Memory, Locks, Latches, Scheduler) –Wait time generally accounts for the majority of execution time

13 Demo: Diving into waits

14 Opcode: end Explored Problem Space of client/server performance issues Explained Connection and Batch identifiers Used connection identifiers to find performance problems during login Located server activity corresponding to client activity Used wait information to find concurrency issues

15 Resources Setting up Data Access Trace http://msdn.microsoft.com/en- us/library/cc765421(SQL.100).aspxhttp://msdn.microsoft.com/en- us/library/cc765421(SQL.100).aspx Microsoft SQL Server Code Named “Denali” Data Access Trace http://msdn.microsoft.com/en- us/library/hh213095(SQL.110).aspxhttp://msdn.microsoft.com/en- us/library/hh213095(SQL.110).aspx

16 THANK YOU! For attending this session and PASS SQLRally Nordic 2011, Stockholm


Download ppt "Using Correlated Tracing to Diagnose Query Level Performance What’s slowing down my app? Jerome Halmans Senior Software Development Engineer Microsoft."

Similar presentations


Ads by Google