简体   繁体   English

AWS Lambda Task在6.00秒后超时

[英]AWS Lambda Task timed out after 6.00 seconds

I am using serverless framework. 我正在使用无服务器框架。 My Lambda function connects to DynamoDB table for updating item in table. 我的Lambda函数连接到DynamoDB表以更新表中的项目。 Read & Write capacity units of table are 5 & auto_scaling is disabled. 表的读写容量单位为5,禁用auto_scaling。 AWS Lambda function has 128MB memory allocated. AWS Lambda函数分配了128MB内存。

I have used Jmeter for performance testing.I have sent 1000 requests concurrently and some response giving me perfect output while other giving internal server error(502 Bad Gateway). 我已经使用Jmeter进行性能测试。我已经同时发送了1000个请求,一些响应给了我完美的输出,而其他的则给出了内部服务器错误(502 Bad Gateway)。 i have also analyzed cloudwatch for logs and only get Task Timeout error. 我还分析了cloudwatch的日志,只获得了Task Timeout错误。 can anyone suggest me why i am getting this error and how to solve it? 任何人都可以建议我为什么我得到这个错误,以及如何解决它?

The default timeout for AWS Lambda functions when using the Serverless framework is 6 seconds. 使用无服务器框架时,AWS Lambda函数的默认超时为6秒。 Simply change that to a higher value as noted in the documentation : 只需将其更改为更高的值,如文档中所述:

functions:
  hello:
    ...
    timeout: 10 # optional, in seconds, default is 6

Since you mentioned that your DynamoDB table is provisioned with only 5 WCU this means that only 5 writes are allowed per second. 由于您提到您的DynamoDB表仅配置了5个WCU,这意味着每秒只允许5次写入。

DynamoDB does offer burst capacity allowing you to use 300 seconds worth of accumulated capacity (which at 5 WCU it is equivalent to 1500 total write requests) but as soon as those are exhausted it will start to throttle. DynamoDB确实提供突发容量,允许您使用300秒的累积容量(在5 WCU时它相当于1500个总写入请求)但是一旦耗尽它就会开始节流。

The DynamoDB client has automatic retries built in, with exponential backoff and it is smart enough to recognize throttling so it will slow down the retries to the point that a single write can easily take several seconds to complete successfully if it is being repeatedly throttled. DynamoDB客户端具有内置的自动重试功能,具有指数退避功能,并且足够智能以识别限制,因此它会减慢重试速度,使得单次写入在重复限制时可以轻松地成功完成几秒钟。

Your Lambda function is very likely timing out at 6 seconds because the function is waiting on retries to Dynamo. 您的Lambda函数很可能在6秒时超时,因为该函数正在等待重试Dynamo。

So, when doing load testing make sure that your dependencies are all scaled appropriately. 因此,在进行负载测试时,请确保您的依赖项都已适当缩放。 At 1000 requests per second you should make sure to scale the Read/Write capacity allocation for your DynamoDB table(s) and/or Index(s) accordingly. 在每秒1000个请求时,您应确保相应地扩展DynamoDB表和/或索引的读/写容量分配。

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

相关问题 在59.05秒后让Task超时aws lambda nodejs - getting Task timed out after 59.05 seconds aws lambda nodejs AWS Lambda “errorMessage”:任务在 3.00 秒后超时 - AWS Lambda “errorMessage”: Task timed out after 3.00 seconds AWS Lambda 任务在 3.00 秒后超时 - AWS Lambda Task timed out after 3.00 seconds “errorMessage”:任务在3.00秒后超时aws lambda nodejs lambda函数试图与RDS连接 - “errorMessage”: Task timed out after 3.00 seconds aws lambda nodejs lambda function trying to connect with RDS AWS Lambda Websocket 返回任务6秒后超时,但在本地工作 - AWS Lambda Websocket return task timed out after 6 seconds, but works locally 将 aws lambda 与 redis 连接时,任务在 23.02 秒错误后超时 - while connecting aws lambda with redis getting Task timed out after 23.02 seconds error WhatsApp 消息的 Lambda AWS 和 Twilio 出现“X 秒后任务超时”错误 - "Task timed out after X seconds" error with Lambda AWS and Twilio for WhatsApp message AWS Lambda任务超时 - AWS Lambda Task timed out AWS Lambda:任务超时 - AWS Lambda: Task timed out 使用 Gremlin 的 AWS Neptune 查询:如何解决错误“10.01 秒后任务超时”? - AWS Neptune queries using Gremlin: How to solve error "Task timed out after 10.01 seconds"?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM