Home
%3CLINGO-SUB%20id%3D%22lingo-sub-767952%22%20slang%3D%22en-US%22%3ELesson%20Learned%20%23104%3A%20Enough%20to%20measure%20CPU%2CDATAIO%20and%20TLOG%20when%20you%20are%20facing%20a%20performance%20issue%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-767952%22%20slang%3D%22en-US%22%3E%3CP%3EToday%2C%20I%20worked%20on%20a%20service%20request%20when%20our%20customer%20reported%20a%20performance%20issue%20for%20their%20Azure%20SQL%20Database.%20However%2C%20the%20CPU%20is%20low%2C%20and%20DATAIO%20and%20TLOG%20are%20not%20more%20than%2020%25%20of%20usage.%20So%2C%20in%20this%20case%2C%20what%20is%20the%20performance%20issue%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EMy%20lesson%20learned%20here%20is%20that%20reviewing%20these%20three%20counters%20are%20not%20enough%20to%20identify%20a%20performance%20issue%2C%20in%20this%20case%2C%20we%20found%20two%20important%20things%20that%20reveal%20the%20performance%20issue%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E1)%20The%20first%20issue%20was%20the%20waiting%20stats%20(select%20*%20from%20sys.dm_os_wait_stats)%3A%26nbsp%3B%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EAs%20you%20know%20every%20operation%20that%20SQL%20Server%20is%20doing%20is%20measure%20using%20waiting%20stats.%20In%20this%20case%20we%20found%20that%20the%20wait%20state%20with%20a%20high%20value%20was%20ASYNC_NETWORK_IO%2C%20that%20reports%2C%20a%20performance%20problem%20in%20any%20of%20these%20ways%3A%3CUL%3E%0A%3CLI%3EThe%20client%20is%20not%20able%20to%20manage%20all%20the%20information%20received%20from%20the%20Azure%20SQL%20DAtabase%2C%20for%20example%2C%20because%20the%20client%20application%20requested%20to%20much%20information%2C%20network%20issue%2C%20older%20driver%2C%20etc..%3C%2FLI%3E%0A%3CLI%3EThe%20server%20is%20very%20busy%20and%20is%20not%20able%20to%20send%20in%20a%20way%20that%20the%20different%20client%20applications%20are%20demanding.%26nbsp%3B%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3CLI%3EIn%20this%20case%20we%20found%3A%3CUL%3E%0A%3CLI%3EThe%20capacity%20of%20this%20Azure%20SQL%20Database%20with%201%20vCore%20was%20not%20enough%20to%20reply%20all%20the%20requests%20performend%20by%20multiple%20clients.%26nbsp%3B%3C%2FLI%3E%0A%3CLI%3EThe%20multiple%20clients%20are%20requesting%20a%20high%20number%20of%20rows%20or%20the%20amount%20of%20data%20is%20high%2C%20because%2C%20we%20saw%20high%20logical%20reads%20in%20the%20different%20queries.%26nbsp%3B%3C%2FLI%3E%0A%3CLI%3ESo%2C%20increasing%20the%20capacity%20of%20the%20server%20to%202%20vCores%20we%20gave%20the%20capacity%20to%20the%20Azure%20SQL%20Database%20to%20have%20more%20workers%20to%20reply%20and%20sent%20the%20data%20to%20the%20client%20applications.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSTRONG%3E2)%20The%20second%20point%20we%20found%20multiple%20timeoutsthat%20the%20client%20application%20dropped%20the%20connection%20after%20several%20time.%26nbsp%3B%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20this%20situation%2C%20as%20I%20mentioned%20in%20a%20previous%20article%2C%20enabling%20the%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fsql-database%2Fsql-database-metrics-diag-logging%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3EDiagnostics%20Setting%3C%2FA%3Efor%20your%20database%20is%20a%20good%20starting%20point%20when%20you%20are%20facing%20these%20types%20of%20issues.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EEnjoy!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-767952%22%20slang%3D%22en-US%22%3E%3CP%3EToday%2C%20I%20worked%20on%20a%20service%20request%20when%20our%20customer%20reported%20a%20performance%20issue%20for%20their%20Azure%20SQL%20Database.%20However%2C%20the%20CPU%20is%20low%2C%20and%20DATAIO%20and%20TLOG%20are%20not%20more%20than%2020%25%20of%20usage.%20So%2C%20in%20this%20case%2C%20what%20is%20the%20performance%20issue%3F%3C%2FP%3E%3C%2FLINGO-TEASER%3E

Today, I worked on a service request when our customer reported a performance issue for their Azure SQL Database. However, the CPU is low, and DATAIO and TLOG are not more than 20% of usage. So, in this case, what is the performance issue?

 

My lesson learned here is that reviewing these three counters are not enough to identify a performance issue, in this case, we found two important things that reveal the performance issue:

 

1) The first issue was the waiting stats (select * from sys.dm_os_wait_stats:( 

 

  • As you know every operation that SQL Server is doing is measure using waiting stats. In this case we found that the wait state with a high value was ASYNC_NETWORK_IO, that reports, a performance problem in any of these ways:
    • The client is not able to manage all the information received from the Azure SQL DAtabase, for example, because the client application requested to much information, network issue, older driver, etc..
    • The server is very busy and is not able to send in a way that the different client applications are demanding. 
  • In this case we found:
    • The capacity of this Azure SQL Database with 1 vCore was not enough to reply all the requests performend by multiple clients. 
    • The multiple clients are requesting a high number of rows or the amount of data is high, because, we saw high logical reads in the different queries. 
    • So, increasing the capacity of the server to 2 vCores we gave the capacity to the Azure SQL Database to have more workers to reply and sent the data to the client applications.

2) The second point we found multiple timeouts that the client application dropped the connection after several time. 

 

In this situation, as I mentioned in a previous article, enabling the Diagnostics Setting for your database is a good starting point when you are facing these types of issues. 

 

Enjoy!