7
 min read

What are Serverless Functions? The Future of Process Automation

In this post we explore the benefits and use cases of serverless functions as well as review and compare the key providers.

When users interact with a web-hosted application, their requests are processed in the service provider’s infrastructure. Because the processing does not take place on the user’s device, the service provider has full flexibility around what infrastructure to use and how to handle the request.

Typically, these user requests were processed using endurant infrastructure, such as on-premise servers, or cloud-hosted virtual machines, which are always on and always listening. But recently, service providers have started using ephemeral resources to allocate infrastructure whenever a request needs to be processed, and relinquish the infrastructure when the request is completed. The provisioning of these ephemeral resources is fully managed by the cloud provider, so there’s no infrastructure to manage and no wasted resources. Just code running when required.

Table of Contents

What are Serverless Functions?

A serverless function is a piece of code designed to serve a single purpose. When the function needs to be executed, the infrastructure is provisioned on-demand, and upon completion, the infrastructure is spun down. This on-demand infrastructure provisioning, code execution and spinning down of the infrastructure is fully managed by the cloud service provider. Therefore, serverless functions are inherently scalable and cost-efficient.

Benefits of Serverless Functions

By design, serverless has some clear advantages over other forms of computing such as on-premise servers or virtual machines. Below, we describe the advantages of using serverless over other types of computing.

Piece-by-piece deployment

Traditionally, applications were developed and deployed as one large piece of code - this is referred to as monolithic applications. This large, singular piece of code had many moving parts, which meant that whenever a change was made, any deployed application had to be entirely rebuilt and redeployed. In comparison, serverless functions are independent pieces of code that can only do one thing. String multiple of these functions together, and you get the same functionality as with a monolithic application, but with all the benefits of a decentralized system. For new features, updates or bug fixes, developers simply write the code into a single function, which does not impact the rest of the application.

This approach speeds up the deployment of new code, making the process simpler and more conducive for automation. It also results in fewer interruptions across the application so customers don’t experience downtime as new additions are deployed.

Cost-effectiveness

In the case of traditional hosting, billing is dependent on how many resources you have spun up, and the configuration on these resources. If the application that runs on the existing infrastructure exceeds that capacity, the IT team will need to manually spin up new resources to meet the demand, or risk slow service and overall poor performance. On the other hand, provisioning more resources than needed will be a waste of money. 

When it comes to serverless functions, the service provider only runs the functions they’ve been given to run, using configurable resources. This consumption-based model means that you will only pay for what you use, removing altogether the risk of wasting resources or not having enough resources to meet demand. 

Smoother application development

In a non-serverless setting, a developer will have to juggle their primary duties of writing code with others relating to infrastructure maintenance. This way of working can leave them playing catch up and only doing the amount of coding that can fit into their crowded schedule.

With serverless functions, they don’t have to spend time worrying about the status of certain resources, how up-to-date they are, the availability of particular hardware, configurations and other settings, etc. They can focus on producing quality code that directly delivers business value.

Serverless functions also help to connect business apps and data smoothly, and make it simple to capture vital customer events. Here’s a breakdown of some areas where a serverless approach can produce improvements in application quality.

Use Cases for Serverless Functions

There are numerous use cases for serverless functions such as data processing where code is executed once changes are made in data, real-time analysis of IoT device-generated data, extending SaaS applications, and video and image analysis. Here are some of the vital actions involved in applying a serverless approach to these various cases:

Building workflows

Even for the simpler projects, the number of events requiring their own processes quickly pile up. Confirmation emails for sign-ups, uploading of images, sending of verification codes, generation of receipts or quotations and estimates, etc.

X-Functions Workflow Builder

Maintaining all the business logic code for all these events is a difficult task, but bundling multiple serverless functions together into discrete workflows makes it simpler. Wouldn’t it be great if there were a straightforward visual workflow builder that enabled you to create  serverless workflows quickly and easily? 😉

Simplifying customization

With so many software solutions available today, there is a huge opportunity to integrate and deliver innovative solutions. However, off-the-shelf software has its limitations. By interacting with external solutions, serverless functions help extend the functionality to solve more complex problems. 

Serverless functions provide the opportunity to add external software into workflows as an additional step. They enable teams to get the best of both worlds, using pre-made solutions to do what they do best, while serverless functions provide the flexibility to extend and integrate with existing functionality.

Scaling services

The continuous flow of events that an application receives from user actions is called an event stream. Since there’s rarely any foresight into how many events will be received and the requirements for computing resources, the application needs to scale based on demand.

Serverless functions are designed to be scalable and don’t require manual adjustment of resources. The cloud service provider handles the scaling under the hood so as usage grows teams can focus on value adding functionality.

