cloudpack night #7 ã«åå ãã¾ãã / EC2 ã«ããã AES-NI ã®è©±
å
æ¥è¡ããã cloudpack night #7 ã«åå ãã¾ããã
http://www.zusaar.com/event/978005
主å¬ããã cloudpack ã® id:yoshidashingo ããã®ã¾ã¨ãã¯ãã¡ãã
http://d.hatena.ne.jp/yoshidashingo/20130826/1377527798
æ°åå ¥ç¤¾5ã¶æç®ã社ä¼äººãªããã¦ã®ãºã¼ãºã¼ã§ã¯ããã®ã§ããã åè¶ãªããè¥æ LT æ ã§çºè¡¨ããã¦ããã ãã¾ããã
EC2 ç°å¢ã«ããã AES-NI ã®æ§è½ã«ã¤ãã¦ç´¹ä»ãã¾ããã
AES æå·åãããªãã¤ã³ã¹ã¿ã³ã¹ãããè¦ãã»ããè¯ãã§ãããã¨ãã話ã§ãã
LT ã®è³æã ã¨ãã¾ãã¾ã¨ã¾ããªãæ°ãããã®ã§è¨äºã¨ããå½¢ã§ã¾ã¨ãã¦ããã¾ãã
AES-NI ã¨ã¯
詳細ã¯ããã§èª¬æããããã°ã°ã£ãã»ããè¯ãã§ãã
ä¸è¨ã§è¨ã㨠AES æå·ã® CPU ãµãã¼ãã§ãIntel CPU ã® Westmere (2010å¹´åå) ä¸ä»£ããè¼ãããã«ãªã£ãã®ã§ãããªãã«æ¥ãçµã£ã¦ã¯ãã¾ãã
OpenSSL(ãã¶ã 1.0.0e~) ã§ã¯æ¢ã«å©ç¨ã§ããããã«ãªã£ã¦ãã¾ãã
EC2 ã«ããã AES-NI
çµè«ããè¨ãã¨ãEC2 ã«ããã¦ã AES-NI ãå©ç¨ãããã¨ãã§ãã¾ããã1ç¹ã ãè½ã¨ãç©´ãåå¨ãã¾ãã
ããã¼ã« AWS ãå©ç¨ããã¦ããæ¹ã«ã¯æ¢ç¥ã®åé¡ãã¨æãã¾ããã
åãã¤ã³ã¹ã¿ã³ã¹ã¿ã¤ãã«ããã¦ãå²ãå½ã¦ããã CPU ãéããã¨ãããã¾ãã
(ãã®è©³ç´°ã¯ con_mame ããã®ã¨ã³ããªã«åãããããã¾ã¨ãã¦ããã¾ã)
ãã¡ãã AWS å´ã§ãä¸ä»£éã®å·®ãå°ãªããªããããCPU ã«ãã£ã¦ã¤ã³ã¹ã¿ã³ã¹ã¸ã®å²å½æé調æ´ããã¦ãããããã¨ã¯æãã¾ããã
ãã¼ãã¦ã§ã¢ãµãã¼ãã«ã¤ãã¦ã¯å¦ä½ã¨ãããããã¨ããã§ãããã
åãã¤ã³ã¹ã¿ã³ã¹ã¿ã¤ãã®ã¤ã³ã¹ã¿ã³ã¹ã§ãAES-NI ããµãã¼ãããã¦ãããã®ã¨ããã§ãªããã®ãããã¾ãã
AES-NI ã®æç¡ã«ããããã©ã¼ãã³ã¹ã®éã
ã¨ããããã§ãã©ã®ãããã®ããã©ã¼ãã³ã¹å·®ãåå¨ããã®ãæ¤è¨¼ãè¡ãã¾ããã
m2.2xlarge (13 ECU) ã®ã¤ã³ã¹ã¿ã³ã¹2å°ãCentOS6 ã®ç°å¢ã§ã
OpenSSL ã¯ãã£ã¹ããªãã¥ã¼ã·ã§ã³æ¨æºã®ããã±ã¼ã¸ãå©ç¨ãã¦ãã¾ãã
â»è¨ç®é度ã®æ¯è¼ã«ã©ãã㦠m2.2xlarge? ã¨ãã声ãããããã§ããã諸äºæ
ã§ã
2å°ã®ãã·ã³ã«ã¯ã¯ãããã knight, padawan ã¨ããååãã¤ãã¦ããã¾ãã
ãã§ããã¯ã¹ä¸å·ã«ããããã¨æã£ãã®ã§ããããã¾ããã
CPU ã®ç¢ºèª
ã¾ã2å°ã® CPU ã確èªãã¾ãã/proc/cpuinfo ããå¾ãããæ å ±ã®ãã¡é¢ä¿ãããããªé¨åãæç²ãã¦ã¿ã¾ãã
knight
processor : 0 model name : Intel(R) Xeon(R) CPU E5-2665 0 @ 2.40GHz cpu MHz : 2399.998 flags : fpu de tsc msr pae cx8 cmov pat clflush mmx fxsr sse sse2 ss ht syscall nx lm rep_good unfair_spinlock pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt aes avx hypervisor lahf_lm
padawan
processor : 0 model name : Intel(R) Xeon(R) CPU X5550 @ 2.67GHz cpu MHz : 2666.760 flags : fpu de tsc msr pae cx8 sep cmov pat clflush mmx fxsr sse sse2 ss ht syscall nx lm rep_good unfair_spinlock pni ssse3 cx16 sse4_1 sse4_2 popcnt hypervisor lahf_lm
ä¸è¨ã®ããã« knight ã® flags ã«ã¯ aes ã®æåãè¦ãã¾ãã padawan ã«ã¯ããã¾ããã
ãã®ãããpadawan (X5550) ã§ã¯ AES-NI ããµãã¼ãããã¦ããªããã®ã¨èãããã¾ãã
â» Intel ã® Web ãµã¤ããããæ¢ããããã«ãªã£ã¦ãã¾ã
OpenSSL ã§ã®ç¢ºèª
次㫠OpenSSL å´ã§ã®ç¶æ ã確èªãã¾ãã
knight
$ openssl engine -c -t (aesni) Intel AES-NI engine [AES-128-ECB, AES-128-CBC, AES-128-CFB, AES-128-OFB, AES-192-ECB, AES-192-CBC, AES-192-CFB, AES-192-OFB, AES-256-ECB, AES-256-CBC, AES-256-CFB, AES-256-OFB] [ available ]
padawan
$ openssl engine -c -t (aesni) Intel AES-NI engine (no-aesni) [ available ]
ã¨ããããã§ãAES-NI ãæè¼ããã knight å´ã§ã®ã¿ aesni ã¢ã¸ã¥ã¼ã«ã§ãµãã¼ãã§ãã æå·åã¢ã¼ãã表示ããã¦ãã¾ãã ããã§ãknight ã AES-NI ãå©ç¨ã§ããpadawan ã¯ããã§ã¯ãªããã¨ãããã¨ãåããã¾ãã
OpenSSL ãã³ããã¼ã¯ãªãã·ã§ã³ã§ã®è¨æ¸¬
openssl ã«ã¯ speed ãªãã·ã§ã³ã¨ããæå·åã¢ã¼ãã®ã¹ã«ã¼ããããè¨æ¸¬ã§ãããªãã·ã§ã³ãããã¾ãã
ããã knight, padawan ã§ããããå®è¡ãã¾ããã
æå·åã¢ã¼ãã¨ã㦠AES256 (CBC ã¢ã¼ã) ãå©ç¨ãã¦è¨æ¸¬ãã
åæã«ãAES-NI ã®æç¡ä»¥å¤ã§ã®å·®ããªãã調ã¹ããã 3DES ã®ã¹ã«ã¼ããããè¨æ¸¬ãã¾ããã
çµæ
ä¸è¨ã°ã©ãã®ãããªçµæãåºã¾ããã
ã°ã©ãã«è¼ãå¿ãã¦ãã¾ã£ãã®ã§ãããåä½ã¯ kbytes/s ã§ãã
256 bytes ã®æå·åã¹ã«ã¼ãããå¤ãæç²ãã¦ãã¾ãããã©ã®ãµã¤ãºã§ãéãã¯å¤§ä½åãã§ããã
AES-256-CBC ã§ã¯ knight ã padawan ã«ç´5å以ä¸ã®æ§è½å·®ãã¤ãã¦ãã¾ãã
éã« 3DES ã§ã¯ padawan ã®ã»ãã knight ã®ã¹ã«ã¼ããããè¥å¹²ä¸åã£ã¦ãã¾ãã
ä¸ã«æ¸ãã CPU æ
å ±ãè¦ã㨠padawan ã®ã»ããã¯ããã¯å¨æ³¢æ°ã¯è¥å¹²é«ãã®ã§ã
ãã¼ãã¦ã§ã¢ãµãã¼ãç¡ãã§ã¯åç´ã«ã¯ããã¯å¨æ³¢æ°ã®é«ã padawan ãéãã£ãã¨ãããã¨ã§ããããã
3DES ã使ã£ãã¨ãã®æ§è½ãè¦ãéã CPU èªä½ã®å¦çæ§è½ã¨ã㦠knight 㨠padawan ã«
ããã»ã©å·®ã¯ãªããããªã®ã§ãAES-NI ã®æç¡ã«ããå¹æã¨è¨ã£ã¦ããããã§ãã
ãã¡ã¤ã«ã®æå·å
ã§ã¯ãããå®ç¨ä¸ã©ã®ãããã®å·®ã«ãªãã®ãã¨ãããã¨ã§ã
ã»ãã®è»½ãç¨åº¦ã§ã¯ããã¾ããããã£ã¹ã¯I/Oãä¼´ãæå·åé度ãè¨æ¸¬ãã¦ã¿ã¾ããã
80MB ãããã®å§ç¸®æ¸ã¿ãã°ã使ãã¾ãã
(æå·åãããã°ã S3 ã«ç½®ãã¦ããã¨ããããããã¿ã¼ã³ã ã¨æãã®ã§)
EBS ã§ã¯ãªã ephemeral disk ã«ãã¡ã¤ã«ãç½®ãã¦è¨æ¸¬ãã¾ããã
çµæ
ä¸è¨ã°ã©ãã®ãããªçµæãåºã¾ããã
ã¾ããã¦ãã°ã©ãã«è¼ãå¿ãã¦ããã®ã§ããåä½ã¯ sec ã§ãã
1ãã¡ã¤ã«ã®æå·åã«5ç§ãããã®å·®ãã¤ãã¨ãªãã¨ã
大éã®ãã¡ã¤ã«ãæå·åããªããå¦çãããããªç°å¢ã§ã¯å
¨ä½ã®å¦çæéã«
ããªãã®å½±é¿ãä¸ããã®ã§ã¯ãªãã§ããããã
ã¾ã¨ã
EC2 ã§ã AES-NI ã®æ©æµã¯åãããããã¨ãç¡äºç¢ºèªã§ãã¾ããã
å®é測å®ãã¦ã¿ãã¨ãç¡è¦ã§ããªãã¬ãã«ã§éãããããã¨ãåããã¾ãã
AWS ãã¯ããã¨ããã¯ã©ã¦ãç°å¢ã¯ç¢ºãã«ç©çãã·ã³ã®ãã¨ãèããªãã¦ä¾¿å©ãã¨ãªããã¡ãªã®ã§ããã
ä»®æ³ãã·ã³å´ããè¦ããã"ãã®åãã"ã®ç°å¢ã«æãã馳ãã¦ããã¨ã
ããããç´°ããç¹ã§å¾ã§ããããããªãããªã¨æãã¾ãã
AWS å´ã®ç©çç°å¢ãã©ãã©ãæ´æ°ããã¦ããã§ããããã
使ãå´ã¨ãã¦ã¯ãã²ãã¼ãã¦ã§ã¢ãµãã¼ããå«ããå
¨åãå¼ãåºãããã¨ããã§ãã
ä¼ãã®ãã®ããçºè¡¨ã¯æ£ç´ã ãã¶ç·å¼µããã®ã§ãããèå³ãæã£ã¦ããã ããæ¹ãããããã§è¯ãã£ãã§ãããã®å¾ã®æ親ä¼ã楽ããã£ãã§ãã
ã¨ããããã§ã楽ããå ´ãæä¾ãã¦ãã ãã£ã cloudpack ããããããã¨ããããã¾ãã:)
追伸: 社ä¼äººã«ãªãã¾ãã
å¦æ¥ãå
±ã«ãã Macbook ãç ´å£ãã¦ããæ©ããã®ã§åå¹´ãéãã¾ããã
åé ã§è§¦ãã¾ãããæ¨å¹´åº¦ã§å¤§å¦çãçµãã¦ç¤¾ä¼äººã«ã¯ã©ã¹ãã§ã³ã¸ãã¾ããã
ä»ã®ã¨ãããµã¼ãã dd ã§ç ´å£ãããã¯ãã¦ãã¾ããã
社ä¼äººã¨ãã¦ããã£ããã§ãã·ã³ãç ´å£ããªãæ
éãã身ã«ã¤ããã¹ãæ¥ã
ããã°ã£ã¦ãã¾ãã
ä»å¾ã¨ããããããé¡ãè´ãã¾ãã