Serverless, FaaS and why do you need them?

Published 22.02.2021

Author Hrittik Roy

Categories Engineering

In recent years, serverless adoption has started, with more and more individuals depending on serverless technology to meet organizations’ specific needs. A survey conducted by Serverless Inc showed in 2018 that half of the respondents used serverless in their job, and the numbers are projected to rise further.

In this post, we would get around the terms so that you can start your own serverless journey 😉

Let’s get started!

What is a Server?

If you have been on the internet even for a while, you have undoubtedly interacted with a server. Servers are a piece of specific hardware which ‘serves’ information or data to you. The specific hardware contains a lot of memory, speedy internet and generally hosted in massive data centres with other servers.

The Limitation

Hosting websites by buying your server is something you can think of, but you get limited if the numbers you calculate are wrong, which generally is the case. The under-provisioning (having less server capacity than required) and over-provisioning (having less traffic than the server can handle) of servers would take time from your development and cost you money.

You can always jump into a scalable cloud computing infrastructure. Still, then there, you must manage your infrastructure and would have to set aside time for your infrastructure management from the total time you could focus on development. Serverless helps you with this aspect.

Companies often invest less in cloud computing by using serverless services. The organization only pays the cloud service provider for the time their code is executed, instead of paying a flat fee for virtual machine (VM) instances that are always under- or over-utilized. Time is calculated in the form of applications, sometimes billed for every million requests. AWS, for example, charges about $0.20 for its serverless product per million requests.

What is Serverless?

Serverless helps you run an application without the need to configure or own the infrastructure even when the demand increases on an as-needed basis.

serverless doesn't means no server

There’s a misconception that serverless doesn’t require a server, but that’s completely wrong. Serverless run on the server, but the term signifies that you don’t need to worry about servers and the cloud provider takes care of them. They are the most flexible and cost-effective cloud computing technique to date.

How Serverless Works?

Developers rely on serverless to execute specific functions within the application code. We can call this model as a Functions as a service (FaaS) model due to this function-based approach.

If broken down into steps, a serverless lifecycle looks like this:

  1. Code Generation: Developers create a specific use case function with their choice of language.
  2. Event Declaration: A function only starts to pop up when an event happens. The event is often an HTTP request but can be queues, timers, and other various ways to trigger the function.
  3. Event Triggers: As soon the event is triggered via the specified ways, the function is executed. The trigger can be an application requesting information or a user clicking a button generating an HTTP response, or hundreds of other triggers.
  4. Function Execution: Before the function starts running, the cloud provider checks if an instance of the function is running or not. If not, it forms a new one for the function.
  5. Output: The function on execution generates a result that is sent back to the application specified on the code generation phase.

OpenFaas, OpenWhisk, and Kubeless are few frameworks you can use to build your serverless application.

Why use Serverless?

No Servers to Manage

You don’t have to worry about calculating how much hardware you need to provision for your requirements with FaaS. You can go to the market fast with your product because now you’re focusing mostly on your development and don’t have to worry about installing dependencies and other libraries.

Scalability

FaaS helps you to scale automatically up and down if your service traffic fluctuates. Forget about configuring scale sets to scale your VMs, i.e., servers, if a sudden influx of traffic occurs. Your service on FaaS will scale automatically if it’s day or night, just depending on how much traffic you get.

Pay for usage

With traditional VMs, you can fall into the trap of the wrong size configuration of VMs (leaving full capacity unutilized), which could cost you extra money. Moreover, if you forget to shutdown VMs which are not in service, you could reck up a hefty bill.

serverless benifits

FaaS charges you for the requests or the function trigger and not any other parameters. This request billing translates into you only have to pay for how many requests you are getting and nothing extra.

Why are the drawbacks of using Serverless?

Cold Starts

The Serverless Computing environment dictates that functions are run on demand and, when not needed, are thrown away. All these efficiencies lead to a phenomenon called cold starts.

A cold start happens when your function is running the first time in a while. The underlying reason for this is the function must be downloaded, containerized, booted and primed to be run. This problem could increase your service latency if traffic spikes, and so some providers try to minimize it by pushing function on edge.

For visualization, think in a cold-weather your engine takes more time to start than when the engine was working a few minutes ago.

Third-Party Vendor Lock

Each cloud provider deals with its infrastructure differently, but migration is easy because it’s similar on an infrastructure level.

Serverless removes the complete responsibility from your shoulders and put them on the cloud providers. It merely means they are managing infrastructure, and now if you want to develop an application, you have to follow the providers’ path, which is different for each provider.

