GB-sec在AWS Lambda中是如何工作的?

huangapple go评论60阅读模式
英文:

How does GB-sec works in AWS lambda?

问题

如何在Lambda中使用AWS GB-SEC?
如果我理解正确,它是这样工作的:

  • 当接收到请求A时,它测量完成请求的时间和发送的数据大小,
    将其转换成GB和秒,相乘,这就是1个请求中使用的GB-SEC。

如果这是正确的,
那么在React中,GB-SEC是如何工作的,每个请求大约会使用多少?

如果这是正确的,
那么在React中,GB-SEC是如何工作的,每个请求大约会使用多少?

英文:

How does AWS GB-SEC works in lambda?
If I'm right, is this how it works:

  • when A request is received, it measures the time to complete the request and size of the data sent,
    converts it into GB and sec, multiplies, and thats the GB-SEC used in 1 request.

If thats correct,
So how does GB-SEC work in react, like how much will it use approx for each request?

If thats correct,
So how does GB-SEC work in react, like how much will it use approx for each request?

答案1

得分: 1

如果您在谈论 AWS Lambda 的定价,GB-sec 是指分配给函数的RAM数量,与请求大小没有直接关系,尽管请求的大小可能会影响需要分配给函数的RAM数量。如您可以在此处的价格表中看到,价格以每1毫秒的时间内的内存(MB)计算。

当您配置Lambda函数时,会配置一个RAM / 内存值。例如,您可以为函数配置1024MB(1GB)的RAM。然后,每次调用该函数时,将专门为函数在调用期间使用的1GB RAM分配。在此期间,AWS的其他客户无法利用这1GB RAM。您正在为函数保留一个物理资源,在函数执行时段内。亚马逊会根据您保留给函数的每毫秒时间收费。

假设您的函数需要100毫秒来完成一次调用,配置为使用1024MB RAM,并且同时进行两次调用。在这种情况下,您将被收费:

1024MB * 100ms * 2次调用

根据每1ms的1024MB RAM的ARM架构Lambda函数的当前费率为每0.0000000133美元,那将是:

$0.0000000133 * 100 * 2 = $0.00000266

当然,这种定价只有在您的AWS账户的每月免费用量超过400,000 GB-seconds后才会生效。

英文:

If you are referring to AWS Lambda pricing, GB-sec refers to how much RAM is allocated to the function, it is not directly related to request size, although the size of the request could certainly have an impact on how much RAM you will need to allocate to the function.

As you can see on the price table here the price is calculated in Memory (MB) per 1ms of time.

When you configure your Lambda function, you configure a RAM / Memory value. For example you may configure 1024MB (1GB) of RAM for your function. Each invocation of that function will then have 1GB of RAM allocated exclusively for the function's use during that invocation. During that time no other customer of AWS can utilize that 1GB of RAM. You are reserving a physical resource for your function, during the time the function is executing. Amazon charges you for each millisecond that you have that reserved for one of your function's invocations.

Imaging your function takes 100ms to complete an invocation, it is configured to use 1024MB of RAM, and you get two invocations simultaneously. In that scenario, you will be charged for:
> 1024MB * 100ms * 2 invocations

At the current rate of $0.0000000133 per 1ms for 1024MB of RAM for an ARM based Lambda function, that would be:

> $0.0000000133 * 100 * 2 = $0.00000266

Of course that pricing only kicks in after you have gone over the 400,000 GB-seconds monthly free-tier usage on your AWS account.

huangapple
  • 本文由 发表于 2023年5月26日 01:14:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/76334788.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定