DEMYSTIFYING SERVERLESS COMPUTING

Vladimiro Luz, AWS Technical Lead

Quando pensamos em serverless computing, podemos pensar na ausência de servidores ou em servidores virtuais, mas isso não é totalmente verdade. Serverless computing não é um termo novo e já existe há algum tempo. Ele surgiu quando o AWS Lambda foi lançado em 2014 pela Amazon e, desde então, Google Cloud Functions, Azure Functions e IBM Cloud Functions entraram na família de serviços de serverless computing nos seus respectivos fornecedores de infraestruturas cloud como Function as a Service (FaaS) Plataforms.

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.  

SERVERLESS COMPUTING DOESN'T NECESSARILY MEAN THE ABSENCE OF SERVERS OR VIRTUAL SERVERS.

  • 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. 

  • THE PROS AND 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 it all up, despite the limitations in security and SLAs, serverless computing can be an inexpensive solution 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. 

If you want to further develop this topic, send us an email to [email protected].

Read the full article here.  

Últimos artigos