2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

lambdaのメモリとCPU数はどこが切れ目なのか調べてみた

Posted at

すでにほかの記事でも触れられていますが、lambdaはメモリを増やすとCPUが増えるようです。

https://qiita.com/hamadu/items/12303d9f9cb800db14d3
https://aws.amazon.com/jp/lambda/faqs/

128MBでもすでに2つ割り当てられていたり最大でも6つだったりどこが区切れなのか調べてみました。

ソースコードは以下に置いてあります。

結果

128MBごとに増やした結果です。ざっくりいうと3GB,5GB,7GB,9GBでスレッドが一つ増えるみたいです。

visualization.png

vega-light
{
	"data": {
		"values": [
			{
				"a": 128,
				"b": 2
			},
			{
				"a": 256,
				"b": 2
			},
			{
				"a": 384,
				"b": 2
			},
			{
				"a": 512,
				"b": 2
			},
			{
				"a": 640,
				"b": 2
			},
			{
				"a": 768,
				"b": 2
			},
			{
				"a": 896,
				"b": 2
			},
			{
				"a": 1024,
				"b": 2
			},
			{
				"a": 1152,
				"b": 2
			},
			{
				"a": 1280,
				"b": 2
			},
			{
				"a": 1408,
				"b": 2
			},
			{
				"a": 1536,
				"b": 2
			},
			{
				"a": 1664,
				"b": 2
			},
			{
				"a": 1792,
				"b": 2
			},
			{
				"a": 1920,
				"b": 2
			},
			{
				"a": 2048,
				"b": 2
			},
			{
				"a": 2176,
				"b": 2
			},
			{
				"a": 2304,
				"b": 2
			},
			{
				"a": 2432,
				"b": 2
			},
			{
				"a": 2560,
				"b": 2
			},
			{
				"a": 2688,
				"b": 2
			},
			{
				"a": 2816,
				"b": 2
			},
			{
				"a": 2944,
				"b": 2
			},
			{
				"a": 3072,
				"b": 3
			},
			{
				"a": 3200,
				"b": 3
			},
			{
				"a": 3328,
				"b": 3
			},
			{
				"a": 3456,
				"b": 3
			},
			{
				"a": 3584,
				"b": 3
			},
			{
				"a": 3712,
				"b": 3
			},
			{
				"a": 3840,
				"b": 3
			},
			{
				"a": 3968,
				"b": 3
			},
			{
				"a": 4096,
				"b": 3
			},
			{
				"a": 4224,
				"b": 3
			},
			{
				"a": 4352,
				"b": 3
			},
			{
				"a": 4480,
				"b": 3
			},
			{
				"a": 4608,
				"b": 3
			},
			{
				"a": 4736,
				"b": 3
			},
			{
				"a": 4864,
				"b": 3
			},
			{
				"a": 4992,
				"b": 3
			},
			{
				"a": 5120,
				"b": 3
			},
			{
				"a": 5248,
				"b": 3
			},
			{
				"a": 5376,
				"b": 4
			},
			{
				"a": 5504,
				"b": 4
			},
			{
				"a": 5632,
				"b": 4
			},
			{
				"a": 5760,
				"b": 4
			},
			{
				"a": 5888,
				"b": 4
			},
			{
				"a": 6016,
				"b": 4
			},
			{
				"a": 6144,
				"b": 4
			},
			{
				"a": 6272,
				"b": 4
			},
			{
				"a": 6400,
				"b": 4
			},
			{
				"a": 6528,
				"b": 4
			},
			{
				"a": 6656,
				"b": 4
			},
			{
				"a": 6784,
				"b": 4
			},
			{
				"a": 6912,
				"b": 4
			},
			{
				"a": 7040,
				"b": 4
			},
			{
				"a": 7168,
				"b": 5
			},
			{
				"a": 7296,
				"b": 5
			},
			{
				"a": 7424,
				"b": 5
			},
			{
				"a": 7552,
				"b": 5
			},
			{
				"a": 7680,
				"b": 5
			},
			{
				"a": 7808,
				"b": 5
			},
			{
				"a": 7936,
				"b": 5
			},
			{
				"a": 8064,
				"b": 5
			},
			{
				"a": 8192,
				"b": 5
			},
			{
				"a": 8320,
				"b": 5
			},
			{
				"a": 8448,
				"b": 5
			},
			{
				"a": 8576,
				"b": 5
			},
			{
				"a": 8704,
				"b": 5
			},
			{
				"a": 8832,
				"b": 5
			},
			{
				"a": 8960,
				"b": 6
			},
			{
				"a": 9088,
				"b": 6
			},
			{
				"a": 9216,
				"b": 6
			},
			{
				"a": 9344,
				"b": 6
			},
			{
				"a": 9472,
				"b": 6
			},
			{
				"a": 9600,
				"b": 6
			},
			{
				"a": 9728,
				"b": 6
			},
			{
				"a": 9856,
				"b": 6
			},
			{
				"a": 9984,
				"b": 6
			},
			{
				"a": 10112,
				"b": 6
			},
			{
				"a": 10240,
				"b": 6
			}
		]
	},
	"mark": "line",
	"encoding": {
		"x": {
			"field": "a",
			"type": "nominal",
			"axis": {
				"labelAngle": 0
			}
		},
		"y": {
			"field": "b",
			"type": "quantitative"
		}
	}
}

感想

メモリ増やせばCPUも増えるなんて知らなかった。
qiitaでもvega書ければいいのになあ。

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?