Why So Many Azure Storage Transactions?

 

Y U NO Azure StorageRecently, I had a client sign up for a Windows Azure account getting the first 90 days for free. This free account gives you a 1GB SQL Azure Web edition database, 50,000 storage transactions and 750 small compute hours.  This should be plenty for the next couple of months, or so I thought. 

This is a simple application that uses a small SQL Azure database and Blob Storage for uploaded images. After the Azure account was provisioned, I created the Hosted Service, Storage Account, SQL server and the publish Certificate.  Then I updated Visual Studio and deployed the application to Azure. The initial testing went great, uploaded a few images, ran a few queries, no problems at all.

The next morning the site is down. So I logged into the management portal and discovered that the account had been suspended due to exceeding the constraints of the free account.  Well, It’s nice that instead of ending up with a large bill at the end of the month you can set spending limits and have your account suspended when that amount is exceeded. In this case, the spending limit defaulted to $0.00 for the first 90 days. The new Azure billing portal is quite helpful and shows exactly what happened. I exceeded the 50,000 storage transactions limit IN ONE DAY! The only thing I use storage for is uploaded images.  How could I have used that many reads, writes and deletes in one day. Well, it turns out I didn’t.

image

 

Robots.txt

The first issue I noticed was the error log showing that the google and bing bots could not locate the robots.txt file. Of course…it’s a new site and these bots are crawling all over it attempting to index the pages. So I added a robots.txt to prevent image bots from indexing the images.

 

User-agent: Googlebot-Image
Disallow: /

User-agent: MSNBot-Media
Disallow: /

This helped a little but I was still getting 60,000+ storage transactions a day.  So I submitted Windows Azure Incident ticket explaining my problem.

 

Diagnostics

A few hours later I received an email from the Windows Azure Help Desk

 

To: Randy Patterson

Cc: MSSolve Case Email

Subject: RE: Callback:why 100,000 storage transactions a day

Hi Randy

After looking at the logs It looks like WAD logging is enabled in your deployment and this will use at least 25 trx/min

Please check if this is enabled in your deployment. If so you will have to uncheck enable diagnostics to avoid the transactions.

Star Trek double face palmStarting with version 1.6 of the Azure SDK, Diagnostics is enabled by default. According to the email, diagnostics activity will generate a minimum of 36,000 transactions per day! I was experiencing closer to 60,000/day. This will exceed the 50,000 transaction limit in 1-2 days.

To Disable Diagnostics: In the solution explorer, double click on the web role configuration file and uncheck both "Enable Diagnostics" and "Use publish Storage Account"

image

**Updated 2/2 to include disabling IntelliTrace

IntelliTrace And Profiling

After a few days of monitoring the account I was STILL getting tens of thousands of transactions each day.  Another Azure support ticket discovered that this time I had enabled IntelliTrace without realizing it.  When you publish make sure you disable both IntelliTrace and Profiling.

image

Debugging a Published Hosted Service with IntelliTrace and Visual Studio

Now I am being billed for a few hundred transactions each day instead a 100,000.  Storage transactions are cheap, but it will cause a free trail account to get suspend in just a few days.

 

Summary

  1. Make sure you have a valid robots.txt file for your site.
  2. Disable Diagnostics – enabled by default
  3. Disable Intellitrace – Visual Studio Ultimate Version only
  4. Disable Profiling

Hopefully, this will help you get the most out of the Windows Azure Free Account.

.

,

5 Comments

  • Craig says:

    Great article. I too have been wondering why my storage transactions were through the roof for no good reason.

  • Great article. However at times, we would need to collect diagnostics information to find out what’s going on with our roles. Transferring only selected records from Windows Azure VM to Windows Azure Storage will help us achieve that. For example, we can choose to transfer only “Error” trace log entries instead of transferring everything to storage.

  • Leon Cullens says:

    Wow, thanks for the tip, didn’t know this. This can potentially cost people lots of money.

  • Without diagnostics, you’re flying blind.

    Diagnostics are collected locally on each instance, and then pushed to storage (either blob or table, depending on what’s being pushed) periodically. It’s the push to Storage that costs you the transactions, not the collection side, so the key is to reduce the push frequency.

    Try pushing things like performance counters every 5-10 minutes. Same with logging. You’ll still have one set of transactions per running compute instance, but scaling down the push frequency will significantly lower your transaction count.

    For an extremely simple example of code to configure diagnostics, you can look at this StackOverflow answer I posted a while back. Note that this is simply enabling logging, and pushing it to storage every 5 seconds. I would strongly recommend changing that setting to something like 10 minutes.

  • Ziko says:

    Hit this same problem… thanks for the details!
    Where should the robots.txt file go? At the root of the project with a compile-action of include? Or something else?