ãè¦ããããããã½ã¼ã·ã£ã«ç³»ã®ãµã¼ãæ§æãèãã
ãç§ã¯ãã½ã¼ã·ã£ã«ç³»ã¨ã¯ç¸é ãä»äºã°ã£ãããã¦ããã®ã§ãããããããä¾é ¼ãè¥å¹²å¢ãã¦ããã®ã§è©±é¡ã«ãªã£ã¦ããã艦これãããçã«ãã£ã¦ã¿ãã
ãæ®å¿µãªããããè¦ãããã®é åã¯åãããªãã£ããããããããã·ã§ã³ãç¨æãããã¨ããã¯ãªã¢ã¼ããããã¨ãã欲æ±ããæå°ã«ãªãã®ã¯ãä½ã¨ãªãç解ã§ãã¾ããããããããåæã«å§ãããClash of Clansãã«ã¯åµã¾ãã¾ãããæ°ã«ãªã£ã¦ãããã²ã¼ã ã®ä¸ã«å¦ä½ã«èªç¶ã«èª²éã·ã¹ãã ãåãå ¥ããããã¨ãã課é¡ã«ã¤ãã¦ããå人çã«ã¯ãClash of Clansãã®æ¹ãä¸æã«è§£æ±ºãã¦ããããã«æãã¾ãã
ããè¦ãããã¯ãåæã¢ã¯ã»ã¹ã10ä¸ä»¥ä¸ãã£ã¦ãä½åº¦ãã·ã¹ãã é害ããã£ãã¨ã®ãã¨ï¼ãããããã§ããããâ¦â¦ï¼ãç§ã®èå³ã®æ¹åæ§ã¯ã課éã·ã¹ãã ã§ãã£ãããã·ã¹ãã æ§æã«ããã®ã§ããè¦ãããã®ã·ã¹ãã é害ã®æ¹ãå¼·ãèå³ã®å¯¾è±¡ã«ãªãã¾ãï¼è¦ç¬ï¼
ãã¨ããããã§ããã½ã¼ã·ã£ã«ç³»ã§èµ·ãããã¡ãªåé¡ãã¨ããã®ãèãã¦ã¿ããã
ããè¦ãããã¯æ¢ã«è¾ãã¦ãåå å¾
ã¡ã®äººã«å¸ãè²ãã¾ããã®ã§ãè¨æ¶ã®ç¯å²ã«ãªã£ã¦ã¾ãããããã¾ã§æ³åã§ãã®ã§ãäºæ¿ãã ããã
SQLã使ãããNoSQLã使ãã
ãSIerç³»ã®æè¡è ã§ã SQL ãè¦æãªäººãå¤ãã®ã§ãããã½ã¼ã·ã£ã«ç³»ã®æè¡è ã§ã¯ãã£ã¨ SQL ãè¦æãªäººãå¤ãããã§ãããããªç¶æ³ã§ããªã RDBMS ãé¸æããã®ãç§ã«ã¯ã¤ãã¤ãç解ã§ããªãã®ã§ããããè¦ãããã«å¿ è¦ãªãã¼ã¿ã¯ï¼ç»åãé³å£°ãã¡ã¤ã«ãé¤ãã°ï¼éå®åãªãã®ããªãããã¹ã¿ã¼ãã¼ã¿ã¯ã攻略Wikiã«ã»ã¼åç¾ããã¦ããç¨åº¦ã§ããæ´çããã°ã¨ã¯ã»ã«ã§ãäºè¶³ããã¬ãã«ã§ãã®ã§ã確ãã« RDBMS ã使ã£ãæ¹ã楽ã«éçºã§ããã¨æãã¾ãã
ãåã«ããã¨ããè¦ãããã§ã¯ãMySQL Cluster ã使ã£ã¦ããã¨ã®ãã¨ã§ããMySQL Cluster ã¯è¯ãã§ãã¦ãã¦ãSQL 㨠NoSQLï¼SQLãã·ã§ã¼ãã«ããããAPIï¼ã®ãããã§ãå©ç¨å¯è½ã§ãããããè¦ãããã®ã·ã¹ãã ãèããã°ãåç §ç³»ã¯SQLãæ´æ°ç³»ã¯NoSQL(API)ã§ä½¿ãã®ã妥å½ã§ãããã
ããããæ´æ°ç³»ã§NoSQL(API)ã使ç¨ãã¦ããªããã°ãããªããçãè¨è¨ãã§ãããææãªãã·ã§ã³ï¼ã®ã¯ãï¼
â» CGE(Carrier Grade Edition)ã«å«ã¾ãã¦ãã¦ãCGEã¯ä¸é¨ææã§ãããNoSQL(API)ã¯ç¡æã®ããã§ãã
ãªã®ã§ã大人ã®äºæ
㧠NoSQL(API)ã使ã£ã¦ãªãå¯è½æ§ãããã¾ãããããããå¤æ´ç¹ã¯10人æ¥ç¨åº¦ããã°ã§ããã§ããããããå½åãSQLã使ã£ã¦ããã¨ãã¦ããããç´ãã¦ããé ã§ãããï¼ã§ãããï¼ï¼
JOINãé¿ããï¼
ãMySQL Cluster ã使ããªããããã¾ã§æ¸ãã¦ããããã«å¹ççã« SQL ãæ¸ããªãã¨æå³ããªããJOIN ãé¿ããããããè¿ã£ã¦DBãµã¼ãã®è² è·ãæããã¾ãã
ãããããMySQL Cluster ã使ããªãã¨èãã¦ããï¼ãæ製ã®ï¼ã¹ã±ã¼ã«ã¢ã¦ãã«åã㦠JOIN ãç¦æ¢ãããã¨ãã話ãããèãã¾ããï¼例えばこんな記事 http://d.hatena.ne.jp/iad_otomamay/20110808/1312805917ï¼
ããè¦ãããã¯ç´æ¥é¢ä¿ãªãã®ã§ããããJOINã®ç¦æ¢ããæ¬å½ã«æ£ãããèãã¦ã¿ã¾ãã
ãçµè«ããè¨ãã¨ãJOIN ãé¿ãã¹ã±ã¼ã«ã¢ã¦ãããã¨ãã㧠DBãµã¼ãã®ãã³ã¯ã®å¯è½æ§ã¯æ¸ããªãã©ããããéã«å¢ãããã¨ã«ãªãã¾ãã
ãRDBMS ã¯ã大éã®ãã¼ã¿ãå¦çãããã¨ãç®çã«ä½ããã¦ãç¾å¨ã®ãã¼ãã¦ã§ã¢ç°å¢ã§ããã° CPU ã使ããããã¨ã¯ããªãé£ãããã¡ã¢ãªã¼ã足ããªããªããã¨ãã»ã¨ãã©ã§ããç¹ã«ãä¸ã¤ä¸ã¤ã®å¦çã¯åç´ã§ã大éã®ã¢ã¯ã»ã¹ãæããã¨ãéè¦ãªã½ã¼ã·ã£ã«ç³»ã®ã·ã¹ãã ã§ã¯ããã¡ã¢ãªã¼ãå¹ççã«å©ç¨ãããã¨ã ããæ°ã«ãã¦ããã°åé¡ãªããã¨è¨ãåã£ã¦ãéè¨ã§ã¯ããã¾ããã
ããã®ã¡ã¢ãªã¼ã®ä½¿ãæ¹ã§ããããã¼ã¿ãæ¯åãã¼ããã£ã¹ã¯ããåãåºãã¦ãã¦ã¯éã«åããªãã®ã§ãã¡ã¢ãªã¼ã®7ã8å²ããã¼ã¿ã®ãã£ãã·ã¥ã«å²ãå½ã¦ãæ®ããä½æ¥ã¨ãªã¢ã«å²ãå½ã¦ãã®ãä¸è¬çã§ãããã
ãæ®ãã®ä½æ¥ã¨ãªã¢ãã©ã®ããã«å©ç¨ããããã¯ãã³ãã¯ã·ã§ã³ã¨ã»ãã·ã§ã³ã«ã¤ãã¦ç解ããå¿ è¦ãããã¾ããAPãµã¼ãã¨DBãµã¼ãã¯ãã¾ããã³ãã¯ã·ã§ã³ã確ç«ãã¾ããã³ãã¯ã·ã§ã³ã確ç«ããå¦çã¯é常ã«éããå¦çã®åº¦ã«è¡ãããã«ã¯ãããªãã®ã§ãé常ãæ¥ç¶ããã¾ã¾ã«ãã¦ä½¿ãåãã¾ãï¼ã³ãã¯ã·ã§ã³ãã¼ã«ï¼
ãå³ã®æ§ã«ãªããDBãµã¼ãã¯ã³ãã¯ã·ã§ã³ã®ä¸ã«ã»ãã·ã§ã³ãä½ããã»ãã·ã§ã³ã®ä¸ã§ã¯ã¨ãªã¼ãçºè¡ãã¾ãã
ãã¯ã¨ãªã¼ãå¦çããããã«ã»ãã·ã§ã³æ¯ã«å©ç¨ããã¯ã¼ã¯ã¡ã¢ãªã¼ã®å¤§ããã¯ãåæãã©ã¡ã¼ã¿ã® Sort_Buffer_Size ã§æå®ãã¾ããï¼åçã«ãå¤æ´å¯è½ï¼
ãé常ãSort_Buffer_Size 㯠128KByteã2MByteãããã§æå®ãã¾ãã
ãä¸é£ã®å¦çã§ãå¥ã ã«ã³ããããããå¦çãªã©ã®ã¨ãã«ã»ãã·ã§ã³ãåãããã¨ãããã¾ãããã½ã¼ã·ã£ã«ç³»ã®ã·ã¹ãã ãªããã»ã¼ã1ã³ãã¯ã·ã§ã³ã«å¯¾ãã¦ã1ã»ãã·ã§ã³ã§ååã§ããããããããåæã¢ã¯ã»ã¹ã10ä¸ã§ãã®éãDBãµã¼ãã§å¦çãããªããå°ããã® 128KByte ã® Sort_Buffer_Size ãæå®ãã¦ãã
ã128KByte à 100,000ã³ãã¯ã·ã§ã³ï¼ã»ãã·ã§ã³ï¼ ï¼ 12.8GByte ã®ä½æ¥ã¡ã¢ãªã¼ãå¿ è¦ã«ãªãã¾ãã
ãMySQL ã®è¨è¨ä¸ã®æ大ã³ãã¯ã·ã§ã³æ°ã¯10ä¸ã§ããã1ã¤ã®ã³ãã¯ã·ã§ã³ã«ã¤ã OS ã®ã¹ã¬ããã1ã¤å¿ è¦ã¨ããOS ãã¹ã¬ããæ¯ã«ã¡ã¢ãªã¼ã確ä¿ãã¾ãã®ã§ãç¾å®çã«ã¯ DBãµã¼ãã¯10ä¸ãã®åæã¢ã¯ã»ã¹ã¯ãªããªãããªãã¾ãããã§ããããAPãµã¼ããã³ãã¯ã·ã§ã³ãã¼ã«ãä½ã£ã¦ãDBãµã¼ãã«å¯¾ããæ大ã®ã¢ã¯ã»ã¹æ°ãã³ã³ããã¼ã«ããããã§ãããã®ããã大éã¢ã¯ã»ã¹æã®ããã«ããã¯ã¯ ã³ãã¯ã·ã§ã³æ°ããããã«å¯¾ããã¡ã¢ãªã¼é ã¨ãªããã¨ãã»ã¨ãã©ã§ãã
ãâ» DWHï¼Data Ware Houseï¼ãªã©ã®ã·ã¹ãã ã¯ãåææ¥ç¶ã¦ã¼ã¶æ°ãæ°åãæ°ååã¨ãªãã®ã§ãã³ãã¯ã·ã§ã³æ°ãããã«ããã¯ã«ãªããã¨ã¯ã¾ããªãã1ã¤ã®å¦çã§ã¹ã¯ãããããããªå¤§ããªå¦çã®å ´åã¯ãåå²ãå¿
è¦ã«ãªãã¾ãã
JOINãé¿ãã¦DBãµã¼ããã¹ã±ã¼ã«ã¢ã¦ã
ããè¦ãããã®ãããªã·ã¹ãã ã®å ´åãä¸äººã®ã¦ã¼ã¶æ
å ±ã2KByteã§100ä¸ã¦ã¼ã¶ããã¨ãã¦ã 2GByteã§ãããããã¹ã¿ã¼ç³»ã¯ä¸åã¹ã±ã¼ã«ã¢ã¦ãã¯å¿
è¦ããã¾ããããã®ãããªã·ã¹ãã ã§JOINãé¿ãã¦ã¹ã±ã¼ã«ã¢ã¦ãããã¨ããã¨ãå³ã®æ§ã«ãªãã§ãããã
ã
ãJOINããããããªå¦çã®å ´åã1å¦çãçµããã¾ã§ã®éãã©ã¡ãã®ã³ãã¯ã·ã§ã³ã解æ¾ã§ãã¾ããï¼ãã¾ããï¼ãããã¹ã±ã¼ã«ã¢ã¦ããã¦ãµã¼ãæ°ãå¢ããã¦ããã¹ã±ã¼ã«ã¢ã¦ãããªãã£ãDBãµã¼ãã®ã³ãã¯ã·ã§ã³æ°ãå¢ãããã¨ãã§ãããã¹ã±ã¼ã«ã¢ã¦ãããåã¨åãç¶æ ã®ããã«ããã¯ã«ãªã£ã¦ãã¾ãï¼Sort_Buffer_Size ãå°ããã§ããã°è©±ã¯å¥ã§ããâ¦â¦ï¼3å°ã«ã¹ã±ã¼ã«ã¢ã¦ãããã°ãã¹ã±ã¼ã«ã¢ã¦ãããªãDBãµã¼ãã¸ã®ã³ãã¯ã·ã§ã³ãã¼ã«æ°ã¯ãã¹ã±ã¼ã«ã¢ã¦ãããDBãµã¼ãã¸ã®ã³ãã¯ã·ã§ã³ãã¼ã«æ°ã®3åã®1ã«ããªãã¦ã¯ãªããªãã®ã§ãããå ¨é¨ãã¹ã±ã¼ã«ã¢ã¦ãåã®ã³ãã¯ã·ã§ã³ãã¼ã«æ°ã«ããã¾ã¾ã«ãã¦ãã¹ã±ã¼ã«ã¢ã¦ãããæ¹ãä¸å®å®ã«ãªããªãã¦ãã¨ããè¦ããã¨ããããããªããªããããªâ¦â¦ï¼è¦ç¬ï¼
ãJOINã«éãããAPãµã¼ãã§å¦çããããã¨ã«ãã£ã¦é ããªããªããDBãµã¼ãã«å¯¾ããã³ãã¯ã·ã§ã³ãæ´ãã ã¾ã¾ã«ãªããããçµæçã«DBãµã¼ãã«è² è·ãæãã¦ãã¾ãã®ã§ãã
ãã¤ã¾ããç¡é§ã«é
ãã ãã§ãã¦ã¼ã¶ã«ããã·ã¹ãã ã«ãä½ãè¯ããã¨ã¯ããã¾ããã
ãè¤éã ããè² è·ãé«ããã¨æãã®ã¯å¤§ããªãä¸è©±ï¼
ãè¤éã ããããåç´ã ããããã·ãã¢ãªè¦ä»¶ã«ãªãã°ãªãã»ã©ããéããã¨ãæ£ç¾©ãã«ãªãã¾ãã
ãéããã°ããã¨ããã®ç¬éã®è² è·ãé«ãã¦ããããã«ãªã½ã¼ã¹ã解æ¾ãã¦ãããã®ã§åé¡ãªãããè¤éãªãã¨ã§è² è·ãéçãè¶ ãããªãããã®å¦çã§ãã£ã¹ã¯ã½ã¼ããå ¥ãã¨ãããã¨ã«ãªãã¾ãããã極端ã«é ããªãããããã«åããã¾ããï¼ãã®å¦çãè¡ãããã»ãã·ã§ã³ã ããåçã« Sort_Buffer_Size ã大ãããã¦ãè¯ãã®ã§ããããå©ç¨ã¯è¨ç»çã«ï¼ï¼
ãã¤ã¾ããæ¸ãã¦ã¯ãããªãã»ã©è¤éãã©ããã¯ããã¡ã³ãã§ãããããé¤ãã°ããéããã©ãããã§å¤æããã°ããããã¡ã³ãã§ããããã¯è¦ããã«è¦å¡ã®ã¹ãã«ã®åé¡ã§ããããRDBMSã使ããªããï¼APIã使ããã«ï¼SQLãé¿ãã¦å¾ãããã¡ãªããã¯ããä¸æç³ã«åãããã以å¤ã«ãªãã¨ãããã¨ã«ãªã訳ã§ãã
ããããããããããªãããé
ãããã©ãµã¼ãã®è² è·ã¯ä¸ãããã¨ããä¸è¿·ãè¨ã¯ãããªãããã«ï¼
ææ³
ãä»åã20å¹´ã¶ããããã«ãè¦ãããã¨ãClash of Clansãã¨2ã¤ã®ã²ã¼ã ããã£ã¦ã¿ã¾ããã
ãç§ã¯ã½ã¼ã·ã£ã«ç³»ã®ã·ã¹ãã ã¯æªçµé¨ãªã®ã§ãå®éãã©ããããã®è² è·ãæãã£ã¦ãããã¯ãå¤ããè¦ãã·ã¹ãã ã®ç¶æ³ããçè«å¤ã§äºæ³ããããããã¾ããã
ããClash of Clansããããããªãã«åæã¦ã¼ã¶ããã¦ããã§ãã·ã¹ãã ã®è¤éãããã®ããã©ã¼ãã³ã¹ã¨å®å®æ§ãã¿ãã¨ãFlashã²ã¼ã ã¨ãããã³ããå·®ãå¼ãã¦ãããClash of Clansãã®æ¹ãä½åãä¸ã§ããã
ãå°¤ãããClash of Clansãã¯ä½ããã® NoSQLï¼å¤åãMongoDBã§ãããï¼ã使ã£ã¦ããã¯ãã§ããï¼è¦ç¬ï¼
ãã¯ã©ã¤ã¢ã³ãå¦çã®ã¢ãã¡ã¼ã·ã§ã³ãªãã¦ãã¬ã¹ãã³ã¹ãé
ããã¨ã®é ãèï¼ã¹ãã©ãã·ã¥ç»é¢ã¨åãï¼ã§ããããããè¦ããããªãæ°ç§ã¯ä½è£ãããã
ãæè¿ã®ãã¼ãã¦ã§ã¢ç°å¢ã§ããè¦ãããã®ç¶æ
ãè¯ãã¨ãã®ã¬ã¹ãã³ã¹ã§è¯ããªãã10ä¸åæã¢ã¯ã»ã¹ãããæããããªãã®ãªãã§ããã©ãâ¦â¦ã
ããã¡ããããè¦ãããããããªå¹¼ç¨ãªçç±ã§ãã©ãã£ã¦ããã®ã§ã¯ãªãã¨ä¿¡ãã¦ãã¾ãããã©ãMySQL ã使ããªãã SQL ãé¿ããã¨ãã«èµ·ããæåã«ä¼¼ã¦ããªããã¨ã¯ãå人çã«æã£ã¦ãã¾ããï¼éããã¨ãç¥ãï¼ï¼
ãã¨ã«ãããRDBMS 㯠SQL ãæ大ã®ããã«ããã¯ã«ãªãã®ã§ãã
ãSQLã使ããªããã¨ã§ãã®ããã«ããã¯ãé¿ãã¦ãã¤ããã§ããNoSQL ã® API ã使ããªãéããå¿ ãæ大ã®ããã«ããã¯ã® SQL ãéã£ã¦ãã¾ãã¾ããããRDBMS ã使ããªããã·ãã¢ãªã·ã¹ãã ã«ãªãã°ãªãã»ã©ãSQL ã極ããªããã°ãããªãã
ãå¹´ã ãRDBMS ã使ããªãã SQL ãé¿ãã人ãå¢ãã¦ãã¾ãããSQL ã使ãããã°æ°åãæ°ååã®ã¬ã¹ãã³ã¹ãåºããå ´åãã»ã¨ãã©ã§ããã¨ãããã¨ã¯ãé£ããèããªãã¦ããåããã¼ãã¦ã§ã¢ç°å¢ã§æ°åãæ°ååã®ã¢ã¯ã»ã¹ã«èããããã
ãå®ã«åç´ãªãã¨ãªãã§ããã©ãâ¦â¦ã