[英]For this scenario, why is SQL Azure Database Performance Difference so much on Web and New Premium Editions
We are migrating an website to SQL Azure and found a scenario where there is a very significant performance difference between our current hosting and azure database. 我们正在将网站迁移到SQL Azure,并发现我们当前的托管和azure数据库之间存在非常显着的性能差异的场景。
To be clear, the stored procedure code is written poorly and can be fixed but what I would like to understand is the reasons behind the performance difference. 需要说明的是,存储过程代码写得很差并且可以修复,但我想了解的是性能差异背后的原因。
Here is the offending code inside the procedure that is causing the problem 以下是导致问题的过程中的违规代码
declare @curPinNumber int
set @curPinNumber = 183843692
declare @pinNumber int
set @pinNumber = 0
while @pinNumber < 10000
begin
set @curPinNumber = @curPinNumber + 1
insert into PinNumbers(pinNumber, pinNumberText, whenLastUsed, siteID)
values(@curPinNumber, right('0000' + cast(@pinNumber as varchar), 4), '1970-01-01', 999)
set @pinNumber = @pinNumber + 1
end
Here are the test results for the procedure 以下是该程序的测试结果
*The two vm's below have seperate log and data disks. *下面的两个虚拟机具有单独的日志和数据磁盘。
So my assumption here was a key factor is the logging and log flushes that are taking place, possibly the write ahead transaction logging http://msdn.microsoft.com/en-us/library/ms186259.aspx 所以我的假设是一个关键因素是正在发生的日志记录和日志刷新,可能是写入事务日志记录http://msdn.microsoft.com/en-us/library/ms186259.aspx
Adding a BEGIN / COMMIT TRAN
block or joining from an existing preset table with 10,000 rows indeed gets the performance back to 1-2 seconds on the web edition of sql azure, and even faster on my local machine. 添加BEGIN / COMMIT TRAN
块或从具有10,000行的现有预设表加入确实可以在sql azure的web版本上恢复1-2秒的性能,甚至在本地计算机上更快。
I would have expected Azure to be in a similar performance zone to my desktop or old hosting 我原本期望Azure与我的桌面或旧主机处于类似的性能区域
My question is why on Azure is the difference so magnified? 我的问题是为什么Azure上的差异如此放大? I'm trying to judge if this just a corner case that we happened to pick up during testing and most importantly what things we should look out for in our migration. 我试图判断这是否只是我们在测试过程中遇到的一个极端情况,最重要的是我们应该在迁移过程中注意什么。
This is most likely because of communication between the machine where you issue the batch from and the database service. 这很可能是因为您发出批处理的计算机与数据库服务之间的通信。 Try and issue SET NOCOUNT ON first in the batch to turn off sending rows affected notifications back to the client. 尝试在批处理中首先发出SET NOCOUNT ON,以关闭将受影响的通知发送回客户端。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.