Suppose a serverless application is developed on a specific provider. In that case, it becomes hard to migrate to another provider (in case you’re getting a better deal there) as a different management system exists. This difference in management system helps the provider lock-in clients. You can see that’s why some cloud providers offer free tier encouraging developers to develop an application on top of their serverless infrastructure.

Hidden Costs

A typical application requires networking, disk, memory and API requests to function. Cloud providers try to outsmart customers by charging a different amount for each service or component need for an application to work. These costs add up drastically, and in some scenario owning your server via a cloud provider comes cheap.

serverless hidden costs

The cold starts also come costly as the users have attention spans in milliseconds, and if it takes more time than that, users will return to some other website. Fun Fact: Only AWS as few milliseconds cold start timing azure and GCP have them measured in seconds (more than 2 seconds in most case).

Read more about hidden costs in this awesome blog.

Final Thoughts⭐

Serverless is a new technology that is under development and makes your developer life easy. A long way to go yet in terms of technology to mature!

One thing to remember serverless can’t be a perfect use case for all your development life cycle, but if sifted through, some cool stuff can be build using serverless.

Happy Learning!

Join 100+ cloud native enthusiasts

and stay in the loop on modern software development.

Sign up to receive exclusive content around cloud native software development right into your inbox.

We don’t spam! Read our privacy policy for more info.

More stories from our blog

How To Install Docker on Ubuntu 20.04?

How To Install Docker on Ubuntu 20.04?

Docker is an open-source tool that makes managing application processes in containers much easier. Containers allow you to run your programmes in separate processes with their own resources. Containers are comparable to virtual machines, except they're more portable,...

Answer to Everything isn’t 42, it’s Family

Answer to Everything isn’t 42, it’s Family

We’re experiencing digitisation. An era where every person has a voice, and it doesn’t matter if he’s wise. There’s more motivation circulating the vast stretches of the internet than it’s required. This would be good in a theoretical world, but if you seek the truth,...

What’s new in Gitlab 14? 🦊

What’s new in Gitlab 14? 🦊

GitLab 14 is out and fans must be thrilled to know about all the new features along with all the fixes and removals. In this post, we will go through the many changes and improvements, bug fixes, and some remarkable deprecations. We will see all of that here. So,...

k8s vs k3s: The Comprehensive Difference

k8s vs k3s: The Comprehensive Difference

Kubernetes is undoubtedly a champion in the container orchestration world. But currently, we see that K3s or a lightweight Kubernetes distribution which is light, efficient and fast with a drastically small footprint levelling up. Businesses nowadays scratch their...

What’s new in Fluentbit v1.8.1?

What’s new in Fluentbit v1.8.1?

Fluentbit is a lightweight and fast data processor and forwarder for Linux, BSD and OSX. And, for Fluentbit fans, there is good news as they have released their new update with lots of new features and fixes. We will have a look at all of them below. New Metrics...

What’s new in Envoy v1.19.0?

What’s new in Envoy v1.19.0?

Envoyproxy introduced its new version, 1.19.0, recently, and it came with many changes and improvements from the previous ones. We can see more stability in this version, along with specific bug fixes. So, without waiting any further, let’s see what the new version...

What’s new in Vitess 10?

What’s new in Vitess 10?

Vitess 10 is released with many excellent features and also many bug fixes that were bothering the user base. We are going to see all the features and exciting announcements. So, Let's roll! Major Themes in Vitess In this release, we can see that Vitess Maintainers...

What’s new in Contour 1.17.0?

What’s new in Contour 1.17.0?

Contour 1.17.0 is out with a layer seven HTTP reverse proxy for Kubernetes clusters. The new version has arrived with many new features and several fixes, which will make the functioning of the ingress controller smoother. More activities within the community came...

What’s new in Prometheus 2.28?

What’s new in Prometheus 2.28?

Prometheus 2.28 is out. If you don't know, Prometheus is an excellent open-source system monitoring and alerting toolkit. Let's have a look at those features and have a look at the changelog. Displaying Trace Examplers in the Graphic Interface From the previous...

GPT-J: GPT-3 Democratized

GPT-J: GPT-3 Democratized

GPT-J is the open source cousin of GPT-3 that everyone can use. The open source transformer is all about democratizing transformers and with 6b parameters it’s the largest transformer available. Read more here

Interested in what we do? Looking for help? Wanna talk about software strategy?