DEV Community

Cover image for When to use serverless?

When to use serverless?

Steve Yonkeu on February 20, 2024

In the fast-evolving growing world of technology, the choice of the best architecture to adopt is an unfinished battle between the stake holders, d...
Collapse
 
felipeatsix profile image
Felipe Matheus de Souza Santos

Thank you, this was very helpful

Collapse
 
yokwejuste profile image
Steve Yonkeu

You're welcome.

Collapse
 
kortizti12 profile image
Kevin

This is a great article, and I really appreciate how you've included real-life examples! I wanted to share two additional scenarios: working with both server-based and serverless simultaneously, and transitioning from serverless to a more server-based architecture.

First, depending on your application and the type of load balancer you use (whether it's a web load balancer or a queue-based one), you can leverage a hybrid approach by combining traditional cloud instances like EC2 with Lambda functions. For instance, EC2 could handle your regular daily load, while Lambda functions kick in during peak times when traffic spikes. This allows you to run both architectures at the same time, optimizing cost and performance.

Is it possible to start serverless and then move to a server-based model?

Yes, it is. With today’s container technology, early preparation is key. The first step is making your application stateless. Next, you need to establish a common ground to translate whatever event triggers your application, whether it’s an HTTP request, a Lambda invocation, or a queue event. This flexibility helps you avoid vendor lock-in and makes your application portable across different platforms.

When it’s time to switch vendors or technologies, you can create a new translation layer that aligns with the new vendor's software. From there, you can build a Dockerfile with the required software for that vendor, and run tests to ensure smooth migration. The same method applies if you need to transition back to a more server-based model—just pack a Dockerfile with the necessary HTTP server or queue software and deploy it to your servers.

For more insights on serverless computing, I recommend this article by my colleague Vin Souza, Senior Software Developer / DevOps Engineer: Serverless Architecture.