简体   繁体   English

对于这种情况,为什么SQL Azure数据库性能在Web和新的高级版上差别如此之大

[英]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 以下是该程序的测试结果

azure sql database web edition azure sql数据库网页版

  • run #1: 41 seconds 跑#1:41秒
  • run #2: 37 seconds 跑#2:37秒
  • run #3: 37 seconds 跑#3:37秒

standard edition s1 (15 DTU's - MS have since made S1 20 DTU's) 标准版s1(15 DTU - MS已经制作了S1 20 DTU)

  • run #1: 3 minutes, 44 seconds 跑#1:3分44秒
  • run #2: 3 minutes, 41 seconds 跑#2:3分41秒
  • run #3: 3 minutes, 42 seconds 跑#3:3分42秒

standard edition s2 50 DTU's (not a mistake - all were very consistent) 标准版s2 50 DTU(不是错误 - 都非常一致)

  • run #1: 1 minute, 51 seconds 跑#1:1分51秒
  • run #2: 1 minute, 51 seconds 跑#2:1分51秒
  • run #3: 1 minute, 51 seconds 跑#3:1分51秒

premium edition P1 (100 DTU's) 高级版P1(100 DTU)

  • run #1: 56 seconds 跑#1:56秒
  • run #2: 55 seconds 跑#2:55秒
  • run #3: 55 seconds 跑#3:55秒

premium edition P2 (200 DTU's) 高级版P2(200 DTU)

  • run #1: 33 seconds 跑#1:33秒
  • run #2: 33 seconds 跑#2:33秒
  • run #3: 34 seconds 跑#3:34秒

*The two vm's below have seperate log and data disks. *下面的两个虚拟机具有单独的日志和数据磁盘。

sql on a virtual machine (basic, 1 core, 1.75gb ram. sql enterprise core edn) 虚拟机上的sql(基本的,1核,1.75gb ram.sql enterprise core edn)

  • run #1: 53 seconds 跑#1:53秒
  • run #2: 50 seconds 跑#2:50秒
  • run #3: 51 seconds 跑#3:51秒

sql on a virtual machine (basic, 2 core, 3.5gb ram. sql enterprise core edn) 虚拟机上的sql(基本的,2核,3.5gb ram.sql enterprise core edn)

  • run #1: 49 seconds 跑#1:49秒
  • run #2: 50 seconds 跑#2:50秒
  • run #3: 51 seconds 跑#3:51秒

my desktop pc 我的台式电脑

  • run #1: 3.7 seconds 跑#1:3.7秒
  • run #2: 3.1 seconds 跑#2:3.1秒
  • run #3: 3.1 seconds 跑#3:3.1秒

current hosting (which has 7 year old equipment) 目前的托管(已有7年历史的设备)

  • run #1: 6.1 seconds 跑#1:6.1秒
  • run #2: 6.0 seconds 跑#2:6.0秒
  • run #3: 6.0 seconds 跑#3:6.0秒

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.

相关问题 SQL Azure高级性能 - SQL Azure premium performance 新服务层(基本,标准和高级)上的Azure SQL数据库计费 - Azure SQL Database Billing on new service tiers (Basic,Standard,and Premium) 为什么在 SQL Azure 上运行查询的速度如此之慢? - Why is running a query on SQL Azure so much slower? 为什么Azure SQL数据库那么贵? - Why is Azure SQL database so expensive? 当现有索引包含新索引中的所有列时,为什么创建此新索引可以提高性能? - Why did creating this new index improve performance so much when existing index included all columns in new index? 为什么我的SELECT查询在Web服务器上运行比在数据库本身上花费更长的时间? - Why does my SELECT query take so much longer to run on the web server than on the database itself? 为什么 &#39; in &#39; 比 SQL Select 中的 &#39;=&#39; 快得多? - Why ' in ' is so much faster than ' = ' in SQL Select? SQL Azure - 导出和导入到另一个数据库时,为什么数据库大小要小得多 - SQL Azure - Why is database size is much smaller when export and import to another database 为什么这个LINQ比它的SQL慢得多? - Why is this LINQ so much slower than its SQL counterpart? 为什么我的嵌套查询会使SQL Server减慢这么多? - Why does my nested query slow the SQL server so much?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM