英文:
Lambda one container per invocation vs ECS thousands of invitations per container?
问题
AWS Lambda每次只会在每个容器上执行一个请求吗?并发会为每个请求分配单独的容器吗?
一个单独的ECS容器可以处理数百或数千个并发请求。
为什么一个单一的Lambda容器不能同时处理多个调用?还是我理解有误?
英文:
Is it correct that AWS Lambda will execute only one request on each container at a time? Concurrency allocates separate containers for each request?
An single ECS container can process hundreds or thousands of concurrent requests though.
Why can't a single Lambda container process multiple invocations at once? Or am I misunderstanding?
答案1
得分: 2
Lambda容器每次只能处理一个请求。容器可以在当前请求完成后重复使用于另一个请求,但只有在当前请求完成后才能这样做。Fargate和Lambda都在内部使用Firecracker,但Lambda针对可以更快提供的短期容器进行了优化。
根据文档:
并发是您的AWS Lambda函数同时处理的正在进行的请求的数量。 对于每个并发请求,Lambda会为您的执行环境提供一个单独的实例。随着您的函数接收到更多请求,Lambda会自动处理扩展执行环境的数量,直到达到您账户的并发限制。默认情况下,Lambda为您的账户在一个地区的所有函数提供了总并发限制为1,000。为了支持您的特定账户需求,您可以请求增加配额,并配置函数级别的并发控制,以确保您的关键函数不会遭受限制。
当Lambda完成处理第一个请求时,该执行环境然后可以处理相同函数的其他请求。对于后续的请求,Lambda不需要重新初始化环境。
英文:
That's correct. Lambda containers can only process one request at a time. A container can be reused for another request, but only after the current request is done. Both Fargate and Lambda use Firecracker internally, but Lambda is optimized for short term containers that can be provisioned faster.
From the documentation:
> Concurrency is the number of in-flight requests your AWS Lambda function is handling at the same time. For each concurrent request, Lambda provisions a separate instance of your execution environment. As your functions receive more requests, Lambda automatically handles scaling the number of execution environments until you reach your account's concurrency limit. By default, Lambda provides your account with a total concurrency limit of 1,000 across all functions in a region. To support your specific account needs, you can request a quota increase and configure function-level concurrency controls so that your critical functions don't experience throttling.
> When Lambda finishes processing the first request, this execution environment can then process additional requests for the same function. For subsequent requests, Lambda doesn't need to re-initialize the environment.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论