DevOps Blog

Serverless: what is it and when to use it ? | Padok

Written by Hugo Locatelli | 15-Jun-2023 12:15:00

What is serverless computing?

Serverless computing is a cloud computing model that was introduced by AWS in 2014 with its service AWS LAMBDA. The first serverless services were known as Function-as-a-Service (FaaS) but now there are many services such as CaaS or BaaS. It allows developers to build and run applications without the need for managing and maintaining the underlying infrastructure.

In traditional cloud computing, developers have to provision, configure, and manage servers to run their applications. With serverless computing, developers only need to write the code for their application's business logic, and the cloud provider takes care of the rest.

Serverless computing is not entirely "serverless." Instead, the cloud provider manages the infrastructure and automatically scales the resources up or down based on the application's demand. It also charges the developers based on the actual usage of the application, rather than charging for the infrastructure's fixed capacity.

The advantages of serverless over regular cloud computing

Serverless computing offers several advantages over traditional cloud computing:

  • Reduced operational overhead: With serverless computing, developers don't need to worry about managing and maintaining the infrastructure. The cloud provider takes care of everything, including scaling, patching, and security.
  • Cost efficiency: Serverless computing allows developers to pay only for the actual usage of their application, which can result in significant cost savings compared to traditional cloud computing. Serverless offers a true pay-as-you-use model.
  • Scalability: Serverless computing automatically scales the resources up or down based on the application's demand. This means that the application can handle sudden spikes in traffic without any additional effort from the developer.
  • Faster time-to-market: Serverless computing enables developers to focus on writing the application's business logic, rather than worrying about the infrastructure. This can significantly reduce the time it takes to deploy an application.

The uses cases of serverless computing

API


One of the most popular use cases of serverless computing is building APIs. Developers can use serverless computing to create API endpoints that can be invoked from various clients, such as web applications, mobile applications, and IoT devices.

A developer can also use some serverless functions to easily update a single route of a monolithic app. He can create an endpoint that could process and format the data it gets before passing it to the old API, allowing for fast implementation of external API changes.

Data Aggregation


Data Aggregation
is a common use case for serverless computing, especially for organizations that deal with large volumes of data. With serverless, you can create data pipelines that collect, process, and store data from various sources without worrying about infrastructure management.

Using serverless computing for data aggregation offers several benefits. It allows you to process large volumes of data quickly and efficiently, without the need for expensive infrastructure or specialized expertise. It also enables you to scale up or down based on demand, ensuring that you only pay for what you use.

Event-Driven Architectures


Event-driven architectures (EDA) are a popular approach to building scalable and reactive systems, and serverless computing is an excellent fit for implementing EDA. With serverless, you can set up event-driven workflows that react to events, such as user actions, system events, or messages, in real-time without the need for infrastructure management.

The dark side of serverless

While serverless computing offers several benefits, it also has some drawbacks that developers should be aware of.

Vendor lock-in


One of the main concerns with serverless computing is vendor lock-in. Once a developer starts using a specific cloud provider's serverless offering, it can be challenging to switch to another provider. This is because serverless computing requires developers to use the provider's proprietary functions and tools, which can be difficult to migrate to another provider.

Bigger attack surface


Serverless computing can also increase the application's attack surface. When you build a serverless infrastructure you need many small bricks for it to function properly. With the increasing number of bricks the number of potential security issues increases. The developers, therefore, need to ensure the correct configuration of the different bricks. He can rely on the cloud provider which offers good default configuration.

Conclusion

Overall, serverless computing is a powerful tool for developers that can simplify application development and enable faster innovation. By understanding the benefits and challenges of serverless computing, developers can make informed decisions about when and how to use it in their applications and take advantage of its full potential.