search
LoginSignup
7

More than 1 year has passed since last update.

posted at

updated at

メモリ上限10Gで Lambdaのコア数はどうなった!!(Re:Invent2020対応版)

余談

TISという会社に所属している、小西です。
昨年は、Re:Invent2019 に初めて行き、まさに「熱量」を感じる機会を得られましたが、
今年は、普通に業務で、セミナーはあまり聞けませんが、新機能をウォッチしていきたいなと思います。
3年近くサーバレスをやってきたので、サーバレスをウォッチしていきたい。

概要

Re:Invent 2020 で、High Performance Lambdaがリリースされ、メモリー上限が10Gとなり、コア数も最大6コアになりました。
ただ、メモリー設定でどうコア数が変わるかは公開されていないので実際に確認してみました。

なお、Re:Invent 2020 で、メモリー設定が64MBステップから1MBステップに変わったのですが、
検証は、64MBステップで行っているので、正確な切り替わりポイントでない可能性があります。すいません。

結論

以下の通り、最低2コアで、3Gから2G毎にコア数が上がるようです。
これまで、1536Mまで1コアでそれ以上が2コアだったようですが、大きく変更となりましたね。
課金単位も変わりましたが、実質的に値下げと言えるかもしれませんね。

これで、LambdaでFFmpegなどでの音声・動画の変換など、長時間処理でタイム・アウトしていた処理も十分実行できそうですね。
まだ使っていませんが、AVX2もつかえるようになったのも嬉しいですよね。

image.png
追記:これまで、どこまで1コアだったのかは、あいまいなようです。クラメソさんの記事 では、 1792MBまで1コアだったようです

memory cors
128 2
192 2
256 2
320 2
384 2
448 2
512 2
576 2
640 2
704 2
768 2
832 2
896 2
960 2
1024 2
1088 2
1152 2
1216 2
1280 2
1344 2
1408 2
1472 2
1536 2
1600 2
1664 2
1728 2
1792 2
1856 2
1920 2
1984 2
2048 2
2112 2
2176 2
2240 2
2304 2
2368 2
2432 2
2496 2
2560 2
2624 2
2688 2
2752 2
2816 2
2880 2
2944 2
3008 2
3072 3
3136 3
3200 3
3264 3
3328 3
3392 3
3456 3
3520 3
3584 3
3648 3
3712 3
3776 3
3840 3
3904 3
3968 3
4032 3
4096 3
4160 3
4224 3
4288 3
4352 3
4416 3
4480 3
4544 3
4608 3
4672 3
4736 3
4800 3
4864 3
4928 3
4992 3
5056 3
5120 3
5184 3
5248 3
5312 4
5376 4
5440 4
5504 4
5568 4
5632 4
5696 4
5760 4
5824 4
5888 4
5952 4
6016 4
6080 4
6144 4
6208 4
6272 4
6336 4
6400 4
6464 4
6528 4
6592 4
6656 4
6720 4
6784 4
6848 4
6912 4
6976 4
7040 4
7104 5
7168 5
7232 5
7296 5
7360 5
7424 5
7488 5
7552 5
7616 5
7680 5
7744 5
7808 5
7872 5
7936 5
8000 5
8064 5
8128 5
8192 5
8256 5
8320 5
8384 5
8448 5
8512 5
8576 5
8640 5
8704 5
8768 5
8832 5
8896 6
8960 6
9024 6
9088 6
9152 6
9216 6
9280 6
9344 6
9408 6
9472 6
9536 6
9600 6
9664 6
9728 6
9792 6
9856 6
9920 6
9984 6
10048 6
10112 6
10176 6
10240 6

実施手順(メモ)

Lambdaを配置

'use strict';
let response;
const { promisify } = require('util');
const proc = require('node-proc');
exports.lambdaHandler = async (event, context) => {

    const meminfo = await promisify(proc.meminfo)();
    const cpuinfo = await promisify(proc.cpuinfo)();
    const uptime = await promisify(proc.uptime)();
    const netdev = await promisify(proc.netdev)();

    return { 
        meminfo,
        cpuinfo,
        uptime,
        netdev
     };
};

Bash でメモリー設定を変えながらInvoke

for ((i=2; i<=160; i++))
do
aws lambda update-function-configuration --function-name lambda-proc-info --memory-size $(($i*64))
aws lambda invoke                        --function-name lambda-proc-info --payload '{}' $(($i*64)).json
done

