简体   繁体   English

使用AWS Lambda将API迁移到无服务器架构

[英]Migrating an API to a serverless architecture with aws lambda

I have an API that: 我有一个API:

  1. Get data from another API (isn't mine) 从另一个API获取数据(不是我的)
  2. Use that data 使用该数据
  3. Return processed data to the user 将处理后的数据返回给用户

I want to migrate my API to a serverless architecture with lambda, the issue is that getting that information from the API that isn't mine could take 2 seconds, and my operations with that data take 0,3 seconds. 我想将我的API迁移到具有lambda的无服务器架构,问题是从不是我的API那里获取信息可能需要2秒钟,而我对该数据的操作则需要0.3秒钟。 In lambda we must pay for the processing time that we use, but I'm just waiting most of the time. 在lambda中,我们必须为使用的处理时间付费,但是我大部分时间只是在等待。 Is there any way to mitigate this issue? 有什么办法可以减轻这个问题?

The pricing in AWS Lambda is a factor of AWS Lambda中的价格是

  • Number of requests 请求数
  • Actual execution time 实际执行时间
  • Max memory footprint that you configured 您配置的最大内存占用量

In your case you cannot do much about the 2 second wait time for calling your other API 就您而言,调用其他API的2秒等待时间不能做太多事情

Regarding your own processing time you can try out different memory footprint options to optimise the cost. 关于您自己的处理时间,您可以尝试不同的内存占用选项以优化成本。 Keep in mind that with increased memory you will be charged more but at the same time you get more processing power. 请记住,随着内存的增加,您将需要支付更多费用,但与此同时,您将获得更多的处理能力。 So eventually it might even turn out to be cheaper because your execution might get over quickly (although that may vary from case to case basis). 因此最终它可能甚至会变得更便宜,因为您的执行可能会很快结束(尽管具体情况可能会有所不同)。

So the crux is that you might be able to optimise your own processing time by playing around with different memory footprints but you can't do much about the waiting that you have to do for the other API call 因此,症结在于,您可以通过处理不同的内存占用空间来优化自己的处理时间,但对于等待其他API调用所要做的等待却无能为力

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 适用于 Lambda 无服务器架构的 AWS DynamoDB 与 RDS - AWS DynamoDB vs RDS for Lambda serverless architecture AWS和API网关上的Lambda架构 - Lambda architecture on AWS and API Gateway 在无服务器架构上使用AWS Lambda和S3切片音频文件 - Slice Audio files using AWS lambda and S3 on serverless architecture 如何使用AWS Lambda(无服务器架构)开发类似套接字的方法 - how to develop socket like approach with aws lambda (serverless architecture) 为什么您将使用AWS Lambda / API Gateway为无内容架构提供HTML内容而不是S3存储桶 - Why would you use AWS Lambda/API Gateway to serve up HTML content vs. S3 bucket for serverless architecture AWS无服务器架构 - 我为什么要使用API​​网关? - AWS serverless architecture – Why should I use API gateway? AWS Aurora 无服务器 mysql、Cognito、Lambda、API 网关、CloudFormation 启动器 - AWS Aurora serverless mysql, Cognito, Lambda, API gateway, CloudFormation starter Terraform 无服务器应用程序与 AWS Lambda 和 API 网关未知令牌? - Terraform Serverless Applications with AWS Lambda and API Gateway unknown token? 使用 API 网关和无服务器框架在 AWS Lambda 上超过了速率 - Rate Exceeded on AWS Lambda Using API Gateway and serverless framework AWS Lambda-使用.NET Core构建无服务器API - AWS Lambda - Building serverless API using .NET Core
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM