Serverless Technology: Pros And Cons

0
420
Serverless Technology

If you do not want to manage infrastructure, serverless architecture is the right way that helps to build and run applications. Alpacked mentions that the current web wave has been hit by the new practices that have the potential to improve business processes. Serverless computing is a strategy where the cloud manages the provisioning of computing resources based on user load. It gained popularity when AWS Lambda was launched in 2014. In this article we will try to figure out serverless benefits, pros and cons of ensuring, and whether this approach is worth your attention.

Getting To Know

To begin with, it is important to mention a few words about serverless technology and cloud computing to understand it better when to use serverless.

Cloud computing is a model that provides easy access resources for computing that a vendor supplies you with. The vendor is responsible for scaling resources, if needed or requested, running the code, monitoring, etc.

Serverless computing is a cloud computing execution model. Developers do not worry about servers, since service providers take over the job.

The key logic of the app is breaking everything into independent functions with event-driven structure. Every function should perform one task. The developer just needs to upload functions into the cloud provider’s console. The function code will be executed on request in an automatically prepared container. A division into functions in Serverless approach is similar to working with microservices. Many DevOps companies use microservices and here you can find examples of Alpacked use cases. However, while a microservice can perform several tasks, here a function should ideally perform one.

The Main Features

We can define three main features of serverless technology.

Abstraction

The user has no actual control on the server where the program runs on. Information about the operating system, network settings, updates are not available. Therefore, you can fully devote your focus on coding, developing functionality without worrying about the servers.

Effective cost

If your app is inactive, you do not pay anything. It is not currently using computing resources. Payment is made only for the time your application is actually running.

Elasticity

Depending on the load on your app, the service provider will automatically provide you with the right amount of resources.

The pros

In addition to the three main functions already listed, there are amazing features offered by serverless architecture. Not without purpose serverless computing has become the fastest growing cloud service. In 2017 it was 12%, which grew up to 21% in 2018 according to the RightScale survey.

There are the following advantages:

Pay-as-you-go

One of the biggest benefits of serverless computing is of course the low cost. You need to pay only for what is used. On top of that, you manage to cut operating costs. Server fees and capacity that you used to purchase is not required now.

You save time

The thing is: there is no need to worry about the resources for the application beforehand. Not only will you spend more time on innovating the project, but also you do not need to deal with implementation after deployment.

Security

You do not worry about it, it is a plus and may be a minus for some. But it helps to fully focus on the quality of the code and the app you are developing.

Infrastructure as a code (IaC)

Serverless solutions are often deployed in the cloud by running one command instead of configuring the server from scratch, transporting and switching the server to another data center, installing libraries and so on.

Ease of product creation and deployment

You do not have to deal with managing and setting up servers. Therefore, you can focus on  the business logic of the application.

Horizontal scaling and high availability

When you upload a function code to, for example, AWS, it is saved as a package on internal servers. A container with a specific interpreter (like a virtual machine) launches when receiving an event (http request, for example). The cold time is the time it takes to launch the first container and the app or if the lambda has not been requested for a long time. Besides, when it is the time for the second event, the first one can be still active and reuse container or memory modules. It is a principle on which horizontal scaling is based, when the number of requests rises.

Not Without Flaws

There are also disadvantages and difficulties that you can face using a serverless approach. Alpacked thinks that it is important to consider them before applying serverless technology.

Maintenance

You should always maintain backward compatibility, since another service or function can depend on your business logic or interface.

Moreover, you need to consider possible delays, monitoring some parts of the application and asynchronous communication.

The wrong architecture can still cause a cascading failure despite the fact that your functions are isolated. When a bug in one of them makes the others inoperable. If there is an error, it becomes difficult to debug, when a request from a client goes through a dozen functions.

Security

With so many components, the total surface area open to dangerous attacks is significantly larger, and with reduced overall control, you can be overwhelmed when this happens.

Vendor lock-in

There is a high likelihood of differences in the delivery of serverless services from one vendor to another. It is difficult to switch to cloud providers.

Debugging

There is a difficulty with running tests and debugging, because developers do not have access to the server tools and infrastructure. It causes some difficulties while working on the code efficiency.

The cold start time

It can be on average, up to 1 second for languages such as Python, Go, JavaScript, Java, Ruby. The developer manages the variables and can shorten the start time, although it is not allowed to control the start time of the container, as it all depends on the provider. However, a start delay is a controversial aspect. It is not always critical for a business application, but it is vital for medical services.

Other restrictions

Also, there are restrictions on execution time, on the number of functions executed in parallel and on the amount of code.

Serverless functions must be executed in a short timeout, which is determined by the service provider. For example, for AWS the timeout is 15 minutes. It means that long-lived functions need to be changed to meet the requirements.

Summary

As any technology serverless computing has its own advantages and disadvantages. And every business decides on its own what is more important and with what can they take a risk. Nevertheless, it is difficult to deny the obvious growth of serverless approach popularity.

Even in 2017, Satya Nadella, Microsoft SEO identified a huge contribution of serverless technology: “So serverless computation is going to fundamentally not only change the economics of what is back-end computing, but it’s going to be the core of the future of distributed computing.”

Companies that have already implemented the serverless technology into their work are Twitter, PayPal, Netflix, etc. But as Alpacked states: this is not a panacea, serverless technology works better when applied as a tool for solving a certain range of tasks.