← Field Notes

Concurrency

You're baking a cake. Let's say a vanilla chiffon cake with Swiss meringue buttercream.

You need to separate the egg whites from the yolks.

How many bowls do you need?

The answer is three.

One for yolks, one for egg whites, and one for the whites of the egg that you're separating.

That way, if you botch the separation for one egg, it doesn't mess up the entire batch.

If it takes 30 seconds to separate one egg, how long does it take to separate a dozen eggs?

If you're one person, the answer is six minutes, minimum.

If you have 12 people working in parallel, it can be done in 30 seconds.

That's one way to explain concurrency.

I built a solution that creates decks of illustrated cards, each with a QR code that links to a dynamic web page.

First, you design a deck of cards.

Next, you set up the assignments for which content elements appear for each illustration or card color.

Then, you press the magic button that automatically creates multiple decks.

At first, it was taking 30 minutes to build a 52-card deck.

Then, I turned on the concurrency feature in Power Automate.

With the flick of a switch, it was as if I had 20 pairs of hands cracking eggs all at the same time.

Now, deck creation was finished in under three minutes.

Except that there was a problem.

Picture 20 kitchen assistants making 20 two-egg [omelets]{.mark}.

The entire group shares the same bowl, into which they all crack their eggs.

Each kitchen assistant looks at the bowl and believes it to be their own.

"I'll take that," each says to themselves, pouring 40 eggs into their own frying pan.

The strange result was that each frying pan now contains not two, but 40 eggs.

With concurrency, 40 eggs multiplied into 800 eggs.

I won't belabor the analogy any further, but let's just say that you should avoid shared variables in a loop when you're working in parallel.

And I know that I said last week that I had other things to do and that I wasn't going to focus exclusively on fixing bugs, but yes, I spent the entire week fixing bugs.

Not only did I figure out concurrency, but I cleaned up my Azure Function Apps by letting Power Automate handle the connection with Azure Storage.

Plus, I added color to my QR codes, which is super fun.

Okay, it's time to get to the rest of my list now.

A cake with strawberries on top Description automatically
generated

Here's a vanilla chiffon cake with chocolate and strawberries

← Field Notes