Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect if SQL Azure is throttling

I have an Azure worker role that inserts a batch of records into a table. Yesterday, it took at most 5 minutes to insert the records, but today it has been taking up to a couple of hours. I suspect that the process is being throttled, but I don't get any exceptions. Does SQL Azure always return an error if you are being throttled, or is there another way to detect if you are being throttled?

like image 910
Brian Kohrs Avatar asked Jul 11 '12 16:07

Brian Kohrs


People also ask

How do I check CPU usage on Azure SQL server?

Once you connect to your SQL Server or Azure SQL instance, you can select Reports > Performance Dashboard and see the current and historical values of CPU usage. Here you can find the query texts of the top resource consumers and identify the queries that are causing the CPU issues.

Can we ping Azure SQL server?

The ping command is supposed to give you a timeout because SQL Azure servers never respond to ping requests, but above the timeout replies it tells you the actual IP of your SQL Azure server. Use that IP to telnet your SQL Azure server.

What is SQL throttling?

The throttling is done in order to prevent cascading failures that could occur when the server becomes too busy, thus ensuring some basic service level for all users regardless of the load on the system.

How do I check my data usage on Azure SQL?

On your SQL database Overview page in the Azure portal, select Query editor (preview) from the left menu. On the sign-in screen, provide credentials to connect to the database. You can connect using SQL authentication or Azure AD.


2 Answers

In case of CPU throttling SQL Database will not throw an error but will slowdown the operation. At this time there is no mechanism to determine whether this form of throttling is taking place other than possibly looking at the query stats telling that the work is taking place slowly (if your CPU time is lower than usual). Check this link for details about this behavior: performance and elasticity guid (look for "Performance Thresholds Monitored by Engine Throttling").

like image 97
Herve Roggero Avatar answered Sep 30 '22 14:09

Herve Roggero


One of the newer capabilities is the ability to monitor the number of outstanding requests a SQL Azure database has. You can do this with this query:

select count(*) from sys.dm_exec_requests

As you will see in this documentation reaching the limit of worker threads is a key reason for being throttled. Also documented here is that as you approach 180 worker threads you can expect to be throttled.

This is one of the things used in the Cotega monitoring service for SQL Azure to detect issues. [Disclaimer: I work on this service]

like image 26
Cotega Avatar answered Sep 30 '22 14:09

Cotega