Should I know the price?

For some reasons developers are often not aware of the total costs of the solution, they've been working on for the last months. Usually the path is pretty simple:

Develop > Test > Deploy > Repeat

There's hardly any feedback regarding optimizations, which are not hard performance improvements. While before cloud era saving were not so obvious(you allocated a particular amount of money anyway to buy your servers), now all looks a bit different.

I, as a developer, am able to easily predict and calculate expected cost of a solution I'm making. I have detailed pricings, I can prepare and test a POC I was asked for. I don't have to deploy anything to physical machines and you - as my company - won't buy devices and technologies, which may not meet our requirements. So the questions is:

Should I care?

Nah, it's a silly question - of course I should. But to be honest - nobody asks. While it's deployed to a production slot, I cannot control it. In most cases I don't have sufficient permissions to be able to control the overal cost. And you know what? That's perfectly fine, it's not my responsibility. 

On the other hand nobody will ask for an improvement unless we're hitting the limit. We can afford spending 10000 USD monthly for this solution and it costs us 9999,99 USD? That's superb. We could pay half of this price?! Well, nobody told us so...

...and nobody asked.

The point is - if there's room for improvement, do it. This is especially true in the cloud environment - you can save 5ms in one place? Save it! Cloud is all about computation power and time. Whenever you improve an algorithm, you save both power and time. By saving both you're saving money. That's what makes you a professional.

 

Is Event Grid faster than Azure Functions? #2

In the previous post I presented you the result of a basic smoke test using Blob Trigger in Azure Functions and the same functionality in Event Grid. The outcome was not surprising - Event Grid seems to be faster and more reliable way of notifying other services about new blobs. What if we perform a stress test? Is anything going to change? Let's check this!

Publisher

For the current episode I used following producer:

/
private static void Main()
{

	MainAsync().GetAwaiter().GetResult();
}

private static async Task MainAsync()
{
	while (true)
	{
		var storageAccount = CloudStorageAccount.Parse("");
		var blobClient = storageAccount.CreateCloudBlobClient();
		var container = blobClient.GetContainerReference("functionsgrid");
		container.CreateIfNotExists();
		var blockBlob = container.GetBlockBlobReference(Guid.NewGuid().ToString());

		blockBlob.UploadText(JsonConvert.SerializeObject(new Blob()));
		Console.WriteLine($"[{DateTime.Now}] Blob uploaded!");

		await Task.Delay(10);
	}
}

public class Blob
{
	public Blob()
	{
		Id = Guid.NewGuid();
		Created = DateTime.Now;
	}

	public Guid Id { get; set; }

	public DateTime Created { get; set; }

	public string Text { get; set; }
}

What is more I run 5 producers at the very same time. 

Results

Here are the results:

How to interpret this chart? On the y-axis we have total execution time(in miliseconds). You can clearly see the difference between Functions and Event Grid(in fact the maximum execution time for Function was greater than 30 minutes!). What is more, the median for Function lies between 50 and 100 seconds.

Conclusions

It seems that there's a clear improvement when it comes to processing times when switching from Azure Functions to Event Grid. You may ask why one would like to use Azure Functions when the difference in processing time is so obvious? As always - you have to ask yourself what are your requirements and what are the current recommendations. The rule of a thumb would be, that if I need predictable delivery time, I'd go for Event Grid. If I don't mind whether a function is called after 1 second or 1 minute, Azure Function is still a viable option.