Skip to content

Demystifying Serverless Computing

When we think serverless computing we may think in the absence of servers or virtual servers, but that’s not entirely true.

Serverless computing is not a new term, it has been around for some time. It really emerged when AWS Lambda was released back in 2014 by Amazon, and since then Google Cloud FunctionsAzure Functions and IBM Cloud Functions made their way to the cloud computing family services on their respective public cloud infrastructure vendor as Function as a Service (FaaS) Platforms.

But what is serverless computing?

Serverless is an approach that allows building and running applications and services without the need of infrastructure management. Instead, the cloud service provider fully manages the code execution. This way developers don’t need to provision or maintain the system and application infrastructure when deploying code. In a more classic scenario, a developer would have to define host items like storage or computing capacity before the developments, which leads to longer provisioning time and a bigger operational overhead.

In this scenario infrastructure is automated and elastic, which can be very appealing in unpredictable workloads and also more cost-efficient. This is particularly important in the way that allows developers to focus on writing and optimizing code leading to a more agile business experimentation.

Instead of the virtualizing hardware through Virtual Machine or virtualizing Operating Systems like in a containerized architecture, Serverless FaaS virtualizes runtime and scales through functions making this approach suitable for solutions that:

  • Run infrequently
  • Are tied to external events
  • Have unknown scale requirements
  • Operate stateless across invocations
  • Connect other services together

Cost Efficiency

Before we can speak about cost efficiency, let’s see how the pricing model of Function as a Service (FaaS) differs from Infrastructure as a Service (IaaS)In a typical cloud business model, the customer pays for the amount of time the servers are operational, along with the resources that they consume.

In a serverless model, the customer leases the function, not the server. Here the Cloud Provider will charge for the amount of time the function is running (from its invocation to the time it is terminated, despite the outcome), and this charge occurs based on the size of memory space reserved and the amount of time that space is active.

This does not mean that all serverless approaches will be cheaper than a more traditional IaaS approach in terms of billing from the cloud provider. We may think that only paying for the time of execution of the functions rather than paying for the infrastructure for an entire period of time is cheaper, but the code must be optimized and bug free. But if we think that the developer has more time to focus on what matters, coding, this will significantly change the game, since there is no need to provision infrastructure and also, if needed, the capability on where the function operates can scale automatically based on its needs. 

Pros e Cons

Serverless computing has many benefits when compared with the traditional cloud approach:

  • Improved utilization – Customers pay for the amount of time a function is “alive” instead of paying for the time a server exists and the resources that are consumed by it, therefore, if no function is running there are no costs associated;
  • Security – Developers will tend to write code that is aligned with the best practices, security and governance policies, to write code that works within the serverless context;
  • Time to production – By removing the need to think about an optimal infrastructure architecture and by reducing the time to develop, test and deploy code. The main goal is to go from a concept idea to a production solution in less time, when compared with a traditional approach;

On the other hand, there are some considerations that need to be present in our minds when choosing a serverless approach:

  • Uncertain SLAs – For the Cloud providers it is difficult to assure what is acceptable to promise since the performance patterns for functions are very indeterminate.
  • The cost for untested/unoptimized code – Since the customer pays by function invocation, it can be very cost-inefficient to run functions that don’t produce the desired outcome due to lack of optimization or the presence of undetected errors 
  • Monolith Tendency – Developers can tend to put all the code in the same function in order to ensure that it runs fully optimized.

Summing all, despite the limitations in security and SLAs, serverless computing can be inexpensive since a customer only pays for what he uses. There is no charge if no task is executed. Customers also benefit from the fact that without the infrastructure to manage, operational cost decreases and worker efficiency increases.