ちょっと話題の記事

Amazon EC2の新ファミリ R3 ファーストインプレッション

2014.04.11

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

ども、大瀧です。 先ほどリリースされましたEC2の新世代メモリ最適化インスタンスファミリー、R3を触ってみました。概要はAWS公式ブログを参照ください。

R3ファミリーとは

従来、Amazon EC2では、メモリを多めに搭載するインスタンスファミリーとしてM2がありましたが、新しいメモリ多めのファミリーとしてR3が登場しました。今後は特別な理由が無い限り、メモリを多く必要とする場合にはR3ファミリーを選択するのが良いでしょう。

r3.largeからr3.2xlarge/r3.4xlarge/r3.8xlargeの4種類のインスタンスタイプがあり、価格としては他のファミリーの同サイズと比べるとM3ファミリーと同じくらい、従来のM2とはサイズ名で見ると割高に見えますが実際の搭載メモリサイズでは割安という感じです。

ec2-pricechart

注意点

ハマりどころとして、R3ファミリーはHVM AMIしかサポートしないことがあります。Management ConsoleのAMI選択画面でPV AMIを選択するとタイプ選択画面にはR3ファミリーが現れません。以下のように、HVMのAMIを選びましょう。

r3instance01

r3instance02

なぜHVMしかサポートしないのかは、EC2の英語ドキュメントに記述があります。優れたパフォーマンスのためらしいです。

R3 instances have high-memory (up to 244 GiB of RAM), and require 64-bit operating systems to take advantage of that capacity. HVM AMIs provide superior performance in comparison to paravirtual (PV) AMIs on high-memory instance types. For these reasons, R3 instances support 64-bit HVM AMIs only. In addition, HVM AMIs are required to leverage the benefits of enhanced networking.

気をつけなくてはいけないのが、既存のインスタンスをR3ファミリーに変更したい場合です。EC2インスタンスをStop状態にすればタイプ変更が可能ですが、PV AMIで作成したインスタンスからは簡単には変更できません(参考 : 仮想化方式(HVM と PV)についてまとめ - 水深1024m)。今後はPV AMIよりもHVM AMIの方がメジャーになっていくのでは、と思います。

また、リザーブドインスタンスはなぜか軽度(Light)使用の設定がなく、中度ないし重度から選択することになります。

起動してみた

で、起動してみましたよ。うりゃっ、r3.8xlarge!!(2.8ドル/h)
普段あまりHVM AMIを使わないのですが、PV AMIに比べるとSSH接続ができるようになるまで時間がかかる気がします。PV AMIがpv-grubで即時にカーネルをロードするのに対して、HVM AMIではPOSTとかが動いているのかもしれません。

まずは、freeから。

[ec2-user@ip-172-31-15-31 ~]$ free
             total       used       free     shared    buffers     cached
Mem:     251651620    1793676  249857944          0      10700     239564
-/+ buffers/cache:    1543412  250108208
Swap:            0          0          0
[ec2-user@ip-172-31-15-31 ~]$

桁数がもうよくわからないですが、メモリサイズは244GBです。続いて、仮想ハードウェア関係。

[ec2-user@ip-172-31-15-31 ~]$ lsmod
Module                  Size  Used by
ipv6                  343708  136
binfmt_misc             7359  1
crc32_pclmul            3121  0
crc32c_intel           14455  0
ghash_clmulni_intel     4611  0
syscopyarea             3625  0
sysfillrect             3989  0
sysimgblt               2424  0
fb_sys_fops             1623  0
evbug                   2125  0
evdev                  10109  0
microcode              12859  0
i2c_piix4               9098  0
psmouse                86558  0
ixgbevf                55649  0
i2c_core               27089  1 i2c_piix4
button                  5663  0
ext4                  509180  1
crc16                   1691  1 ext4
jbd2                  104496  1 ext4
mbcache                 7966  1 ext4
aesni_intel            45632  0
aes_x86_64              7811  1 aesni_intel
glue_helper             5502  1 aesni_intel
lrw                     4062  1 aesni_intel
gf128mul                7839  1 lrw
ablk_helper             2997  1 aesni_intel
cryptd                  9895  3 ghash_clmulni_intel,aesni_intel,ablk_helper
dm_mirror              13854  0
dm_region_hash         10917  1 dm_mirror
dm_log                  9483  2 dm_region_hash,dm_mirror
dm_mod                 82289  2 dm_log,dm_mirror
[ec2-user@ip-172-31-15-31 ~]$ lspci
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 01)
00:02.0 VGA compatible controller: Cirrus Logic GD 5446
00:03.0 Ethernet controller: Intel Corporation 82599 Ethernet Controller Virtual Function (rev 01)
00:1f.0 Unassigned class [ff80]: XenSource, Inc. Xen Platform Device (rev 01)
[ec2-user@ip-172-31-9-130 proc]$ sudo ethtool eth0
Settings for eth0:
	Supported ports: [ ]
	Supported link modes:   10000baseT/Full
	Supported pause frame use: No
	Supports auto-negotiation: No
	Advertised link modes:  Not reported
	Advertised pause frame use: No
	Advertised auto-negotiation: No
	Speed: 10000Mb/s
	Duplex: Full
	Port: Other
	PHYAD: 0
	Transceiver: Unknown!
	Auto-negotiation: off
	Current message level: 0x00000007 (7)
			       drv probe link
	Link detected: yes
[ec2-user@ip-172-31-15-31 ~]$

SR-IOVのNIC周りとして、C3ファミリーと同様にixgbevfドライバがロードされ、10GBase-TのNICで認識されていることがわかります。早そう!そしてCPU。

[ec2-user@ip-172-31-15-31 ~]$ cat /proc/cpuinfo
  (中略)
processor       : 31
vendor_id       : GenuineIntel
cpu family      : 6
model           : 62
model name      : Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
stepping        : 4
microcode       : 0x416
cpu MHz         : 2500.026
cache size      : 25600 KB
physical id     : 1
siblings        : 16
core id         : 7
cpu cores       : 8
apicid          : 47
initial apicid  : 47
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 arch_perfmon rep_good nopl xtopology eagerfpu pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm xsaveopt fsgsbase smep erms
bogomips        : 5066.51
clflush size    : 64
cache_alignment : 64
address sizes   : 46 bits physical, 48 bits virtual
power management:

プロセッサIDが0から31までなので、仮想CPUコアが32個あることがわかります。バッチリXeon(R) CPU E5-2670 v2のIvy Bridge-EPですね。ちなみに、topコマンドでマルチコア表示をしようとしたら、MBAでは端末の表示領域が足りないと、エラーになってしまいましたw

まとめ

EC2のタイプ追加は数字上のお話に見られがちですが、従来乗らなかったアプリケーションやシステムが稼働する可能性を広げる大きなアップデートになります。旧世代よりもリソース単価が安くもなりますので、HVMのみなことに気をつけつつ、積極的に使って行きたいですね。
ベンチマークは、con_mameさんの自腹レポをみんなで待ちましょうw

[2014/04/13追記]
最後の一文はElastiCache for Redisの検証などで感銘を受け、リスペクトしたつもりで書いたものでした。気を悪くされたのであれば申し訳ありませんm(_ _)m