jq等で加工(雑)

for ((i=2; i<=160; i++))
do
jq ".+ {memory_setting: $(($i*64))}" $(($i*64)).json > $(($i*64))-append-memorysetting.json
done

jq -s . *-append-memorysetting.json > mem-all.json
jq '[.[]| .+ {cpucount:  (.cpuinfo|length)}]' mem-all.json >mem-all-addcount.json
jq "sort_by(.memory_setting)" mem-all-addcount.json >mem-all-sort.json

参考

Lambda実行結果(128MB)

{
  "meminfo": {
    "MemTotal": 197091328,
    "MemFree": 72437760,
    "MemAvailable": 152174592,
    "Buffers": 4161536,
    "Cached": 79679488,
    "SwapCached": 0,
    "Active": 36524032,
    "Inactive": 66400256,
    "Active(anon)": 19099648,
    "Inactive(anon)": 208896,
    "Active(file)": 17424384,
    "Inactive(file)": 66191360,
    "Unevictable": 0,
    "Mlocked": 0,
    "SwapTotal": 0,
    "SwapFree": 0,
    "Dirty": 139264,
    "Writeback": 0,
    "AnonPages": 19107840,
    "Mapped": 58335232,
    "Shmem": 212992,
    "Slab": 12840960,
    "SReclaimable": 3362816,
    "SUnreclaim": 9478144,
    "KernelStack": 1449984,
    "PageTables": 1335296,
    "NFS_Unstable": 0,
    "Bounce": 0,
    "WritebackTmp": 0,
    "CommitLimit": 98545664,
    "Committed_AS": 375427072,
    "VmallocTotal": 35184372087808,
    "VmallocUsed": 0,
    "VmallocChunk": 0,
    "AnonHugePages": 0,
    "ShmemHugePages": 0,
    "ShmemPmdMapped": 0,
    "HugePages_Total": "0",
    "HugePages_Free": "0",
    "HugePages_Rsvd": "0",
    "HugePages_Surp": "0",
    "Hugepagesize": 2097152,
    "DirectMap4k": 20971520,
    "DirectMap2M": 197132288
  },
  "cpuinfo": [
    {
      "processor": "0",
      "vendor_id": "GenuineIntel",
      "cpu family": "6",
      "model": "63",
      "model name": "Intel(R) Xeon(R) Processor @ 2.50GHz",
      "stepping": "2",
      "microcode": "0x1",
      "cpu MHz": "2500.002",
      "cache size": 37486592,
      "physical id": "0",
      "siblings": "2",
      "core id": "0",
      "cpu cores": "2",
      "apicid": "0",
      "initial apicid": "0",
      "fpu": "yes",
      "fpu_exception": "yes",
      "cpuid level": "13",
      "wp": "yes",
      "flags": "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm cpuid_fault invpcid_single ssbd ibrs ibpb stibp ibrs_enhanced fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid smap xsaveopt arat md_clear arch_capabilities",
      "bugs": "spectre_v1 spectre_v2 spec_store_bypass swapgs",
      "bogomips": "5000.00",
      "clflush size": "64",
      "cache_alignment": "64",
      "address sizes": "46 bits physical, 48 bits virtual",
      "power management": ""
    },
    {
      "processor": "1",
      "vendor_id": "GenuineIntel",
      "cpu family": "6",
      "model": "63",
      "model name": "Intel(R) Xeon(R) Processor @ 2.50GHz",
      "stepping": "2",
      "microcode": "0x1",
      "cpu MHz": "2500.002",
      "cache size": 37486592,
      "physical id": "0",
      "siblings": "2",
      "core id": "1",
      "cpu cores": "2",
      "apicid": "1",
      "initial apicid": "1",
      "fpu": "yes",
      "fpu_exception": "yes",
      "cpuid level": "13",
      "wp": "yes",
      "flags": "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm cpuid_fault invpcid_single ssbd ibrs ibpb stibp ibrs_enhanced fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid smap xsaveopt arat md_clear arch_capabilities",
      "bugs": "spectre_v1 spectre_v2 spec_store_bypass swapgs",
      "bogomips": "5000.00",
      "clflush size": "64",
      "cache_alignment": "64",
      "address sizes": "46 bits physical, 48 bits virtual",
      "power management": ""
    }
  ],
  "uptime": 581,
  "netdev": [
    {
      "device": "lo",
      "Rx": {
        "bytes": "962",
        "packets": "7"
      },
      "Tx": {
        "bytes": "962",
        "packets": "7"
      }
    },
    {
      "device": "telemetry1_sb",
      "Rx": {
        "bytes": "0",
        "packets": "0"
      },
      "Tx": {
        "bytes": "0",
        "packets": "0"
      }
    },
    {
      "device": "vtarget_1",
      "Rx": {
        "bytes": "0",
        "packets": "0"
      },
      "Tx": {
        "bytes": "0",
        "packets": "0"
      }
    },
    {
      "device": "vinternal_1",
      "Rx": {
        "bytes": "0",
        "packets": "0"
      },
      "Tx": {
        "bytes": "90",
        "packets": "1"
      }
    }
  ],
  "memory_setting": 128
}