Standardizing data management

Every user action generates data. Lots of data. How this event data is collected, cleaned and organised is critical to maintaining its value in the future. Using a data lake to quickly and easily receive raw data is common practice that removes delays, and shortens time to value for analytics and data science teams.

Using serverless functions, small modular code can be written to process records and send them to storage solutions. This helps maintain standardized data processing procedures since the code is all kept in small functions that can be accessed from anywhere in the application. As such, data cleaning logic doesn’t need to be continually reinvented by the development team..

Analyzing user activity

Modern product teams monitor customer behaviour in order to generate insights to continuously improve offerings. Serverless functions are ideal for the collection of user activity due to their small scope and ease of deployment.

Serverless Architectures & Vendors

AWS Lambda

This is a serverless function environment provided by Amazon Web Services. It supports programming languages like Java, PowerShell, C#, Go, Node.js, Ruby and Python. Below are some advantages and disadvantages of using AWS Lambda:

Pros

  • Cost Structure - The costs are well structured, basing them on compute time and allocated memory. Billing is calculated based on runtime, memory usage, and the number of times the function is triggered. There is also a Compute Savings Plan that can save users up to 17%.
  • Performance - Consistent performance regardless of scale. AWS Lambda functions have the option to provision concurrency to ensure that latency is kept low even during large fluctuations in demand. 

Cons

  • Cold Start - Even though AWS Lambda uses industry-grade tools, it is still quite a challenge to achieve consistency in the execution environment. If a Lambda function has not been executed for some time, around 10 minutes, then AWS will drop its container causing the function to go ‘cold’. When the function is run again AWS will first have to load its container, adding to the runtime which results in slow cold starts. 
  • Complicated Call Patterns - AWS Lambda functions have a configurable timeout that defaults to three seconds but can be extended out to up to fifteen minutes. In use cases that require longer runtimes, using Lambda functions requires additional configuration to ensure they can function in a distributed manner. This can mean code refactoring is required by developers to build with Lambda. 

Azure Functions

This environment is on Microsoft Azure and its supported languages include JavaScript, Python, Java, C#, Powershell, TypeScript and F#. Here are some of the benefits and drawbacks of using Azure Functions:

Pros

  • Cost Effective - Similar to the other major vendors, Azure functions are quite affordable since the cost depends on execution time and memory usage each time a function is invoked.
  • .Net Support - As a Microsoft offering, Azure Functions is deeply integrated with the wider Microsoft ecosystem. For developers with a .Net background, the learning curve is considerably shortened.
  • Easy-To-Use - Azure functions come with HTTP endpoint integration out of the box, so there is no need to separately setup and configure an API Gateway like in AWS. 

Cons

  • Complicated Pricing Model - Azure offers several different pricing plans for its serverless function offering including: Consumption Plan, Premium Plan, Dedicated Plan, App Service Environment, and Kubernetes. The Consumption plan is priced the same as AWS Lambda,
  • Lower Scaling Limits - The maximum number of concurrent executions in Azure Functions is limited to 200 for the Consumption plan, and even less for the other plans. This is significantly lower than the 1000 from both AWS and Google offerings.

Google Cloud Functions

Google’s serverless functions offering are Google Cloud Functions, which support Python, Go, .Net Core, Ruby, PHP, Java, and JavaScript runtime environments. They have access to Google Service Account credentials meaning they can be easily connected with other products in the Google Cloud Services suite. Let’s go through some pros and cons of Google Cloud Functions:

Pros

  • Firebase Integration - The Google Cloud Functions product was jointly developed by the Cloud Platform and Firebase teams. As a result it has been purpose built to enable developers to produce mobile backends to Firebase apps.
  • Monitoring - Google provides very simple and clear tools for monitoring the execution of serverless functions, a great benefit when debugging applications.

Cons

  • Less Flexibility - Google Cloud Functions have considerably less event hooks that can be configured as triggers, especially when compared to AWS Lambda. These include HTTP, Cloud Storage, Cloud Pub/Sub, Cloud Firestore, Firebase, and Cloud Logging.
  • Cold Start - There have been reports showing that Google Cloud Functions suffer worse from the cold start problem vs AWS Lambda. See here for details.

Resource Limits - The maximum runtime of Google’s serverless function offering is only nine minutes and the maximum memory that can be allocated to an instance is four gigabytes. Both. AWS and Azure offer higher limits.

Go Serverless with X-Functions

A platform like X-Functions can provide all the benefits of serverless functions to enable you to build event-driven automations fast. To learn more, sign up for early access here.

Get Early Access

We're gradually opening up early access to companies who like to build and automate the future of X.

Thank you for registering
Oops! Something went wrong.