Client Side Performance Tracking
Client Side Performance Tracking
Client Statistics
Herve Roggero http://www.herveroggero.com [email protected]
Topics Covered
SqlConnection.StatisticsEnabled
Enabling client side statistics gathering Gather run-time statistics from statements Overview of the various statistics returned by SqlConnection
RetrieveStatistics
Are you waiting a lot on server resources? Network latency? SQL Profiler is not available for SQL Database Are you consuming too many rows? Too many roundtrips?
Enabling Statistics
Open Connection to SQL Server or SQL Database
A connection must be established before enabling statistics Captures time spent on the server, plus the time spent by the provider Returns a collection of KeyValuePair containing the statistics
Call RetrieveStatistics
Enabling statistics has a minor impact on performance; use for troubleshooting only
A Few Statistics
Statistic BytesReceived BytesSent ConnectionTime ExecutionTime IduCount IduRows NetworkServerTime SelectRows ServerRoundTrips Comment Total bytes received from SQL Server/SQL Database Total bytes sent to SQL Server/SQL Database Total connection time since Statistics were enabled Total statement processing time (server and client) Number of Inserts, Deletes and Updates performed Number of rows affected by Inserts, Deletes and Updates Total time data provider waited for database responses Number of rows returned by SELECT statements Number of responses received from the database server