AWS Lambda中可用的虚拟处理器核心最大数量是多少? [英] What's the maximum number of virtual processor cores available in AWS Lambda?

查看:141
本文介绍了AWS Lambda中可用的虚拟处理器核心最大数量是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试找到AWS Lambda中可用的虚拟处理器核心的最大数量.官方文档暗示它会随着配置的内存量而扩展:

I'm trying to find the maximum number of virtual processor cores available in AWS Lambda. The official documentation implies that it scales with the amount of configured memory:

在AWS Lambda资源模型中,选择所需的内存量 需要您的功能,并分配了成比例的CPU功率和 其他资源.例如,选择256MB内存分配 Lambda函数的CPU能力大约是Lambda函数的两倍 要求128MB的内存和一半的CPU能力 512MB的内存.

In the AWS Lambda resource model, you choose the amount of memory you want for your function, and are allocated proportional CPU power and other resources. For example, choosing 256MB of memory allocates approximately twice as much CPU power to your Lambda function as requesting 128MB of memory and half as much CPU power as choosing 512MB of memory.

但是,即使我配置了请求的最大内存量:1536 MB,运行以下代码片段仍会导致我Number of cores = 2.

However, running the following snippet gets me Number of cores = 2 even if I configure the highest amount of memory requestable: 1536 MB.

package example;

import java.io.{ InputStream, OutputStream }

class Main {
  def main(input: InputStream, output: OutputStream): Unit = {   
    val result = "Number of cores = " + Runtime.getRuntime().availableProcessors()
    output.write(result.getBytes("UTF-8"))
  }
}

那么这是怎么回事?我使用availableProcessors()错误还是错误地误解了其结果?还是需要其他一些配置以获得更多内核?

So what's going on here? Am I using availableProcessors() wrong or misinterpreting its result incorrectly? Or are there some other configurations that's need to get more cores?

推荐答案

根据AWS Lambda 论坛,AWS未声明AWS用于此服务的实例类型. 2014年底,AWS使用了类似 compute-optimize 的实例.现在,AWS使用类似于通用的实例.

As per AWS Lambda documentation and forum, AWS doesn't state which instance types that AWS uses for this service. In the end of 2014, AWS used compute-optimize-like instances. And now, AWS uses general-purposes-like instances.

专用于该功能的CPU份额基于以下部分: 每个核心的分配内存.例如, 具有约3 GB内存的实例可用于lambda函数,其中每个函数 函数最多可以有1 GB的内存,这意味着您最多可以利用〜 1/3 * 2内核= CPU的2/3.有关详细信息,请参阅 未来,但这就是我们的使用模式的部分性质.

The CPU share dedicated to a function is based off of the fraction of its allocated memory, per each of the two cores. For example, an instance with ~ 3 GB memory available for lambda functions where each function can have up to 1 GB memory means at most you can utilize ~ 1/3 * 2 cores = 2/3 of the CPU. The details may be revisited in the future, but that is the fractional nature of our usage model.

您只能利用与内存成比例的CPU能力.尽管较低和较高的内存在同一实例中,但是它们将共享成比例的CPU能力,这是较高的内存将获得更多的CPU能力.如果您读取的CPU内核总数为2,则并不意味着您可以充分利用所有CPU.

You can only utilize the CPU power proportional to the memory. Although, the lower and higher memory are in a same instance, they will share proportional CPU power, which is the higher memory will get more CPU power. If you read your total CPU cores is 2, it doesn't mean that you can fully utilize all of the CPU.

当前,无法配置CPU.您只能调整总内存.

Currently, there is no way to configure CPU. Only total memory that you can adjust.

这篇关于AWS Lambda中可用的虚拟处理器核心最大数量是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