title: Poor performance with sql server on azure vm when I write a lot of data to disk
body: <p>I need to move an existing application to windows azure VMs. This application write a lot of data (insert into) to DB.</p>
  
  <p>So, I created a SQL Server machine on Azure VM, and configured the environment according the Microsoft best practice for SQL Server on azure VM (<a href="http://msdn.microsoft.com/en-us/library/azure/dn133149.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/azure/dn133149.aspx</a>).</p>
  
  <p>I tested this SQL query on my computer and on my SQL Server on azure VM:</p>
  
  <pre><code>WHILE @i &lt;= 100000 BEGIN
  INSERT INTO sales (id, created) VALUES (@i, GETDATE());
  SET @i = @i + 1;
  END
  </code></pre>
  
  <p>When I run this query on my machine, its finished after 43 seconds.
  When I run this query on the azure VM its take over 10 minutes!!! (I try this with single disk and striped with 2 and 4 disks).</p>
  
  <p>I try to test more scenario code, with transaction:</p>
  
  <pre><code>WHILE @i &lt;= 100000 BEGIN
  
  -- Start a transaction
  IF @i % 10000 = 1 
     BEGIN TRANSACTION;
  
   INSERT INTO sales (id) VALUES (@i);
   SET @i = @i + 1;
  
  -- Commit after each 10,000 row
  IF @i % 10000 = 0
    COMMIT;
  END
  </code></pre>
  
  <p>this scenario works OK on both environments (my pc &amp; azure VM).</p>
  
  <p>When I ran SQLIO on the sql azure VM server, I got results that fit to the second query results (with transaction).</p>
  
  <p>My application must run without transactions.</p>
  
  <p>Anybody know how to resolve that?
  Thank you.</p>