Lambda実行結果(10240MB)

{
  "meminfo": {
    "MemTotal": 11004657664,
    "MemFree": 10816118784,
    "MemAvailable": 10716573696,
    "Buffers": 12492800,
    "Cached": 82964480,
    "SwapCached": 0,
    "Active": 58200064,
    "Inactive": 68079616,
    "Active(anon)": 31158272,
    "Inactive(anon)": 143360,
    "Active(file)": 27041792,
    "Inactive(file)": 67936256,
    "Unevictable": 0,
    "Mlocked": 0,
    "SwapTotal": 0,
    "SwapFree": 0,
    "Dirty": 159744,
    "Writeback": 0,
    "AnonPages": 31342592,
    "Mapped": 60452864,
    "Shmem": 147456,
    "Slab": 18931712,
    "SReclaimable": 5156864,
    "SUnreclaim": 13774848,
    "KernelStack": 2011136,
    "PageTables": 1277952,
    "NFS_Unstable": 0,
    "Bounce": 0,
    "WritebackTmp": 0,
    "CommitLimit": 5502328832,
    "Committed_AS": 671744000,
    "VmallocTotal": 35184372087808,
    "VmallocUsed": 0,
    "VmallocChunk": 0,
    "AnonHugePages": 0,
    "ShmemHugePages": 0,
    "ShmemPmdMapped": 0,
    "HugePages_Total": "0",
    "HugePages_Free": "0",
    "HugePages_Rsvd": "0",
    "HugePages_Surp": "0",
    "Hugepagesize": 2097152,
    "DirectMap4k": 18874368,
    "DirectMap2M": 11247026176
  },
  "cpuinfo": [
    {
      "processor": "0",
      "vendor_id": "GenuineIntel",
      "cpu family": "6",
      "model": "63",
      "model name": "Intel(R) Xeon(R) Processor @ 2.50GHz",
      "stepping": "2",
      "microcode": "0x1",
      "cpu MHz": "2500.014",
      "cache size": 34603008,
      "physical id": "0",
      "siblings": "6",
      "core id": "0",
      "cpu cores": "6",
      "apicid": "0",
      "initial apicid": "0",
      "fpu": "yes",
      "fpu_exception": "yes",
      "cpuid level": "13",
      "wp": "yes",
      "flags": "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid smap xsaveopt arat md_clear arch_capabilities",
      "bugs": "cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs",
      "bogomips": "5000.02",
      "clflush size": "64",
      "cache_alignment": "64",
      "address sizes": "46 bits physical, 48 bits virtual",
      "power management": ""
    },
    {
      "processor": "1",
      "vendor_id": "GenuineIntel",
      "cpu family": "6",
      "model": "63",
      "model name": "Intel(R) Xeon(R) Processor @ 2.50GHz",
      "stepping": "2",
      "microcode": "0x1",
      "cpu MHz": "2500.014",
      "cache size": 34603008,
      "physical id": "0",
      "siblings": "6",
      "core id": "1",
      "cpu cores": "6",
      "apicid": "1",
      "initial apicid": "1",
      "fpu": "yes",
      "fpu_exception": "yes",
      "cpuid level": "13",
      "wp": "yes",
      "flags": "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid smap xsaveopt arat md_clear arch_capabilities",
      "bugs": "cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs",
      "bogomips": "5000.02",
      "clflush size": "64",
      "cache_alignment": "64",
      "address sizes": "46 bits physical, 48 bits virtual",
      "power management": ""
    },
    {
      "processor": "2",
      "vendor_id": "GenuineIntel",
      "cpu family": "6",
      "model": "63",
      "model name": "Intel(R) Xeon(R) Processor @ 2.50GHz",
      "stepping": "2",
      "microcode": "0x1",
      "cpu MHz": "2500.014",
      "cache size": 34603008,
      "physical id": "0",
      "siblings": "6",
      "core id": "2",
      "cpu cores": "6",
      "apicid": "2",
      "initial apicid": "2",
      "fpu": "yes",
      "fpu_exception": "yes",
      "cpuid level": "13",
      "wp": "yes",
      "flags": "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid smap xsaveopt arat md_clear arch_capabilities",
      "bugs": "cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs",
      "bogomips": "5000.02",
      "clflush size": "64",
      "cache_alignment": "64",
      "address sizes": "46 bits physical, 48 bits virtual",
      "power management": ""
    },
    {
      "processor": "3",
      "vendor_id": "GenuineIntel",
      "cpu family": "6",
      "model": "63",
      "model name": "Intel(R) Xeon(R) Processor @ 2.50GHz",
      "stepping": "2",
      "microcode": "0x1",
      "cpu MHz": "2500.014",
      "cache size": 34603008,
      "physical id": "0",
      "siblings": "6",
      "core id": "3",
      "cpu cores": "6",
      "apicid": "3",
      "initial apicid": "3",
      "fpu": "yes",
      "fpu_exception": "yes",
      "cpuid level": "13",
      "wp": "yes",
      "flags": "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid smap xsaveopt arat md_clear arch_capabilities",
      "bugs": "cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs",
      "bogomips": "5000.02",
      "clflush size": "64",
      "cache_alignment": "64",
      "address sizes": "46 bits physical, 48 bits virtual",
      "power management": ""
    },
    {
      "processor": "4",
      "vendor_id": "GenuineIntel",
      "cpu family": "6",
      "model": "63",
      "model name": "Intel(R) Xeon(R) Processor @ 2.50GHz",
      "stepping": "2",
      "microcode": "0x1",
      "cpu MHz": "2500.014",
      "cache size": 34603008,
      "physical id": "0",
      "siblings": "6",
      "core id": "4",
      "cpu cores": "6",
      "apicid": "4",
      "initial apicid": "4",
      "fpu": "yes",
      "fpu_exception": "yes",
      "cpuid level": "13",
      "wp": "yes",
      "flags": "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid smap xsaveopt arat md_clear arch_capabilities",
      "bugs": "cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs",
      "bogomips": "5000.02",
      "clflush size": "64",
      "cache_alignment": "64",
      "address sizes": "46 bits physical, 48 bits virtual",
      "power management": ""
    },
    {
      "processor": "5",
      "vendor_id": "GenuineIntel",
      "cpu family": "6",
      "model": "63",
      "model name": "Intel(R) Xeon(R) Processor @ 2.50GHz",
      "stepping": "2",
      "microcode": "0x1",
      "cpu MHz": "2500.014",
      "cache size": 34603008,
      "physical id": "0",
      "siblings": "6",
      "core id": "5",
      "cpu cores": "6",
      "apicid": "5",
      "initial apicid": "5",
      "fpu": "yes",
      "fpu_exception": "yes",
      "cpuid level": "13",
      "wp": "yes",
      "flags": "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid smap xsaveopt arat md_clear arch_capabilities",
      "bugs": "cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs",
      "bogomips": "5000.02",
      "clflush size": "64",
      "cache_alignment": "64",
      "address sizes": "46 bits physical, 48 bits virtual",
      "power management": ""
    }
  ],
  "uptime": 30417,
  "netdev": [
    {
      "device": "vinternal_1",
      "Rx": {
        "bytes": "0",
        "packets": "0"
      },
      "Tx": {
        "bytes": "0",
        "packets": "0"
      }
    },
    {
      "device": "vtarget_1",
      "Rx": {
        "bytes": "0",
        "packets": "0"
      },
      "Tx": {
        "bytes": "0",
        "packets": "0"
      }
    },
    {
      "device": "telemetry1_sb",
      "Rx": {
        "bytes": "0",
        "packets": "0"
      },
      "Tx": {
        "bytes": "0",
        "packets": "0"
      }
    },
    {
      "device": "lo",
      "Rx": {
        "bytes": "962",
        "packets": "7"
      },
      "Tx": {
        "bytes": "962",
        "packets": "7"
      }
    }
  ],
  "memory_setting": 10240
}

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
What you can do with signing up
7