"Reduce cost or Increase performance ? Why not both : Thanks to Lambda tweaking!!"

"Reduce cost or Increase performance ? Why not both : Thanks to Lambda tweaking!!"


Contents : Serverless Architecture + Lambda tweaking + Load Testing + Run comparison


The main advantage of using Serverless architecture/components is that there are ?? ???????????? that come with serverless :

1 - No need to provision or manage any servers.

2 - NEVER pay for idle resources.

3 - Autoscales, no need to manage scaling.

4 - Inherently highly available.


?????? ????????????????????????/?????????? - brief version

1 - IAM policy and role - Access to DDB, Cloudwatch.

2 - Lambda - create the function CRUD logic resides here.

3 - APIG - Create a REST API - POST method (due to payload to enter items or list DDB items).

4 - DynamoDB - Create table.

5 - POSTMAN - to test API calls and Load testing simulation.



Serverless Microservice Architecture




???????? ??????????????


Using POSTMAN to simulate - Run vCPUs for a certain duration.


???????????????? ?? - The default 128-512 MB Lambda memory - 20 vCPUs for 2 minutes

???????????????? ?? - 512-1024 MB Lambda memory - 20 vCPUs for 2 minutes




Lambda Function

Note that you can go to the Lambda function, and tweak it under “Configuration” as per the screenshot and edit as needed.


?????????????? :

POSTMAN has this “Compare Runs ” feature that I have added in the screenshot that shows both runs together and displays the differences in stats.



2nd run (More memory) clearly showing better stats.


????????????????????:

The allocated memory for a lambda function is directly proportional to the vCPUs and hence computer capacity behind it, so the tradeoff is using more memory for less duration of the lambda function. So where many may think that more memory invites more cost, it also reduces your computation time which is what Lambda is charged for!


Lambda tweaking is how you can get a balance between cost optimization and performance efficiency.


???????? : I will be posting a detailed(techy) version of this hands-on soon to help you be able to set it up from scratch and load test yourself, play around with lambda and this serverless architecture.


If you have any questions, suggestions for future posts, feel free to reach out, I‘ll be happy to help from my experience!


#AWS #Serverless #Microservice #CostOptimization #PerformanceEfficiency


Ajay Pandey

Solution Architect @Telus Digital-|AWS| System Design| Solution Architecture |DevOps & Cloud | Kubernetes| CI/CD| Terraform| GCP| HA| Scalability| Reliability| Security | Cost Optimization | Disaster Recovery

4 个月

Good one Arnauv. There is always a trade of between cost and performance while building highly available and scalable architecture but this one really loved it.

Astha Sethi

Data Analyst @ OpenSky Data Systems | Microsoft Certified: Power BI Data Analyst Associate

4 个月

Insightful

Amit Kumar

AWS Solution Architect | 3X AWS | Terraform | Kubernetes | EKS | DXC Diamond Award Winner

4 个月

Very informative Arnauv!! Thanks for sharing.

要查看或添加评论,请登录

Arnauv Kaushik的更多文章

社区洞察

其他会员也浏览了