TLDR: A solution that lets you deploy a piece of code that’s executed when an event happens. That event can be an HTTP request, a timer that elapsed, a blob that was created or a bunch of other things. Also, in Consumption plan, they timeout after max 10 minutes (5 by default) so choosing them for looong tasks isn’t the best idea.
What’s so cool with it?
Well, many things, to name a few:
- You litteraly only need to write a function that does a bunch of stuff and you’re good to go.
- Using the various bindings you can react on pretty much whatever happens.
- Obviously the whole serverless-advantage package.
- Visual Studio offers great templates to get you started.
- No need to worry about scaling, AFs scale automatically and you only pay for what you use, even in Consumption plan.
What’s the catch?
- They timeout early, you only get 10 minutes max (5 by default) in the Consumption plan. So beware of your async tasks, or consider using Durable Functions.
- Cold starts when they go idle, frustrating. BUT! You can always accompany your function with a “wake me up”-func, something like this:
[Function("Function1")]
public void Run([TimerTrigger("0 */5 * * * *")] TimerInfo myTimer)
{
// I could log something here but I really just want to keep the func awake :)
}
Verdict
I love’em and I use them a lot but I can’t neglect what they are intented to be used as. Short tasks, black boxes, data-in -> data-out, is what AF are built for.
Disclaimer 1: URLs last checked 2022-10-12. Drop me a line if you find a broken link please.
Disclaimer 2: It’s never my intention to create a parallel wiki, I try to write my own experiences and the way I see things, not copy official documention or Stack Overflow.
It is great that you are sharing about Azure Functions! 😊