Is your application undergoing the journey of migration to the cloud? Are you too looking for cloud service providers to enhance your application? Well, this article is a must-read for you.
Moving to the cloud is the new normal in a tech-savvy environment. Who does work on on-premise tools and applications? But it does not spare the organizations from mismanaging their migration process and ending up paying a huge amount of money for the cloud services used. Not everything needs to be on the cloud.
While you are busy cherry-picking the applications and services to move, you often refrain from questioning the vitality of the cloud services, platforms, applications purchased. To answer such questions, a new concept of serverless architecture is introduced. Serverless architecture or FaaS (Function as a Service) let you deploy an individual “function”, logic or a piece of business logic. They are expected to start within milliseconds, process individual requests, and then the requests end.
The major advantage of using it over traditional, server-based solutions or complete solutions on the cloud is reduced costs of building and running software systems. Though it may appear to be cost-saving, IT operations may not be cheaper for all workloads.
To gear you up for a more advanced version of cloud utilization, let’s critically analyze the essentials of serverless architecture.
Money-Saving pay-per-use FaaS
With the launching of AWS Lambda by amazon web services, FaaS is going to be another milestone in the evolution of cloud computing. It will change how we deploy and operate software systems in the future. This pay-per-use model is used by FaaS services such as AWS Lambda and Azure Functions. It is a key argument in building cloud-native systems.
Actual pricing involved for function execution
Currently, invocation costs of function are incredibly cheap (20 cents for a million invocations for both AWS Lambda and Azure Functions). However, it is not the entire cost of providing such a service. It is not even the vital element in the total cost associated with FaaS computing.
The execution of function takes up significant compute resources. Both AWS and Azure charge for the allocated memory and execution time (rounded up to 100 milliseconds) of the function. While, AWS charges $0.00001667 for every GB-sec used, Azure Functions charge $0.000016 for every GB-sec used. The unit price might seem low but look out for the rising costs.
The amount of allocated memory varies between 128MB to 1.5GB depending upon the configuration. The cost of the most effectiuve configuration for 100ms of execution time will be more expensive as 12 times than that of the basic 128MB configuration.
Even, after considering these factors, the costs of AWS Lambda are approx $1.25 for 500ms execution time, 128MB memory, and 1 million function invocation.
Free Trial Version to Familiarise FaaS
AWS and Azure are trying to lure people with a lucrative free offer of 1mn invocations and 400,000GB-sec each month. It is enough to run a function using 128MB memory round the clock for the entire month.
Price competition between FaaS and IaaS
Cloud providers have also lowered the cost of IaaS. A tiny instance of AWS IaaS will cost only $4.25 for an entire month. It is better and cheaper than running a function continuously for a month. It would be a mistake to use FaaS for large instances where high processing power is needed to process through a large volume of data.
Real-world workloads show moderate load fluctuations. For this, additional load-balanced instances have to be commissioned that increases the costs per hour. So, most companies use some form of container-based capacity provisioning. Substantial savings are offered by cloud providers for committing a compute infrastructure for a year or few years in advance. But isn’t this similar to the old traditional way of stacking up the on-premise applications?
On the other hand, FaaS provides on-demand compute capacity that costs as per usage. It fosters out-of-the-box scalability and availability.
Evidence of price reduction when going serverless
For running an AWS-based 3-tier web application that serves 100,000 page views a month. It would require a minimum load balancer, 2 web servers, 2 application servers, and an all-time available database server. The solution would require other services such as DynamoDB, Route53, and CloudFront. It is estimated to transfer 120 GB of data each month.
The total cost for these would be $894.45 per month, of which EC2 accounts for 55% and Database services accounts for the rest.
Using Serverless Architecture, prices will fall drastically. Assuming a sluggish 3 second processing time for every page view and 1 GB of memory allocation, the cost of AWS Lambda would be approx $5.
The Pitfall in optimizing infrastructure as a Service (IaaS)
If you counter the above example with optimizing IaaS, the following are the major setbacks:
- You will end up with a long-term commitment to keep your solution online.
- You will introduce potential capacity problems due to the introduction of unfit infrastructure.
Not only IaaS, but FaaS also has its cons too
Regardless of cost saving capabilities, there are the following watchpoints while using a serverless architecture.
- No guarantee of cost-saving: There are some processes and workloads which require substantial computing resources that nullify the cost-effectiveness of FaaS. Functional and technical requirements should be reviewed and matched against the limitations associated with the FaaS environment. Proactively, cost calculation is required before implementing it.
- Watch out for retires: If a function fails, it would be retired till the event restores. So it’s important to check costs regularly to scrutinize any sudden spike in infrastructure costs.
- Overheads: Some applications such as AWS Kinesis and DynamoDB require provisioned capacity that leads to overheads if improperly managed. Luckily, it is possible to manage AWS using SDK using which an automated capacity regulatory solution can be built.
In a Nutshell
While economic benefit is eye-catching but it should not be the only criteria to consider FaaS offerings. The prime objective should be to build small, independent, and focused business unit that can be delivered quickly and cheaply. Keep a sharp eye on how serverless computing can benefit your cloud architecture.
To learn more about how you can incorporate FaaS in your existing solution, get in touch with us at firstname.lastname@example.org .