Serverless is a quite new way to run scripts in clouds. This approach is about providing a user with a ready-to-use platform for developing, running and managing the specific functionality without the requirement of setting it up and configure on your own.

The thing is that the logic of an application is divided into independent functions that have an event-driven structure. Each of the functions do one 'micro-task'. A developer is required to upload functions to the given by a cloud provider console and to relate them to sources of events. The code will be executed on demand in the automatically prepared container.

For the last 2 years, the open-source community has been actively working on tools for Serverless. Google, IBM, and Microsoft have already contributed to developing serverless platforms.

Also, currently, serverless frameworks are being developed. The framework serves as a kind of controller - on demand, it prepares a runtime environment within a cluster and then, run a function there.

Benefits of using Serverless:

  1. Serverless develops the ideas of container infrastructure and microservice approach, in which teams can work in multilingual mode, without being tied to one platform. Building a system is simplified, and fixing errors becomes easier. The microservice architecture allows you to add new functionality to the system much faster than in the case of a monolithic application.
  2. Serverless reduces development time even further, allowing the developer to focus entirely on the business logic of the application and writing code.
  3. As a bonus, we get automatic scaling based on the load, but we pay only for the resources used and only at the time when they are used.

The drawbacks include:

  • Cold start time (up to 1 second on average for languages such as JavaScript, Python, Go, Java, Ruby). On the one hand, in fact, the time of a cold start depends on many variables: the language in which the function is written, the number of libraries, the amount of code, communication with additional resources. As the developer controls these variables, he/she can shorten the start time. On the other hand, the developer cannot control the launch time of the container - it's all up to the provider. For many applications, a cold start is not a problem. A delayed start for a second is not always critical for a business application but can become critical for medical services;
  • The short lifetime of a function. If you have to work with long term tasks, you can use a hybrid architecture - combine Serverless with other technology;
  • Not all systems will be able to work according to the Serverless scheme. Some applications will still store data and status during the execution. Some architectures will remain monolithic, and some functions will be long-lived.

It is worth mentioning that Serverless functions are widely used for:

  • delayed or background tasks (creating additional copies of an image after uploading it to the site, taking a scheduled backup, asynchronous sending email to users (push/emails/sms), exports and imports);
  • chatbots;
  • backend for IoT applications;
  • requests manipulations to your main backend. E.g., to identify a user by User-Agent, IP, etc., or to get the info about the user's geolocation by IP;
  • using them even as independent API endpoints.
Serverless is definitely a technology with a great future, the activity of using it is constantly growing. Companies such as Twitter, PayPal, Netflix, T-Mobile, Coca-Cola have already implemented the technology in their services.

Serverless will help to solve such problems:

  1. Reduce resources' downtime.
    It is not necessary to constantly keep the virtual machine for services to which there are few requests.
  2. Quickly process the data.
    To compress pictures, to cut out the background, to change the video encoding, to work with IoT sensors, to perform mathematical operations.
  3. "Glue" other services among themselves.
    Git repository with internal programs, chatbot in Slack with Jira and with a calendar.
  4. Balance the loading.

Thus, Serverless can be used where it is required to process numerous requests intensively but not too often. In this case, running several functions for 15 minutes is more profitable than keeping a virtual machine or server all the time.

With all the advantages of serverless computing, before implementation, you should first evaluate the application logic and understand what tasks Serverless can solve in a particular case.

In conclusion, we can say that Serverless is the future. This approach is not suitable for all companies, but no doubt it is worth investing time in trying it in practice.

In JSN team, we aim to keep pace with technological developments, therefore, always learn new tools that help us to optimize the development and simplify solving different kinds of tasks.