[英]How does an AWS Lambda function scale inside a VPC subnet?
I understand the AWS Lambda is a serverless concept wherein a piece of code can be triggered on some event.我知道 AWS Lambda 是一个无服务器概念,其中可以在某个事件上触发一段代码。
I want to understand how does the Lambda handle scaling?我想了解 Lambda 如何处理缩放?
For eg.例如。 if my Lambda function sits inside a VPC subnet as it wants to access VPC resources, and that the subnet has a CIDR of
192.168.1.0/24
, which would result in 251
available IPs after subtracting the AWS reserved 5 IPs如果我的 Lambda 函数位于 VPC 子网内,因为它想要访问 VPC 资源,并且该子网的 CIDR 为
192.168.1.0/24
,这将在减去 AWS 保留的 5 个 IP 后得到251
可用 IP
Would that mean if my AWS Lambda function gets 252 invocations at the exact same time,这是否意味着如果我的 AWS Lambda 函数同时获得 252 次调用,
Only 251 of the requests would be served and 1 would either timeout or will get executed once one of the 252 functions completes execution?只有 251 个请求会得到服务,1 个请求要么超时,要么在 252 个函数之一完成执行后被执行?
Does the Subnet size matter for the AWS Lambda scaling?子网大小对于 AWS Lambda 扩展是否重要?
I am following this reference doc which mentions concurrent execution limits per region,我正在关注这个参考文档,其中提到了每个区域的并发执行限制,
Can I assume that irrespective of whether an AWS Lambda function is No VPC or if it's inside a VPC subnet, it will scale as per mentioned limits in the doc?我是否可以假设无论 AWS Lambda 函数是无 VPC 还是在 VPC 子网内,它都会按照文档中提到的限制进行扩展?
Vladyslav's answer is still technically correct (Subnet size does matter), but things have changed significantly since it was written and subnet size is much less of a consideration. Vladyslav 的答案在技术上仍然是正确的(子网大小确实很重要),但是自从编写它以来情况发生了重大变化,并且子网大小的考虑因素要少得多。 See aws' announcement :
查看aws 的公告:
- Because the network interfaces are shared across execution environments, typically only a handful of network interfaces are required per function.
由于网络接口在执行环境之间共享,通常每个功能只需要少数网络接口。 Every unique security group:subnet combination across functions in your account requires a distinct network interface.
您帐户中跨功能的每个独特的安全组:子网组合都需要一个独特的网络接口。 If a combination is shared across multiple functions in your account, we reuse the same network interface across functions.
如果您帐户中的多个功能共享一个组合,我们会在功能之间重复使用相同的网络接口。
- Your function scaling is no longer directly tied to the number of network interfaces and Hyperplane ENIs can scale to support large numbers of concurrent function executions
您的功能扩展不再与网络接口的数量直接相关,并且 Hyperplane ENI 可以扩展以支持大量并发功能执行
Yes, you are right.你是对的。 Subnet size definitely does matter, you have to be careful with your CIDR blocks.
子网大小肯定很重要,您必须小心处理 CIDR 块。 With that one last invocation (252nd), it depends on the way your lambda is invoked: synchronously (eg API Gateway) or asynchronously (eg SQS).
对于最后一次调用(第 252 次),它取决于调用 lambda 的方式:同步(例如 API 网关)或异步(例如 SQS)。 If it is called synchronously, it'll be just throttled and your API will respond with 429 HTTP status, which stands for "too many requests".
如果它被同步调用,它只会受到限制,您的 API 将以 429 HTTP 状态响应,这代表“请求过多”。 If it is asynchronous, it'll be throttled and will be retried within a six hour period window.
如果它是异步的,它将被限制并在六小时的时间段内重试。 More detailed description you can find on this page .
您可以在此页面上找到更详细的说明。
Also I recently published a post in my blog, which is related to your question.此外,我最近发表了一篇帖子在我的博客,这是关系到你的问题。 You may find it useful.
你可能会发现它很有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.