å
æ¥å
¬éããããAmazon Aurora: Design Considerations for High Throughput Cloud-Native Relational Databasesããèªã¿ã¾ããã
èå³æ·±ãã£ãé¨åãçåã«æã£ã(ããã¾ãããã£ã¦ãªã)é¨åãã¾ã¨ãã¦ããã¾ãã
AWS ã¯è©³ãããªãã®ã§ãã¨ããã©ããééã£ã¦ããããããã¾ããã
- Amazon Aurora ã¨ã¯
- Amazon Aurora ã®ã¢ã¼ããã¯ãã£å ¨ä½å
- quorum
- 10GBã«åå²ãããã¹ãã¬ã¼ã¸
- ææ³
Amazon Aurora ã¨ã¯
Amazon Aurora 㯠Amazon Web Service ãæä¾ãããããã¼ã¸ããªã¬ã¼ã·ã§ãã«ãã¼ã¿ãã¼ã¹ãµã¼ãã¹ã§ãã
Amazon Aurora (MySQL äºæã®ãªã¬ã¼ã·ã§ãã«ãã¼ã¿ãã¼ã¹ï¼ | AWS
Amazon Aurora ã®ã¢ã¼ããã¯ãã£å ¨ä½å
Aurora ã¯ãã¼ã¿ãã¼ã¹å±¤ã¨ã¹ãã¬ã¼ã¸å±¤ãåé¢ããæ§æã¨ãªã£ã¦ãã¾ãã
ãã¼ã¿ãã¼ã¹å±¤ã¯åä¸ã®ãã©ã¤ããªãã¼ã¿ãã¼ã¹ã¨è¤æ°ã®ãªã¼ãã¬ããªã«ããæ§æãããã¯ã¨ãªã®å¦çããã©ã³ã¶ã¯ã·ã§ã³ãªã©ãæ
å½ãã¾ãã
ã¹ãã¬ã¼ã¸å±¤ã¯ redo ãã°ããã¼ã¿ãä¿æããã¾ã redo ãã°ã®é©ç¨ããªãã¢ã®ãããªå¦çãè¡ãã¾ãã
ãã®è¨äºã§ã¯ quorumããã¼ã¿ã®ã»ã°ã¡ã³ãåããããã¯ã¼ã¯éä¿¡ã³ã¹ããä¸ãã工夫ãç´¹ä»ãã¤ã¤ãçåã«æã£ãç¹ãªã©ãä»è¨ãã¦ããã¾ãã
quorum
Aurora ã®ã¹ãã¬ã¼ã¸å±¤ã¯ã¬ããªã±ã¼ã·ã§ã³ã¨ quorum ã«ãããååãªæ°¸ç¶æ§ã¨å¯ç¨æ§ã両ç«ãã¦ãã¾ãã
quorum ã·ã¹ãã ã¯ãããªãã¬ã¼ã·ã§ã³ãé©ç¨ãããããã»ã¹éåã¨å¥ã®ãªãã¬ã¼ã·ã§ã³ãé©ç¨ãããããã»ã¹éåããå¿
ãå
±éé¨åéåãæã¤ããã«è¨è¨ãããã·ã¹ãã ã§ãã
å¯ç¨æ§ãä¸ãã¤ã¤ãèªã¿è¾¼ã¿ãªãã¬ã¼ã·ã§ã³ãå®è¡ããã¬ããªã«ç¾¤ã®ä¸ã«ãæå¾ã«æ¸ãè¾¼ã¿ãè¡ãããããã»ã¹ç¾¤ã絶対å«ã¾ããããã«ããããã¨ãã£ãè¦æ±ã«å¿ãã¾ãã
quorum ãã®ãã®ã«ã¤ãã¦ã¯ãæè¿ããèãQuorumã¯éåæ°(å¤æ°æ±º)ãããä¸è¬çã§ãã¯ãã«ãªæ¦å¿µã ã£ã - Qiitaããããããããã§ãã
Aurora ã®ãã¼ã¿ã¯ãï¼ã¤ã® Availavility Zone ã«ããããï¼ã¤ãã¤ãåè¨ï¼ã¤è¤è£½ããã¾ãã
ããã«å¯¾ããèªã¿è¾¼ã¿æã¯ï¼ã¤(ãã ãæ£å¸¸æã¯ãã¼ã¿ãã¼ã¹ã¤ã³ã¹ã¿ã³ã¹ã in-sync ãªã¹ãã¬ã¼ã¸ãã¼ããææ¡ãã¦ããã®ã§ã1ã¤ã§ãã)ã®ãæ¸ãè¾¼ã¿æã¯ï¼ã¤ã®ã¹ãã¬ã¼ã¸ãã¼ãã¸åãåããããã¨ã§ quorum ãå½¢æãã¾ãã
ãã®æ§æã«ããããã©ã¤ããªãã¼ã¿ãã¼ã¹ã®ä¸è²«æ§ãé«ãæ¸ãè¾¼ã¿å¯ç¨æ§ããããé«ãæ°¸ç¶æ§ã»èªã¿è¾¼ã¿å¯ç¨æ§ãæä¾ããã¾ãã
ã¾ãæ¸ã込㿠quorum ã4ã§ãããããä»»æã®2ãã¼ãããã¦ã³ããã¨ãã®æ¸ãè¾¼ã¿å¯ç¨æ§ãä»»æã®3ãã¼ãããã¦ã³ããã¨ãã®æ°¸ç¶æ§ãä¿è¨¼ããã¾ãã
ãã㯠Availability Zone é害ãçºçãã¦ãæ´æ°å¦çãå¯è½ãªãã¨ãAZ é害ã«å ããã£ã¹ã¯ã®æ
éãªã©ã«ããããã«ï¼ã¤ã®ãã¼ããæ
é(AZ + 1é害)ãã¦ããã¼ã¿ãã¹ãããªããã¨ãæå³ãã¾ãã
ã¾ãèªã¿è¾¼ã¿ quorum ã3ã§ãããããä»»æã®3ãã¼ãããã¦ã³ããå ´åã§ãèªã¿è¾¼ã¿ã¯æåãã¾ãã
ãã®ãã AZ + 1 é害ãçºçãã¦ããèªã¿è¾¼ã¿ã¯ç¶ç¶ãããã¨ãã§ãã¾ãã
AWS ã®ãããªå¤§è¦æ¨¡ç°å¢ã¯ã©ã¦ãç°å¢ã«ããã¦ãä½ããå£ãã¦ããã¨ããã®ã¯æ¥å¸¸è¶é£¯äºã§ãã
ã¤ã¾ã AZ é害ãçºçãã¦ãã復æ§ããã¾ã§ã®éã«ãçãã¦ã AZ ã«ããããããã®ã¹ãã¬ã¼ã¸ãã¼ããå£ãããã¨ãèæ
®ãããã¨ã«æã¾ãããããã¾ãã
ã¬ããªã«æ°=6ãèªã¿è¾¼ã¿ quorum=3ãæ¸ã込㿠quorum = 4 ã¨ããæ§æã¯ãã®ãããªã¯ã©ã¦ãã®ç¹æ§ãèæ
®ãã¦æ±ºãããã¦ãã¾ãã
ä¾ãã°ããããã¬ããªã«æ°3ãquorum=2ã¨ããæ§æããã¬ããªã«æ°=5ãquorum=3ã¨ããæ§æã§ã¯ãAZ + 1é害ã«èãããããã¨ãä¿è¨¼ã§ãã¾ããã
æ¸ãè¾¼ã¿å¯ç¨æ§ãè¥å¹²å¦¥åãã¦ããç¹ã¯èªãã§ã¦å°ãæ°ã«ãªãã¾ããã
AZ + 1é害ã«èããæ¸ãè¾¼ã¿å¯ç¨æ§ãæä¾ãããã¨ãããããå¯è½ã§ãä¾ãã°ã¬ããªã«æ°ã9ã«ããã°ãã¸ã§ãªãã£æ¹å¼ã§5ãé層å quorum ãªãæä½4ã®æ¸ãè¾¼ã¿ã§ quorum ãå¾ããã¨ãã§ãã¾ãã
ãã å½ç¶ãããã¯ã¼ã¯å¸¯åã¨ã¹ãã¬ã¼ã¸å®¹éãããå¤ãæ¶è²»ãã¦ãã¾ãä¸ã«ãæ¸ãè¾¼ã¿ã¯ãããããã©ã¤ã㪠DB ãã¼ãã«é害ãèµ·ããã¨çµå±ãã°ããåæ¢ããããå¾ãªããããªã®ã§ãããã¾ã§é å¼µãå¿
è¦ããªãããã ãªã¨æãã¾ããã
10GBã«åå²ãããã¹ãã¬ã¼ã¸
åè¿°ã®éã Aurora 㯠AZ + 1é害ã«èãããã¾ãããAZ + 2ã®é害ãçºçããã¨ãã¼ã¿ãã¼ã¹ãå©ç¨ã§ããªããªãã¾ãã
ãããé²ãã«ã¯ãAZ é害ãé¤ãããã¼ãæ
éãåæã«çºçããªãããã«ããå¿
è¦ãããã¾ãã
æ
éçãä¸ããã®ã¯é£ããã®ã§ãAurora ã¯ä¿®å¾©ã¾ã§ã®æéãçããããã¨ã§å¤éé害ã«åãã¦ãã¾ãã
ãã®æ¹æ³ãããã¼ã¿ã10GBã®ã»ã°ã¡ã³ãã«åå²ããã¹ãã¬ã¼ã¸ãã¼ã群ã«ã°ãã¾ãã¨ãããã®ã§ãã
ããã«ããå£ããã¬ããªã«ã®ãªãã¢ãé«éã«è¡ããã¨ãã§ããçµææ
éãéè¤ãã確çã大ããä¸ãããã¨ã«æåãã¦ãã¾ãã
10Gbps ã®ãããã¯ã¼ã¯ã使ãã°ã10GBã»ã°ã¡ã³ãã®å¾©æ§ã¯ç´10ç§ã§è¡ãã¾ã(ãã£ã¹ã¯ã¢ã¯ã»ã¹ãçºçãããããå°ãæéããããããããã¾ããããã¹ãã¬ã¼ã¸ãã¼ãã¯ãã¼ã«ã« SSD ã«ãã¼ã¿ãä¿åãã¦ãããããã®ã§ãããªãéããã ãããªã¨åæã«æã£ã¦ãã¾ã)ã
10ç§ã®éã« AZ é害ã«å ããåãã»ã°ã¡ã³ãã®ã¬ããªã«ãæã¤ãã¼ãï¼ã¤ã«é害ãçºçãã確çã¯é常ã«ä½ããããã»ã¼ã»ã¼ãã¼ã¿ãã¹ããªããã¼ã¿ãã¼ã¹æ©è½ãæä¾ãç¶ãããã¨ãã§ãã¾ãã
æ®éã® MySQL ãªãããéç¨ãã¦ãã¨ã¬ããªã«ã®å¾©å¸°ã¯ããªã大ä»äºã«ãªããã¡ãªã®ã§ããããããä»çµã¿ã ã¨æãã¾ããã
redo ãã°ã®ã¿ã転é
Aurora 㯠redo ãã°ã®ã¿ã転éãããã¨ã§ã6ã¬ããªã±ã¼ã·ã§ã³ã«ä¼´ããããã¯ã¼ã¯è² æ ã軽æ¸ãã¦ãã¾ãã
次ã®å³ã¯ãMySQL with EBS ããã«ã AZ æ§æã«ããã¨ãã®ãã¼ã¿ã®æµãã示ãã¦ãã¾ãã
ãAmazon Aurora: Design Considerations for High Throughput Cloud-Native Relational Databasesãã® Figure 2 ãã
é常㮠MySQL ã¯ãã®ã³ã°ãããã¼ãã«ã¹ãã¼ã¹ã¸ã®æ¸ãè¾¼ã¿ãªã©ãããããæ¸ãè¾¼ã¿ã MySQL ããå®è¡ããã¾ãã
ãã®ãããEBS ã¸ã®ãã¼ã¿è»¢ééã¯ããªãå¤ããªãã¾ã(iSCSI çãªä»çµã¿ã使ã£ã¦ãããã¯ã¼ã¯çµç±ã§ãã¼ã¿ãéåä¿¡ããã®ã ã¨æãã¾ã)ã
ã¾ããEBS èªä½ã®åé·åæ©è½ã«ä¼´ããããã¯ã¼ã¯éä¿¡ãçºçãã¾ãã
ããã«åé·æ§æã«ããã¨ãã¬ããªã«ã«å¯¾ãã¦ããããã®ãã¼ã¿ãéä¿¡ããå¿
è¦ãããã¾ã(MySQL ã¯è«çã¬ããªã±ã¼ã·ã§ã³ã§ binlog ããéä¿¡ãããªãã®ã§ã¯ãã¨æãã¾ããããAmazon RDS Multi-AZ é
åãè¦ãã¨ä½ããç©çã¬ããªã±ã¼ã·ã§ã³ãã¦ããã¨æ¸ãã¦ããã®ã§ãbinlog 以å¤ãéã£ã¦ããã®ããããã¾ãã)ã
ä¸æ¹ Aurora ã¯ãã¹ãã¬ã¼ã¸ãã¼ãã«å¯¾ã㦠redo ãã°ã®ã¿ããã¬ããªã«ã¤ã³ã¹ã¿ã³ã¹ã«å¯¾ã㦠redo ãã°ã¨ã¡ã¿ãã¼ã¿ãéä¿¡ãã¾ãã
ãAmazon Aurora: Design Considerations for High Throughput Cloud-Native Relational Databasesãã® Figure 3 ãã
redo ãã°ã®åæ ãªã©ã¯ã¹ãã¬ã¼ã¸ãã¼ãããã¼ã«ã« SSD ã«å¯¾ãã¦éåæã«è¡ãã¾ãã
ãã®ããããããã¯ã¼ã¯ä¸ãæµãããã¼ã¿ã¯ redo ãã°ã¨ã¡ã¿ãã¼ã¿ã®ã¿ã¨ãªããé常ã«ãããã¯ã¼ã¯å¸¯åãç¯ç´ã§ãã¾ãã
ãã MySQL with ãã¼ã«ã«ãã£ã¹ã¯ã使ã£ã¦æºåæã¬ããªã±ã¼ã·ã§ã³ãçµãã°è«æã§è¿°ã¹ããã¦ãããããªãããã¯ã¼ã¯ã³ã¹ãã¯ããããçºçããªãã¨æããã¾ãã
ææ°ã® MySQL ã ã¨æºåæã¬ããªã±ã¼ã·ã§ã³ã® ack æ°ãå¶å¾¡ãããã§ãããããªã®ã§ãä¼¼ããããªåé·æ§ã¨ãããã¯ã¼ã¯å¸¯åã®ç¯ç´ã両ç«ã§ãããã§ãã
æºåæã¬ããªã±ã¼ã·ã§ã³ã«ã¯ããã¯ããã§ãã£ã¹ã¢ããã³ãã¼ã¸ãããããã§ãããã¢ããªã·ãã¯ãªã¢ã¼ããã¯ãã£ã§ãçæ³çã«è¨è¨ããã°ãã®ç¹ã¯ããããããæãã«ãªãããã ãªã¨æãã¾ããã
ææ³
ä¼èª¬ã® Amazon Aurora ã¢ã¼ããã¯ãã£ãã¾ã¨ã¾ã£ã¦ã¦ããè³æã§ããã
å
ã®æç« ã«ã¯ä»ã«ã次ã®ãããªå
容ãæ¸ããã¦ãã¾ãã
- éç¨ä¸ã®åªä½ç¹
- æ´åæ§ãç¶æããæ¹æ³
- ã¯ã©ãã·ã¥ãªã«ããªã«ã¤ãã¦
- ã¤ã³ãã©æ§æã«ã¤ãã¦
- ãã³ããã¼ã¯çµæ
MySQL ã¨ã®å¯¾æ¯ã§èª¬æããã¦ããé¨åãå¤ãããã¼ã¿ãã¼ã¹ã®åºæ¬çãªä»çµã¿ã«å¯¾ããè¦èãæ·±ã¾ãã®ã§ãèå³ããæ¹ã¯èªãã§ã¿ãã¨ããããã§ãã