DEV Community

Rohit joshi
Rohit joshi

Posted on

All about Serverless

What is Serverless?

Serverless computing is a cloud computing execution model in which the cloud provider runs the server, and dynamically manages the allocation of machine resources. Pricing is based on the actual amount of resources consumed by an application, rather than on pre-purchased units of capacity. Serverless helps you to build and run applications and services without thinking about servers. It eliminates infrastructure management tasks such as server or cluster provisioning, patching, operating system maintenance, and capacity provisioning. You can build them for nearly any type of application or backend service, and everything required to run and scale your application with high availability is handled for you.

How it works?

Serverless runs the code in the form of function which developer write. Developer can create any kind of functions in any language. Function is just like the piece of code or snippet which serverless execute in serverless environment. Serverless helps to provide more reliability even application reaches huge amount of load,we don't need to worry about setting up Load Balancer and AutoScaling. We never need to know how cloud providers are managing the load and executing our code in backend.

What type of application you deploy on serverless?

Serverless allows you to create and deploy various kind of backend services.

  • You can create Rest APIs for your websites and mobile apps.
  • You can create websockets APIs for your websites and mobile apps.
  • You can deploy backend of your iOT devices.
  • Even you can deploy frontend of your website.

Serverless cloud provider

Most Cloud Providers have started providing the server-less support on their infrastructure and still they are investing huge amount to evolve the serverless.

Top serverless providers

Let's understand in Detail

  • AWS Lambda: Lambda is an event-driven, serverless computing platform provided by Amazon as a part of Amazon Web Services. It is a computing service that runs code in response to events and automatically manages the computing resources required by that code. It was introduced in November 2014.

  • Azure Functions: The service launched in 2016 to compete with AWS Lambda. Azure Functions offers a similar set of services to Amazon, with a focus on the Microsoft family of languages and tools. If you are interested in the application structure and how it performs on Azure, you may check the volume report containing detailed information on analytics and expenses.

  • Google cloud Functions: Google Cloud Functions is a serverless execution environment for building and connecting cloud services. With Cloud Functions you write simple, single-purpose functions that are attached to events emitted from your cloud infrastructure and services.It was introduced in March 2017 but during 2018, Google managed to fix earlier mistakes as evidenced by GCF release notes.

  • IBM Cloud Functions:Relatively new to the serverless genre, IBM stepped into the game with a competitive set of services to offer. IBM Cloud Functions is the only managed infrastructure solution by OpenWhisk within their cloud services. But if you prefer an open-source solution, Apache OpenWhisk would be a more suitable option.

Pricing Model

Most FaaS providers use the pay-per-execution pricing model, which is quite cost-effective. To calculate the costs of your app, there are services that predict your potential expenses pretty accurately. Serverlesscalc is a tool, which can help you to calculate the costs of top serverless providers. But, every provider has its own calculation tool:

Alt Text

Free-tier in detail

AWS Lambda free usage tier includes 1M free requests per month and 400,000 GB-seconds of compute time per month. All the requests that go beyond the limit of a free-tier are billed at $0.00001667/GB-s, which is the lowest price on the market. In real-world practice, free-tier allows running your app long enough before billing starts. Resources allocated (memory and CPU) are billed as a single unit, because both are growing proportionally. Additional expenses may be derived from usage of other AWS services within your Lambda function.

Azure is billed the same way as Lambda, with the only difference of $0.000016/GB-s, but free-tier is identical. The heavy-load costs on Azure are a little bit lower than Lambda and equal to Lambda for the average load. But Microsoft prefers to bill consumed memory rather than allocated.
Azure also offers lower pricing for Windows and SQL usage, which is pretty logical. So, the choice between the two depends on the environment you use more than the costs you incur.

Google Cloud Functions free-tier is 2 million requests per month with the same 400,000 GB-s, and $0.0000004 per request after it, with networking traffic included. Considering the length of time a function runs and the number of requests, expenses with Google Cloud Functions is notably higher. As for the resources, GCF is different, because they bill allocated memory and CPU separately.

IBM cloud functions has its free-tier similar to Lambda and Azure at 400,000 GB-s and 1 million requests. Pricing above the threshold is calculated at $0.000017 GB-s per invocation. As for the billing factors, IBM OpenWhisk bills the resources consumed while the function was active.
Summing up, AWS Lambda proposes a middle-ground in pricing, while Azure can vary in expenses, dependent on CPU and memory used. But for Windows environments, Azure offers the lowest price.

Programming Languages Supported

The FaaS provider is a public cloud, which means you are running your app in a managed environment, and every vendor offers support for different languages.

AWS Lambda covers a wide range or programming languages including Node.js runtime, Python, Java, and languages compiled to it, and .NET languages (C#, Visual Basic and F#).

Azure Functions Functions obviously keep the focus on Microsoft’s family of languages and lists JavaScript and languages compiled to it, Node.js runtime, C#, F#, Python, PHP, Bash, Batch, and PowerShell.

Google Cloud Functions used to support only JavaScript, but it was announced that many other languages are going through beta testing so that, in a long-time perspective, GCF service has a chance to keep up with other major vendors. But, as for now, it doesn’t look like a reliable choice.

IBM Cloud Functions the service currently supports Node.js runtime, Swift, Java, PHP, and Python. But it is possible to integrate any programming language with Docker containers.

Alt Text


Top comments (0)