tabs ↹ over ␣ ␣ ␣ spaces

by Jiří {x2} Činčura

Penny pinching Azure Append Blobs

5 Jul 2018 2 mins Application Insights, Azure, Azure Storage

I was going through some reports in Application Insights for a small website I’m running and I saw a lot of 409 errors when writing to Append Blobs. As I was sorting this out, I also realized I can do the whole logic more “efficient” and save some pennies.

Little bit of context. The website I’m talking here about is collecting some data and putting it into Append Blobs. Because you can append data to a single Append Blob only so many times, every month new blob is created. This is where the 409 error was coming from, because for Append Blob there isn’t simple CreateIfNotExists method, I had to build my own “optimistic concurrency” way to do it I blogged about before.

These 409 errors were bugging me in Application Insights. Sure, I could filter those out, but it would still be there. 😃 Also, I realized most of the time the blob exists (because it’s created only once a month), thus this call is often useless – it’s slowing things down and also costing me some, although peanuts, money. And I can really easily solve both.

I simply pre-generated these blobs for next 20 years. Solved. The application can now assume the blob exists, saving one operation, hence saving time and money.

So, what’s the lesson? If you can (use common sense) pre-generate it, pre-generate it. Like this blog, for example. 😃

Profile Picture Jiří Činčura is .NET, C# and Firebird expert. He focuses on data and business layers, language constructs, parallelism, databases and performance. For almost two decades he contributes to open-source, i.e. FirebirdClient. He works as a senior software engineer for Microsoft. Frequent speaker and blogger at www.tabsoverspaces.com.