SQL Azure - One session locking entire DB for Update and Insert

浪子不回头ぞ 提交于 2019-12-03 07:08:06

You might be running into the SE_REPL* issues that are currently plaguing a lot of folks using Sql Azure (my company included).

When you experience the timeouts, try checking your wait requests for wait types of:

  • SE_REPL_SLOW_SECONDARY_THROTTLE
  • SE_REPL_COMMIT_ACK

Run the following to check your wait types on current connections:

SELECT TOP 10 r.session_id, r.plan_handle,
r.sql_handle, r.request_id,
r.start_time, r.status,
r.command, r.database_id,
r.user_id, r.wait_type,
r.wait_time, r.last_wait_type,
r.wait_resource, r.total_elapsed_time,
r.cpu_time, r.transaction_isolation_level,
r.row_count
FROM sys.dm_exec_requests r

You can also check a history of sorts for this by running:

SELECT * FROM sys.dm_db_wait_stats
ORDER BY wait_time_ms desc

If you're seeing a lot of SE_REPL* wait types and these are staying set on your connections for any length of time, then basically you're screwed. Microsoft are aware of the problem, but I've had a support ticket open for a week with them now and they're still working on it apparently.

The SE_REPL* waits happen when the Sql Azure replication slaves fall behind. Basically the whole db suspends queries while replication catches up :/

So essentially the aspect that makes Sql Azure highly available is causing databases to become randomly unavailable. I'd laugh at the irony if it wasn't killing us.

Have a look at this thread for details: http://social.technet.microsoft.com/Forums/en-US/ssdsgetstarted/thread/c3003a28-8beb-4860-85b2-03cf6d0312a8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!