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
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.
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.
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.
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.
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.
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:
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.
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? 😉
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.
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.
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..
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.
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:
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:
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:
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.
A platform like ours 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.