简体   繁体   English

AWS Lambda 函数如何在 VPC 子网内扩展?

[英]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.

相关问题 私有子网内的 lambda function 可以通过 vpc 端点访问 vpc 外部的 aws 服务吗? - can a lambda function inside a private subnet access aws services outside the vpc through vpc endpoints? 如何通过位于同一 vpc 和私有子网内的 lambda function 在 vpc 内向 emr 集群添加步骤? - How to add a step to emr cluster within a vpc through lambda function which is inside a same vpc and private subnet? 为什么 VPC 中公共 su.net 内的 AWS lambda function 无法连接到 inte.net? - Why can't an AWS lambda function inside a public subnet in a VPC connect to the internet? 带VPC的AWS Lambda函数仅在私有子网中有效 - AWS Lambda Function with VPC only works when in Private Subnet 子网内的 Lambda 如何访问 VPC 端点? - How does Lambda within subnet access VPC endpoint? 如何使用 VPC 链接和 VPC 端点从私有子网内的 Lambda 响应 API 网关 Web 套接字 - How to respond from a Lambda inside Private Subnet to a API Gateway Web Socket, using VPC Link and VPC Endpoint AWS VPC 中的公有子网是什么意思? - What does public subnet mean in AWS VPC? 如何在账户 B 中调用 AWS Lambda function(此 Lambda 在 VPC 中)从 Z04A7DA3C5B04CAD85DA3EBB9231 中的账户 - How to invoke AWS Lambda function in account B (this Lambda in VPC) from Lambda in account A (Lambda in VPC) 如何允许私有子网VPC中的AWS Lambda资源在不使用NAT的情况下与Internet通信? - How do I allow AWS lambda resources in a private subnet VPC to communicate with the internet without using a NAT? AWS:如何为默认VPC创建专用子网 - AWS: how to create a private subnet to the default VPC
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM