亞馬遜網路服務 – AWS Lambda中可用的虛擬處理器核心的最大數量是多少?
我試圖找到AWS Lambda中可用的最大虛擬處理器核心數.官方文件意味著它會隨著配置的記憶體量而縮放:
07000
但是,執行以下程式碼片段,即使配置了最大可用記憶體量:1536 MB,核心數為2.
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()錯誤地或錯誤地解釋其結果嗎?還是還有一些需要獲得更多核心的其他配置?
,AWS不會宣告AWS用於此服務的例項型別.在2014年底,AWS使用了類似於計算優化的例項.而現在,AWS使用類似通用目的的例項.
The CPU share dedicated to a function is based off of the fraction ofits allocated memory, per each of the two cores. For example, aninstance with ~ 3 GB memory available for lambda functions where eachfunction 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 thefuture, but that is the fractional nature of our usage model.
您只能利用與記憶體成比例的CPU功耗.儘管較低和較高的記憶體在相同的情況下,它們將共享比例CPU功率,這是更高的記憶體將獲得更多的CPU功率.如果你讀到的CPU總數是2,那並不意味著你可以充分利用所有的CPU.
目前,沒有辦法配置CPU.只有你可以調整的總記憶體.
程式碼日誌版權宣告:
翻譯自:http://stackoverflow.com/questions/34135359/whats-the-maximum-number-of-virtual-processor-cores-available-in-aws-lambda