Skalar
Published in

Skalar

Going Serverless

Written by Skalar Developer Doğacan Bilgili

The term serverless has become quite popular in recent years, yet can be confusing even for tech-savy people. The confusion is likely to arise from the word itself, which gives the impression of a service without an actual server. In this article we are going to explain what serverless computing is, how it is different from the alternatives and when it might come in handy.

The traditional way in cloud computing is to rent servers remotely, which are dedicated for the customer and are always up and running. The downside of this type of computing is the fixed costs, no matter whether all the resources are used or not. On top of that, customers are likely to allocate more server resources than they need to meet the potential traffic. However, vendors usually provide an auto-scaling mechanism where the resources allocated increase in accordance with the traffic. This kind of service is known as Platform-as-a-Service (PaaS). can be shown as an example to PaaS providers.

Serverless computing, on the other hand, is a service where the server is abstracted away from the end-user. This means, as a customer you do not have to deal with the server configuration, maintenance, or capacity management among other things. The server is still there, but it is something you do not need to worry about . Serverless computing can refer to two different cloud service models, which are known as Back-end as a Service (BaaS) and Function as a Service (FaaS). Although both these models offer serverless computing, they have different functionalities and purposes.

Back-end as a Service (BaaS)

This cloud service model helps you to focus only on writing and maintaining your front-end code. The vendor provides you with servers to run your application, along with the necessary tools and features to improve your application such as cloud storage, database management, and user authentication. Through the APIs and SDKs provided by vendors, integration of the offered services can be made with ease. Firebase, AWS Amplify and Microsoft Azure are some vendors providing BaaS solutions today.

Function as a Service (FaaS)

Unlike BaaS, function as a Service is an event-driven architecture, which is intrinsically meant for microservices. Unlike a complete back-end service offered by BaaS, one can have several functions in the cloud to be triggered by different events in the same application or one event can trigger a function, which triggers another function. This loosely coupled integration enables developers to improve and maintain functions independent of each other. For example, you need to scrape some data from a webpage and for this purpose you can create a microservice to live on the cloud as a function. Then, whenever you need to run this function, you can make an HTTP call and get a payload in return. Google’s Cloud Functions, AWS Lambda and Azure Functions can be shown as the examples for the vendors offering FaaS.

These two definitions are subsets of the serverless architecture. This means the customer can have a non-serverless architecture where FaaS is utilized, while at the same time having an application sit on a serverless service making use of FaaS.

Advantages and Disadvantage of Going Serverless

The most prominent advantages of going serverless are development speed and cost-effectiveness. The fact that there is no need for a back-end maintenance in serverless architecture, along with off-the-shelf services ready to be integrated, smooths the development experience and saves time for developers. When it comes to the cost-effectiveness, unlike a traditional server running 24/7, going serverless does not charge you for idle times and thus reduces the cost when there is little to no traffic. Likewise, event-driven FaaS does not cost anything unless it is triggered. Once triggered for the first time, the function starts spinning and that takes some time, known as the “cold start”. Once a function is “warm”, it quickly responds to subsequent requests, and after a period of time the instance becomes inactive until it is triggered again upon another request to continue the cycle.

“Cold” starts are a notable downside for FaaS architecture. However, there are solutions engineered to tackle this problem, such as starting to spin the function at the “handshaking” stage when a request is sent over HTTPS. Cloudflare Workers is the vendor behind that approach, which offers zero cold start .

Other than the potential cold start inconvenience, the biggest concern for serverless architecture is the reduced control you have over the system as one relies on a third-party. This might be an issue when it comes to running tests or debugging code. Furthermore, once you pick a platform and implement your application on it, any potential migration to another platform might require code revision meaning that services available on one platform might not be available on another. This is referred to as vendor lock-in.

Should One Go Serverless?

As with everything in life nothing comes for free, and there are always trade-offs. So, the answer to the question whether to go serverless or not depends on several factors. For example, it is beneficial to know whether the off-the-shelf solutions provided by the serverless platform meet the project specifications to save time and resources by writing less code. On the other hand, the budget given to the project can be another criteria to consider a serverless platform due to potentially lower costs in the long run. As mentioned earlier, it is not necessary to go completely serverless to take advantage of serverless architectures, e.g. using FaaS alongside regular servers to leverage the advantages of a serverless architecture.

Originally published at https://www.skalar.no on November 2, 2021.

--

--

Skalar is a smart digital product company. We believe in synergy of business, design and technology. And we do this by creating solutions, services and business models that make a difference. Smart processes and smart results — that’s the Skalar way.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Skalar

Skalar

Smart digital products, the skalar way. | www.skalar.no.