I have a Windows Azure role that consists of two instances. Once in a while a transaction will fail with an SqlException
with the following text
Transaction (Process ID N) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
Now I've Googled for a while and read this post about identifying deadlocks using SQL Server logs.
The problem is...
How do I do it in SQL Azure? What tools do I use to access the internals of SQL Azure and getting enough data?
Now Azure SQL database supports two ways to get deadlock xml reports. You can create a db-scoped XE session with the database_xml_deadlock_report event to track them yourself, or you can modify the sys.fn_xe_telemetry_blob_target_read_file call from the earlier answer to use 'dl' instead of 'el'. Deadlocks are now routed to their own file instead of being mixed in with login events.
This MSDN article has the latest information.
Run the following query on "Master" database in SQL Azure db,
There was a performance issue with this query, if it gets timed out try following,
Second query has data in XML format relating to the processes being executed. Good luck!
Monitoring of SQL Azure is more limited than SQL Server, but the tools are becoming more available for you to look underneath:
http://social.technet.microsoft.com/wiki/contents/articles/troubleshoot-and-optimize-queries-with-sql-azure.aspx