Skip to main content

AWS 速率限制故障排除

如果你收到错误信息:

🌐 If you get an error message:

TooManyRequestsException: Rate Exceeded.

or

ConcurrentInvocationLimitExceeded

在调用 Lambda 函数时,这意味着你的并发限制已达到。

🌐 while calling a Lambda function, it means your concurrency limit has been reached.

  • 并发限制:每个账户每个区域可以同时运行的 Lambda 函数的最大数量。
  • 突发限制:10 秒内并发增加的最大数量(突发限制为 1000)

默认并发限制

🌐 Default concurrency limits

默认情况下,每个区域的并发限制是 1000 个函数,但在某些区域,突发限制只有 500,这在一定程度上限制了你可以使用的规模。

🌐 By default, the concurrency limit is 1000 functions per region, however in some regions the burst limit is only 500, somewhat limiting the scale you can use.

使用 AWS Lambda 的新账户

🌐 New accounts using AWS Lambda

根据 AWS 的说法,某些新使用 AWS Lambda 的账户在刚开始使用 AWS Lambda 时可能会获得非常低的并发限制,例如 10。在这种情况下,可以通过 AWS 控制台或 Remotion CLI(见下文)提高限制。

🌐 According to AWS, "some accounts" which are new to AWS Lambda might get a very low concurrency limit such as 10 when they first start with AWS Lambda. In that case, increase the limit via the AWS console or the Remotion CLI (see below).

解决方法

🌐 Workaround

如果你想在等待 AWS 批准更高并发限制的同时测试 Remotion Lambda,你可以向 framesPerLambda 传递一个更高的数字。

🌐 If you want to test Remotion Lambda while you are waiting for AWS to approve a higher concurrency limit, you can pass a higher number to framesPerLambda.

例如:如果你的账户当前的并发限制为 10,并且你想要渲染一个包含 900 帧的合成,你可以将 framesPerLambda 设置为 100
将会生成 9 个 Lambda 渲染器函数:900 / 100 = 9
还会生成一个用于编排的额外 Lambda 函数,这意味着总共将使用 10 个 Lambda 函数,从而保持在你的限制范围内。

🌐 For example: If your account currently has a concurrency limit of 10 and you want to render a composition with 900 frames, you can set framesPerLambda to 100.
9 Lambda renderer functions will be spawned: 900 / 100 = 9.
An additional Lambda function will be spawned for orchestration, meaning a total of 10 Lambda functions will be used, keeping yourself within your limit.

看清你的极限

🌐 See your limits

要看到你的极限,则运行

🌐 To see your limits, run

npx remotion lambda quotas
note

如果你遇到权限错误,请在设置指南中重复用户策略步骤,并在 AWS 控制台中更新你的用户策略文件。

请求增加

🌐 Request an increase

你可以在 https://console.aws.amazon.com/servicequotas/home 下请求配额增加,或使用 Remotion CLI

🌐 You can request a quota increase under https://console.aws.amazon.com/servicequotas/home or using the Remotion CLI:

npx remotion lambda quotas increase
note

这仅适用于 AWS Root 账户,而不适用于组织的子账户。你仍然可以通过控制台申请增加。

请查看这里 了解如果 AWS 问你为什么请求增加时的默认回答。

无助吗?

🌐 Unhelpful?

请联系 Remotion 团队,最好通过 Discord,我们将很乐意帮助你解决速率限制问题。

🌐 Contact the Remotion team, preferrably via Discord and we will be happy to help you with your rate limit problem.