Let’s Go Serverless!!
A fairly new development concept has created a hype in the developers arena. It’s not actually a new concept. The concept came into play 3, 4 years back. But it has taken several years to evolve and mature and now it has been buzzing around the development world and it has shown that it’s going to be the future of application development. It doesn’t matter whether you are a newbie or an expert to the development world, I’m pretty sure that you have at least heard about “Serverless”. So in this article I’m going to explain you about what I know about this technology up to now :)
So it is about having applications without servers right?? Atleast that’s what the name implies.
Actually that’s not the case. If we are not using servers where are we gonna host them. We still need them to host our applications right?. Developing Serverless application doesn’t mean we are not going to use servers at all. What it actually implies is that we need not to worry about servers. In simply it’s all being handled by the service provider. Following is what AWS says about Serverless.
Serverless computing allows you to build and run applications and services without thinking about servers. Serverless applications don’t require you to provision, scale, and manage any servers. -AWS
We need not to think about the spec of the server that we are going to deploy your application. Disk capacity, RAM and all other specs are now in “No Worries” zone. What developer need to focus is only about application code. Resource provisioning is up to the cloud vendor. And most importantly you need to pay for what exactly the resources that you use using based on time (would be Milliseconds :) )and computing power that you use.
I’ll explain what is Serverless and actual usage scenarios of Serverless app development.
Let’s take an example. You have an simple application which exposes some external API’s that the users can call and get data. To provide service to your users you need to host your application in a server. Let’s say you selected a cloud vendor like “AWS” and created an EC2 instance and deployed your application so that your clients can call your API from outside. In that case you don’t know when exactly the clients may call your API. So you need to run your application 24*7 to provide service. From then information collected from the API calls made to your API you see that API calls have been made only at certain times of the day and it’s not distributed throughout the day. And that means you are running your server 24*7 and paying for it on hourly rate while actual usage is about 30 mints a day. So you will be billed for the resources you have been using (Let’s say EC2 instance) as the application kept running even though actual used time is about 30 mints. There are some other scenarios as well. I’ll explain them as well in later sections.
This is a good example for a situation where we can go Serverless.
If you used a Serverless application. First and foremost you need not to create hosting instances and deploy it.What you need to do is just deploying your Serverless function(What are functions?? I’ll explain :) ). Cloud provider will take care of the rest. If I take the previous example your Serverless function will not run 24*7. It will only run when a client make an API request to your application. So in the other time your application will not run. You need not to control anything manually to decide when to run application and when not to.That is controlled by the service provider. As you can understand now you will be billed only for that 30 mints time that your application is actually used. Most importantly you need not to think about where the code is going to be deployed and no configurations for the server is required from the developers side. It’s already being handled by the cloud vendor.
Let’s take another scenario of the previous example. Let’s say that previous API application does get less number of requests in morning and in between 4PM-5PM it does gets 1000’s of requests where more resources like RAM need to be provisioned to the server. So you provision those resources and then after that Peak hour you need to removed provisioned extra resources from your application. Otherwise you will be billed for those resources much more.
If you use Serverless you need not to worry about that problem. What developer needs to do is just publish the Serverless function and the cloud service provider will attach more resources when needed and remove extra resources when they are not needed, which will cost you only for the time and exact computations that you used the resources.
The above two examples explain two advantages and user scenarios of using Serverless app development. From those two examples it is clear that Serverless app development will,
- Save Money
- Save Time
Serverless Computing can be identified as a Cloud computing model which abstracts the server management and infrastructure related details from the developer.
Building Serverless applications means that your developers can focus on their core product instead of worrying about managing and operating servers or runtimes, either in the cloud or on-premises. This reduced overhead lets developers reclaim time and energy that can be spent on developing great products which scale and that are reliable.-AWS
So what are cloud functions??
If you are familiar with cloud development you might be familiar with services like SaaS(Software as a Service), PaaS(Platform as a Service), CaaS (Container as a Service) and IaaS(Infrastructure as a Service). The newest member of this family is FaaS(Function as a Service). In Serverless development what we are having are functions. We write functions and we deploy the functions. Those functions will be triggered at necessary times and will provide the expected service to the users. So this is categorized under FaaS category.
Many of the cloud vendors have started providing support for serverless app development. AWS has Lambda, Microsoft has Azure Functions ,Google provides Google Cloud Functions and IBM provides OpenWhisk. Out of them I have used AWS Lambda and it’s really great.
There are several applications and frameworks that have been developed to support Serverless app development. “Serverless” Framework is one of them. In this article I’m not going to explain about haow to create a serverless application. I will do it in a next article. “Serverless” framework has made serverless app development much more easier. It supports developing Serverless function creation and deployments in AWS, AZURE, GCP and IBM OpenWhisk.
Another very useful application is Sigma Serverless application development platform. I found it very easy to create and deploy Serverless cloud functions with in minutes using Sigma. For beginners Sigma would be a great platform to start. It has a user friendly UI which allows you to drag and drop resources required for your function. It supports deploying your code to AWS Lambda and it also creates Github repo for the project so we can maintain and track the code.
So I think this is enough for this article. I will explain you how to create your first Serverless application in a next article. So this is what I have learnt about this “Serverless” application development. If you anything written here is wrong or misleading, please inform me :)
Serverless!! A way to go!!
Thanks for reading!! :) Please do comment if you have anything to add.