Cost - Do you know how to be frugal with Azure Storage Transactions?

Last updated by Brady Stroud [SSW] almost 2 years ago.See history

Azure transactions are CHEAP. You get tens of thousands for just a few cents. What is dangerous though is that it is very easy to have your application generate hundreds of thousands of transactions a day.

Every call to Windows Azure Blobs, Tables and Queues count as 1 transaction. Windows Azure diagnostic logs, performance counters, trace statements and IIS logs are written to Table Storage or Blob Storage.

If you are unaware of this, it can quickly add up and either burn through your free trial account, or even create a large unexpected bill.

Note: Azure Storage Transactions do not count calls to SQL Azure.

Be aware that Azure Functions Queue and Event Hub Triggers can cause lots of transactions

Both of these triggers can cause a lot of transactions. Typically this is controlled by the batch size you configure. What happens is that the Functions runtime needs to read and write a watermark into blob storage. This is a record of what items have been read from the Queue or Event Hub. So the bigger the batch size, the less often these records get written. If you expect your function to potentially be triggered a lot, make the batch size bigger.

Many people set the batch size to 1, which results in ~2 storage transactions per trigger, which can get expensive quite fast.

Ensure that Diagnostics are Disabled for your web and worker roles

Having Diagnostics enabled can contribute 25 transactions per minute, this is 36,000 transactions per day.

Question for Microsoft: Is this per Web Role?

azure check properties
Figure: Check the properties of your web and worker role configuration files

azure disable diagnostics
Figure: Disable diagnostics

Disable IntelliTrace and Profiling

azure publishing settings
Figure: When publishing, ensure that IntelliTrace and Profiling are both disabled

Robots.txt

Search bots crawling your site to index it will lead to a lot of transactions. Especially for web "applications" that do not need to be searchable, use Robot.txt to save transactions.

azure robots
Figure: Place robots.txt in the root of your site to control search engine indexing

Continuous Deployment

When deploying to Azure, the deployment package is loaded into the Storage Account. This will also contribute to the transaction count.

If you have enabled continuous deployment to Azure, you will need to monitor your transaction usage carefully.

References

We open source. Powered by GitHub