Azure Functions - Introduction

Azure Functions are based in serverless programming. They integrate easily with other Azure services. You provide Code to execute and an event that triggers it.
For example to run background tasks every hour.

They’re brilliant for:

  • experiments and rapid prototyping.
  • automating development processes.
  • decomposing or extending monolithic apps.
  • independent scaling.
  • adapters for integrating systems.

Recommended Read

Azure Functions vs other similar services

Azure Functions is built on top of the web jobs SDK and it’s hosted on the app service platform.

Virtual Machines (IaaS)

With VM you can install whatever you want: web servers, services etc. This is known as IaaS (infrastructure as a service). You can choose OS and have complete control of the server, but you’re responsible for it: Patching, maintaining, scaling, operational overhead.

Azure App Service

This is PaaS (platform as a service). The cloud provider takes responsibility for managing and patching the servers. You only provide code for website or background tasks.

Easy to deploy. Hosted in a “hosting plan”. You can combine multiple sites on one server. Scale up to many servers.

Programmer friendly model that makes it easy to create and deploy multiple websites along with background processing tasks and bundles them into a single server to keep costs down but with flexibility to scale up.

Azure Functions

  • Rapid and simple development (no boilerplate; you can code in Azure portal)
  • All the power of Azure Web Apps (CI, Easy Auth, Certificates, Custom Domains)
  • Cost-effective pricing (pay for what you use)
  • No servers to maintain (automatic scaling)

They offer a simplified programming model. You just create the code to tespond to the event you’re interested in. You avoid boilerplate code.
They’ve a consumption-based model. You only pay when your code is running. It can result in dramatic cost reducing.

You pay by the number of executions and resources it uses (CPU x RAM GBs). There’s also a free monthly grant. You should aim for it to run as quickly as possible, invoke it as few times as possible and reduce the resources it uses. This plan limits function execution time up to 5 minutes (to avoid deadlocks).

Its runtime is available as a Docker container. You can run them in any computer that’s able to run Docker. This means on-premise or other cloud providers.

Serverless

The key idea is we want to delegate the management of the servers to third parties. Use PaaS wherever possible. You still need to write custom backend code. This is where Azure Functions come into play.

You tell Azure Functions:

  • which events you need to respond to
  • what to do when they fire
  • and then delegate how many servers are actually needed

This is referred to as FaaS (Functions as a Service).

Reference(s)

https://azure.microsoft.com/en-us/pricing/details/functions/