The Ops Community ⚙️

Cover image for An Introduction to Function as a Service (FaaS)
Argonaut
Argonaut

Posted on • Originally published at argonaut.dev

An Introduction to Function as a Service (FaaS)

Serverless architectures have been growing rapidly in popularity. This has taken off after AWS introduced Lambdas in 2014.

According to Verified Market research’s recent study, the serverless market is expected to reach a staggering $36.84 Bn by 2028 with a CAGR of 21.71%. Here’s a primer on this space.

Market Size

Serverless FaaS is one of the more popular cloud deployment options. FaaS (Function as a Service) is an event-driven way of executing code where you deploy code as functions, better suited for lightweight and standalone apps.

Over the years, applications have been moving from monolithic architectures to microservices. These enable more modular components that allow developers to can create and modify small pieces of code which can be easily implemented into their codebases. Similarly, using FaaS, these microservices can be deployed to the serverless cloud as Functions. The combination of deploying code as functions and FaaS offerings makes it faster to deploy application code without worrying about underlying server management.

Monolithic to Microservices to functions

(Image source: Cloudflare)

Key benefits of serverless FaaS

The key benefits are increased speed of shipping code, cost-efficiency, and built-in scalability. With FaaS, server management complexity is removed and all the resources are automatically scaled up and down based on the traffic/events. There are also zero charges for idle time, you only pay for the compute time used. Major cloud providers also provide generous free tiers based on the number of requests and CPU usage time.

Key Benefits

FaaS use cases

Here are a few of the countless use cases of serverless FaaS:

  • Modular applications like chatbots, backend for IoT
  • Scheduled batch jobs
  • Health checks, telemetry, alerts
  • Data analysis, AI & ML model training
  • Offsite backups

Over 1/3rd of all companies using AWS Lambda are startups with <50 employees. And nearly 2/3rd of all AWS Lambda customers have revenue of <$50M. (Data: enlyft.com) Lambda has enabled companies to start small and scales as they grow.

Companies using FaaS

AWS Lambda

AWS Lambda is the most popular FaaS offering with 46% of developers surveyed using or considering it, followed by Google Cloud Functions and Azure functions. Netlify, Cloudflare, and Twilio also offer FaaS. (The State of Cloud-Native Development Q3 2021 - Slashdata)

AWS Lambda also leads when it comes to the availability of community projects, third-party tools, and frameworks. Many other FaaS projects such as Netlify functions are built on top of AWS Lambda; their aim is to make it even easier to start with serverless while also adding more features. This further increases the appeal for anyone interested in using FaaS for their application.

AWS Lambda the top serverless choice

Programming language support

Programming language support varies by provider and could impact your choice of FaaS. Node and Python are the two most popular languages on AWS Lambda. 60% of the companies surveyed deployed lambda functions in at least three languages (Datadog: State of Serverless 2022).

Comparison of programming languages supported by AWS, Azure, and GCP. AWS Lambda and Azure Functions also have the ability to support more languages through an abstraction layer. We found this comparison chart from Techtarget which gives more info on the supported runtimes.

Languages supported

Cost of FaaS

When it comes to cloud costs, especially serverless. There are generous free tiers on offer from the major cloud providers AWS, GCP, Azure, Alibaba cloud, and IBM.

By leveraging the free tiers, startups and independent developers save big on cloud costs. Even those companies whose usage exceeds these free tiers, only end up paying for the amount of usage beyond the free tier limits.

Free tiers compared

The table below compares the free tier serverless FaaS offerings from AWS, Azure, and GCP.

Free Tiers compared
An important thing to keep in mind is that though the free usage is based on duration and requests, there are additional costs associated with things such as network and storage usage, etc. They look like:

Usage pricing

How to calculate costs?

Calculating serverless costs doesn’t have to be difficult.

You can use tools like serverlesscalc.com or Dashbird’s cost calculator to get estimates of your serverless FaaS costs. AWS provides its own cost calculator.

Newer options

Netlify functions and Vercel functions abstract away a lot of work for you by automatically provisioning load balancers, or by making the deployment process much easier. Convenience comes at a cost, and their costs tend to be slightly higher than that of AWS Lambda. You can evaluate it based on your team size, workloads, and usage.

Edge functions

Lambda @Edge, Cloudflare workers, and fly.io provide edge deployments to bring serverless functions closer to your users, reducing latency to an absolute minimum. They're great for real-time work but are pricier than classic serverless FaaS.

Here is a bit more context to help you decide if this is relevant for you.

Edge Functions vs serverless functions

(Data source: Fauna and stackpath)

Tools and resources

There are several projects, frameworks, and tools that have made shifting to serverless super easy. Here are the must-haves.

  1. Serverless Stack (SST) helps devs build full-stack serverless apps and lets you test and work on Lambda live. REST APIs, React apps, Next.js apps, Cron Jobs, and more.
  2. AWS SAM is an open-source framework for building serverless applications faster. Its powerful shorthand syntax can express functions, APIs, databases, and event source mappings. With a few lines of code, you can define the application you want and model it using YAML.
  3. Netlify functions allow you to do more by deploying the functions you write as full API endpoints. You can deploy backend functions and frontend code together. Easily preview and roll back deployments.
  4. Observability in serverless
    Tools like Datadog, Splunk, Thundra.io, New Relic, and Dashbird make monitoring and debugging serverless applications easy. They collect metrics, logs, and traces from AWS Cloudwatch and X-ray.

  5. sls-dev-tools is an open source tool that brings your lambda stats, checks recent calls, and more to your terminal. It is compatible with IaC tools from serverless framework to the AWS SAM.

  6. docker-lambda is a local sandboxed environment that replicates a live Lambda environment including the installation of software and libraries. You can use it to run functions to observe their behavior and also to compile native libraries.

  7. Zappa is the easiest way to deploy your Python apps on AWS Lambda + API Gateway. It allows easy packaging, deploying, scheduling, rollbacks, and more. It also supports Django and Flask apps.

  8. Vercel serverless functions enable you to store functions co-located with your code and as a part of your Git workflow. Auto-scaling and edge caching enable quick response and avoid downtime.

  9. Aqua’s serverless container functions ensure that serverless functions are secured and in compliance. It integrates with your CI/CD pipelines and protects AWS Lambda functions in runtime.


Deploy easily to AWS Lambda with Argonaut

  • Automatically syncs with your Git source and AWS
  • Deploy your NodeJS, Python, Java, and Go apps in minutes
  • Quick to setup, scale as you grow

Top comments (0)