Tarantoolã¬ããŒãïŒ1æ¥ããã15åã®ãªã¯ãšã¹ããåŠçããæ¹æ³ " -Mail.Ru Technology Forum 2011ã®äžé£ã®ãã©ã³ã¹ã¯ãªããã®æ¬¡ã ã¬ããŒãã埩å·åããã·ã¹ãã ã®ä»çµã¿ã®è©³çŽ°ã«ã€ããŠã¯ã Mail.Ru Technology ForumïŒHigh-tech in event-managementã®ãInside Outãèšäºãåç §ããŠãã ããã ãã©ãŒã©ã Webãµã€ãïŒ http://techforum.mail.ru ïŒããã³ä»ã®ã¬ããŒãã®ãã©ã³ã¹ã¯ãªãããžã®ãªã³ã¯ããããŸãã
ïŒã¢ãã€ã«ããã€ã¹çšã®ãããªããŒãžã§ã³ãããŠã³ããŒã -iOS / Android H.264 480Ã368ããµã€ãº170 Mbããããªãããã¬ãŒã500 kbpsããªãŒãã£ãª-64 kbpsïŒ
ïŒé«è§£å床ãããªããŒãžã§ã³H.264 624Ã480ããµã€ãº610 Mbããããªãããã¬ãŒã1500 kbpsããªãŒãã£ãª128 kbpsãããŠã³ããŒãããŸãïŒ
ïŒãã¬ãŒã³ããŒã·ã§ã³ã¹ã©ã€ãã®ããŠã³ããŒã ã520KïŒ
誰ãã圌ãç¥ã£ãŠããã®ã§ããã®ã¹ããŒã«ãŒã玹ä»ããã®ã¯é£ããã§ãã çããã¯ãKostyaãæã«ãã補åã䜿çšããŠãããšç¢ºä¿¡ããŠããŸãã ããã¯äž»ã«MySQLã§ãã Kostyaã¯ãé·å¹Žã«ããã£ãŠãã®äººæ°ã®ããããŒã¿ããŒã¹ãéçºããŠããŸããããã®ããŒã¿ããŒã¹ã¯ã100ïŒ ã§ãªããã°ããã·ã¢ã®ãµã€ãã®90ïŒ ã«äœ¿çšãããŸãã ä»æ¥Kostyaã¯Mail.Ru Groupã§åããŠããŸãã Kostyaã¯ä»æ¥ãç§ãã¡ãäœãããããã©ã®ããã«æ©èœãããããããŠæãéèŠãªããš-ãµãŒãã¹ãå©çšã§ããããã«ããããã©ãŒãã³ã¹ã®çš®é¡ã«ã€ããŠæããŠãããŸãã
ããã«ã¡ã¯ ä»æ¥ã¯ããããã®äººãããŸãã æ¥ãŠãããŠããããšãïŒ ç§ã¯ãã§ã«çŽ¹ä»ãããŠããã®ã§ãç§ã¯ãŸã èªåã®éãšã±ãŒã¹ã®ãšã³ãžãã¢ã§ããããšãä»ãå ããããšæããŸãã ç§ã¯ããããªãŒãããã®ã§ã¯ãªããã¿ã©ã³ããŒã«ã®éçºã«ç©æ¥µçã«åå ããŠããã®ã§ãããèå³ãããã°ãä»æ¥ã¯åœŒã«é¢ãããã¹ãŠãåŠã¶æ©äŒããããŸãã äœããã®æ¹æ³ã§ããã®ã¬ããŒãã¯ãå°æ¥ã®DBMSã®ãããã¯ã«é¢ããå²åŠã«å ããŠãã¿ã©ã³ããŒã«ã«é¢ãããã®ã§ãã ã§ããããä»æ¥ããã«æ¥ã人ãã¡ãç解ãããªãããªãããããããã®ããç解ããããšæããŸãã
Tarantoolãè©Šãã«ãã®ã¬ããŒãã«ã¢ã¯ã»ã¹ãã人ã¯ããã®ãã©ãŒã©ã ã§è©³çŽ°ãã芧ãã ããã ãã®ãããªäººã¯ããŸããïŒ
äžè¬ã«ã Tarantoolã¯Mail.Ru Groupã«ãã£ãŠéçºãããã·ã¹ãã ã§ãããåœç€Ÿã§æãç©æ¥µçã«äœ¿çšãããŠããŸãããé©çšç¯å²ã¯ã¯ããã«åºããããããã¯çŽ æŽãããããšã§ãã ããã¯ãªãŒãã³ãœãŒã¹ã®ã·ã¹ãã ã§ãããç§ã®æèŠã§ã¯ååã«ææžåãããŠãããå€ãã®ããã°ã©ãã³ã°èšèªïŒPythonãRubyãPerlïŒãžã®ã³ãã¯ã¿ããããŸãã æè¿ãã»ãã®2æ¥åãã³ãã¥ããã£ã®ã¡ã³ããŒã®1人ãPythonã®æ°ããã³ãã¯ã¿ãäœæããŸããã ãããã£ãŠãä»æ¥ã®äŒè©±ã®çµæãã¿ã©ã³ããŒã«ãè©Šãããšã«ãªãããšãé¡ã£ãŠããŸãã ãããŠãããããããªãã¯ããããªãæªãã®ããšèšã-ç§ã¯ãã®ãããªã¬ãã¥ãŒãèããŠåãã§ããã§ãããã
äœã«ã€ããŠè©±ããŸããïŒ ã¬ããŒãã®ãããã¯ã¯ããªãéå¿çã§ãããããDBMSãšã³ã·ã¹ãã ã«ãããTarantoolã®äœçœ®ã«ã€ããŠèª¬æããŸããããŒã¿ãæ ŒçŽããããã®ããŸããŸãªãœãªã¥ãŒã·ã§ã³ãååšããçç±ããã®éãé©åãªçç±ã«ã€ããŠèª¬æããŸãã 次ã«ãã·ã¹ãã ã«çŽæ¥ã¢ã¯ã»ã¹ããŠãäœãã§ããããåæããŸãã æåŸã«ãç§ã®èšç»ãããŒã ã®èšç»ã補åã«è¿œå ããæ©èœãªã©ã«ã€ããŠã®è©±ãç· ãããããŸãã
ããããã®ãããªåçã§ãããã£ã30åã§ããããã¹ãŠã®ããŽãèšç·ŽããŸããã ãããã®ããŽã®åå以äžãèªèããŠãã人ã¯äœäººããŸããïŒ å°æ°æŽŸã ã€ãŸã å€ãã®äººãMySQLãããããMemcachedãããããPostgreSQLãç¥ã£ãŠããŸãã ããã§ãã¹ãŠã§ãã
ä»æ¥ãHadoopã«ã€ããŠã®è©±ãèããŸããããå®éããããã®ã·ã¹ãã ã¯ãã¹ãŠéåžžã«åºã䜿çšãããŠãããéåžžã«äººæ°ããããŸãã ãããŠãããã¯ãã¹ãŠãªãŒãã³ãœãŒã¹ã·ã¹ãã ã§ãã ã·ã¹ãã ãœãããŠã§ã¢ã®äžçã¯ããŸããŸããªãŒãã³ãœãŒã¹ã«åãã£ãŠããŸãã å Yahooããã°ã©ããŒã«ãã£ãŠéçºãããå¯äžã®éãªãŒãã³ãœãŒã¹ã·ã¹ãã ã¯Citrusleafã§ãã ããã¯ããªãè±å¯ãªåçšã·ã¹ãã ã§ãã
äžèšã®ã·ã¹ãã ã察象ãšããããŒã¿ç¹æ§ã®èŠ³ç¹ãããã®ã¹ã©ã€ããåæãããšã2ã€ã®æ¬¡å ãèŠã€ãããŸãã æåã®æ¬¡å ã¯ããŒã¿ã®éã§ãã CassandraãHadoopãVoldemort-倧éã®ããŒã¿ã管çããããã«èšèšãããã·ã¹ãã ã§ãã å³ã®å察åŽã«ã¯ãããŸã倧éã®ããŒã¿ãåŠçããªãã·ã¹ãã ãããèŠãããŸããããã®ããŒã¿ãžã®ã¢ã¯ã»ã¹ã¯éåžžã«é«æ§èœã§ãã 2çªç®ã®æ¬¡å ã¯ãããŒã¿æ§é ã®ã¬ãã«ã§ãã ãããã¯ããããã®ã·ã¹ãã ãæ¯èŒã§ãã2ã€ã®ææšã§ãã å®éãNoSQLã®äžçã®æ¬¡å ã¯ã¯ããã«å€§ãããªã£ãŠããŸãã ãªãNoSQLéåãçãŸããã®ãããªããã®å¯ãèŠãã®ãïŒ ç§ã®æèŠã§ã¯ãåŸæ¥ã®DBMSã®äžçã«ã¯ãäž»ã«3ã€ã®æªè§£æ±ºã®åé¡ããããŸãã 10ã20ã®åé¡ãèŠã€ããããšãã§ããŸããããªã¬ãŒã·ã§ãã«DBMSã®äž»ã§å®éã«è§£æ±ºãäžååãªåé¡ã¯æ¬¡ã®ãšããã§ãã
æåã®åé¡ã§ããæ°Žå¹³ã¹ã±ãŒãªã³ã°ã®åé¡ã¯ãäºæ¬¡ããŒãè€éãªã¯ãšãªãã¹ãã¢ãããã·ãŒãžã£ããæ°åãŸãã¯æ°çŸã®ã³ã³ãã¥ãŒã¿ãŒã®ã¯ã©ã¹ã¿ãŒäžã§ååã«ã¹ã±ãŒãªã³ã°ãããªãããšã§ãã åã®ã¬ããŒãã®ããã«ããŒããè¿œå ããããšã¯ã§ããŸãããHadoopã§ã¯æ°ããããŒããè¿œå ããã ãã ãšèããããšããããŸãã ååãšããŠãåé¡ã¯è§£æ±ºãããŸãã ååãªæ°ã®ã¹ã±ãŒã©ãã«ãªSQLã·ã¹ãã ããããŸãããéåžžã«é«äŸ¡ã§ã-NonStop SQLãTeradataã ããšãã°ãéè¡éšéã§äœ¿çšãããŸãã ã€ãŸããæ°Žå¹³æ¹åã«ããŸãæ¡åŒµã§ããSQLã·ã¹ãã ããããŸããããããŸã§ã®ãšããããããã®ãœãªã¥ãŒã·ã§ã³ã¯ãªãŒãã³ãœãŒã¹ã§ã¯ãããŸããã
ãªã¬ãŒã·ã§ãã«DBMSã®2çªç®ã®åé¡ã¯ãæåã«ããŒã¿ã¹ããŒã ãå®çŸ©ãã次ã«ã¢ãããã¯ããŒã¿ãªã¯ãšã¹ããäœæã§ããããã«èšèšãããŠããããšã§ãã ã€ãŸã ä»»æã®SELECTãä»»æã®JOINãªã©ãèšè¿°ã§ããŸãã ããã¯ãã°ãã°å察ã§ãã ããŒã¿ã¹ããŒã ã¯éåžžã«åçã«å€åããŸããããªã¯ãšã¹ãã¯å€ããå°ãªããåºå®ãããŠããŸã-ããŒã¿ã¹ããŒã ãšãšãã«å€åããŸãããããã ãã§ãã
ãŸãæçµçã«åé¡ïŒ3ã¯ããã©ãŒãã³ã¹ã§ãã ããã¯ãã¬ã¹ã®äŸ¡æ Œã®ãããªãã®ã§ããã€ãŸãã20幎åã®ãã®ã§ããšã³ãžã³ã
ãããŠãåŸæ¥ã®DBMSã®åé¡ã¯äžè¬ã«ç§åŠè ãå®å家ã®ã³ãã¥ããã£ã«ãã£ãŠç解ãç 究ãèªèãããŠãããšããäºå®ã«ãããããããNoSQLã®äžçã¯ãããã®åé¡ã«å¯Ÿããæ°ãã解決çã ãã§ãªããæ確ãªã¹ã¬ãŒããã¢ã€ãã¢ã®ççºããããŠå®éã«ã¯ççºããããšãå€ãå Žæã§çããŸããäœãå¿ èŠãããŸããã ããšãã°ãããŒã¿ã¢ãã«ãªã©ã®é åã ã€ãŸã NoSQLã®äžçã§ã¯ãEdgar Coddã®æåãªã¢ãã«ãå»æ¢ããåæåã¹ãã¬ãŒãžãããŒããªã¥ãŒã¹ãã¬ãŒãžãJSONãXML圢åŒãªã©ã®åã¹ãã¬ãŒãžãªã©ã®ãã©ãã€ã ãææ¡ããŸããã
ããŒã¿ã®äžè²«æ§ã®ããŸããŸãªã¢ãã«ãåæ€èšãããå®éã«é©çšãããŠããŸãã ããã§ãäžè²«æ§ãããŒã¿ã®å¯çšæ§ãDBMSã¯ã©ã¹ã¿ãŒã®ããŒãã£ã·ã§ã³ã«å¯Ÿããå®å®æ§ãã€ãŸãç¡é¢ä¿ãªã»ã°ã¡ã³ããžã®åå²ã®é¢ä¿ãå®çŸ©ãããåè¿°ã®CAPå®çãæãåºãããšãã§ããŸãã å€ãã®äººããã®å®çã解éããããšããŠãããããã¢ããªã±ãŒã·ã§ã³ããã°ã©ãã¯3ã€ã®ããŒã¿ã¢ãã«ãã2ã€ã®ããããã£ãéžæããå¿ èŠããããŸãã ããšãã°ãæçµåæã§ãã¹ãŠã®ããŒããããŒãéã§äžè²«ããŠããå ŽåãåããŒãã®ããŒã¿ã®äžè²«æ§ãããã³ããŒââãéã®æçµçãªäžè²«æ§ãéžæã§ããŸãã
ããšãã°ãæ°ããããŒã¿ã¢ã¯ã»ã¹èšèªãç©æ¥µçã«æäŸãããŠããŸããããããã¯æŽå²ã ãªããžã§ã¯ãã¯ãšãªèšèª ãXQLãNQLãªã©ã®äŸã§ãã10幎åãXML DBMSã¯éåžžã«äººæ°ããããŸããããçŸåšã¯ã©ãã«ãããŸããïŒ
ãããŠæåŸã«ãåžžã«éåžžã«éèŠãªããŒã¿ã¹ãã¬ãŒãžã¢ã«ãŽãªãºã ã®çµ¶ãéãªãé²åãšãå®æ°ããã·ã¥ ããã¹ã¿ãŒãã¹ã¿ã¬ããªã±ãŒã·ã§ã³ãªã©ã®èšå€§ãªæ°ã®æ°ããã¹ã±ãŒãªã³ã°ã¡ãœããã®äœæãç®ã®åœããã«ããŠããŸãã
DBMSã®äžçã®æªæ¥ã¯äœã§ãããNoSQLã®åãã¯äœã«ã€ãªãããŸããïŒ ç§ã®æèŠã§ã¯ãããŒã¿ã¹ãã¬ãŒãžãœãªã¥ãŒã·ã§ã³ã®äžçã¯æ¡å€§ããã¢ããªã±ãŒã·ã§ã³ãšã³ãžãã¢ã¯ãNoSQLãªããžããªããªã¬ãŒã·ã§ãã«ãªããžããªãHadoopã®ãããªåæ£ã¯ã©ã¹ã¿ãããããšãç¥ããããåŸãªããªããŸãã ãããã£ãŠãå°æ¥ã®è£œåã®å€æ§æ§ã®ãã¡ã3ã€ã®ãããã圢æããã3ã€ã®åºæ¬çãªãœãªã¥ãŒã·ã§ã³ã®ã¯ã©ã¹ã¿ãŒããããŸãããã®ãã¡ã®1ã€ã¯ãªã¬ãŒã·ã§ãã«DBMSã§ãããåœç¶ãä»åŸãé·ãæ®ããŸãã
ããŒã¿ã¢ãã«ã䜿çšããå€æ°ã®å®éšã«ã€ãªãããã®ã¯äœã§ããïŒ ããšãã°ãããŒã¿æ§é ãµãŒããŒãšããŠãç¥ãããRedisã®ãã©ãã€ã ãèããŠã¿ãŸãããããã®ã¢ãããŒãã¯æ®åããŸããïŒ ç§ã®æèŠã§ã¯ãããŒã¿ã¢ãã«ã¯2ã€ã®åºæ¬çãªã¢ãããŒããå®å®ãããå¿ èŠããããŸãïŒãã¬ãŒã³ããŒã·ã§ã³ããã®ã¢ãã«ã®æœè±¡åã®ååšã瀺åããã¢ãããŒããããã§ã¯ãªã¬ãŒã·ã§ãã«ã¢ãã«ãããåªããæœè±¡åãããã³ããŒã¿è¡šçŸã¢ãã«èªäœã§ãã
ããã§ãææ°ã®DBMSã®äžçã®ã¬ãã¥ãŒãå®äºããããšæããŸãã äºæž¬ã¯æ©ç¥ããã®åºæ¥äºã§ãããNoSQL DBMSã®äžçã«ãããTarantoolã®äœçœ®ãç¥ãããã«ãäžè¬çãªç¶æ³ã説æããããšã«ããŸããã
Tarantoolã¯ããã¹ãŠã®ããŒã¿ãRAMã«ä¿åããé«æ§èœã¹ãã¬ãŒãžã§ãã å€ãã®å Žåãæåã¯ãã®ãããªç°è«ãè³ã«ããŸã-ãããããããã¯éåžžã«é«äŸ¡ã§ããã ããããRAMãšãã©ãã·ã¥ã¡ã¢ãªãæ¯èŒãããšãRAMã¯ãã©ãã·ã¥ãããå®äŸ¡ã§ããããšãããããŸãã
Tarantoolã¯æ°žç¶çãªã¹ãã¬ãŒãžã§ãã ããŒã¿ã¯RAMã«ä¿åãããŸãããããŒã¿ã®å€æŽã¯ãã¹ãŠã¢ãããã¯ã§ãã Tarantoolã«èšé²ãããŠãããã®ã¯ãã¹ãŠãã£ã¹ã¯ã«æžã蟌ãŸããŸãã
ããã§ãç§ã¯æ°ãæ£ãããéå»ããäŸãæããããšæããŸãã MySQLã®æŽå²ãæãåºããšãæåã¯ãã¹ãŠãMySQLãŠãŒã¶ãŒã³ãã¥ããã£ããã©ã³ã¶ã¯ã·ã§ã³ãå¿ èŠãšãããããŒã¿ã¹ãã¬ãŒãžã®ä¿¡é Œæ§ãšååæ§ã¯å¿ èŠãªãã£ããšããäºå®ããå§ãŸããŸããã MyISAMã®ã¿ãMySQLã®å®å®ããã¹ãã¬ãŒãžãµãã·ã¹ãã ã§ãããMontyããã©ã³ã¶ã¯ã·ã§ã³ãå¿ èŠãšããªãããšããŠãŒã¶ãŒã«çŽåŸãããããšããMySQL
MySQLã®çµéšã«åºã¥ããŠããã©ã³ã¶ã¯ã·ã§ã³ã¯çŸä»£ã®ç£æ¥çšã¹ãã¬ãŒãžã·ã¹ãã ã«å¿ èŠã§ãããšãã信念ã圢æããŸããã ããã¯ãã·ã¹ãã ã¢ãŒããã¯ãã£ã®æ®ãã®ãã©ã¡ãŒã¿ãŒã決å®ããåºæ¬ãã©ã¡ãŒã¿ãŒã§ãããããTarantoolã¯ãã§ã«ã¢ãããã¯æäœããµããŒãããŠãããçŸæç¹ã§ã¯æ¬æ Œçãªãã©ã³ã¶ã¯ã·ã§ã³ãµããŒããéçºããŠããŸãã 次ã®ããŒãžã§ã³ã§ã¯ããã§ã«ããããããŸãã
ããŒã¿ã¢ã¯ã»ã¹èšèªã®åéã§ã¯ãTarantoolãœãªã¥ãŒã·ã§ã³ã¯SQLèšèªã§ãããä»ã®ããã°ã©ãã³ã°èšèªããµããŒããããŠããŸãã
ãã ããããŒã¿ã¢ãã«ã®èŠ³ç¹ããèŠããšãTarantoolã¯ããŒããªã¥ãŒã¹ãã¬ãŒãžãã€ãŸã äž»ãªããŒã¿ã¢ã¯ã»ã¹ã·ããªãªã¯ãããŒããšã«å€ãååŸããããšã§ãã ãããã£ãŠããã¹ãŠã®SQLæ©èœãå®è£ ãããŠããããã§ã¯ãããŸããã
åçŽãªINSERT / UPDATE / SELECT / DELETEã¯ãšãªã«å ããŠãLuaã¹ãã¢ãããã·ãŒãžã£ããµããŒãããŠããããã䜿çšããŠããããŒã¿ã¢ã¯ã»ã¹ã¹ã¯ãªãããéåžžã«æè»ã«æ±ºå®ã§ããŸãã ã¹ãã¢ãããã·ãŒãžã£ã䜿çšãããšãTarantoolãããŒã¿ãµãŒããŒããããžãã¹ããžãã¯ãµãŒããŒã«å€ããããšãã§ããŸãã ä»»æã®ããŒã¿ä¿å圢åŒãããŒã¿ã®äžè²«æ§ã®ä»»æã®äžå€åŒãä»»æã®ã¯ãšãªãããã°ã©ã ããããšãå¯èœã«ãªããŸãã
èŽè¡ããã®è³ªåïŒ
ããŒã¿ã®æ°žç¶æ§ã¯ã©ã®ããã«ç¶æãããŸããïŒ
ãã®ã³ã°ãã€ãŸã ãã¹ãŠã®ãšã³ããªã¯ãã£ã¹ã¯ã«èšé²ãããŸãã ããã«ã€ããŠèª¬æããŸãããæåã«ããŒã¿ã¢ãã«ã«ã€ããŠèª¬æããŸãã
ç§ãã¡ã®ããŒã¿ã¢ãã«ã¯çºæã§ã¯ãããŸããã åçŽåããããªã¬ãŒã·ã§ãã«ã¢ãã«ãšããŠèª¬æããŸãã åºæ¬çãªã¹ãã¬ãŒãžèŠçŽ ã¯ã¿ãã«ã§ãã ã¿ãã«ã«ã¯ä»»æã®æ¬¡å ããããäžæã®ããŒã«é¢é£ä»ãããããã£ãŒã«ãã®ä»»æã®é·ãã®ãªã¹ãã«ãããŸããã åã¿ãã«ã¯ããã€ãã®ã¹ããŒã¹ã«å±ããŸãã ã¿ãã«ã®ãã£ãŒã«ãã䜿çšããŠãã€ã³ããã¯ã¹ã決å®ã§ããŸãã ãªã¬ãŒã·ã§ãã«DBMSãšã®é¡äŒŒæ§ãåŒãåºãå Žåããã¹ããŒã¹ãã¯ããŒãã«ã«å¯Ÿå¿ããããã£ãŒã«ããã¯åã«å¯Ÿå¿ããŸãã æŽæ°ãšæååã®2çš®é¡ã®ããŒã¿ãšãããã·ã¥ãšãã€ããªããªãŒã®2çš®é¡ã®ã€ã³ããã¯ã¹ããµããŒãããŠããŸãã
ã€ã³ããã¯ã¹ã¯åçŽãŸãã¯è€åã®ããããã§ãããæ€çŽ¢ã«ã¯ä»»æã®ã€ã³ããã¯ã¹ã䜿çšã§ããŸãã ãã ããåã¹ããŒã¹ã§ã¯ãåçŽãªäž»ããŒãæå®ããå¿ èŠããããŸããããã¯ãæ¿å ¥ãæŽæ°ããŸãã¯åé€ã®éã«ã¢ã¯ã»ã¹ããããã«äœ¿çšããå¿ èŠããããŸãã ããšãã°ããã£ãŒã«ã3ããã³5ããŸãã¯ãã£ãŒã«ã7ã9ã11ãä»ããŠãè€åã»ã«ã³ããªããŒãä»ããŠã¢ã¯ã»ã¹ã§ããŸãã
ç¹°ãè¿ããŸãããç§ãã¡ã¯ããŒã¿ã¢ã¯ã»ã¹èšèªã®åéã®ã€ããªãã®ãŒå®¶ã§ã¯ãããŸãããã¯ã©ã€ã¢ã³ãã¯SQLã¢ã¯ã»ã¹ãå®è£ ããä»ã®ããã°ã©ãã³ã°èšèªã®ã³ãã¯ã¿ã®åéã§ã¯ãåŸæ¥ã®DBMSã®äžçã®åæã«æºæ ããŠããŸãã PHPã§ã¯æ¬¡ã®ããã«ãªããŸãã
éå§ããã«ã¯ãããŒã¿ããŒã¹ãšã®æ¥ç¶ã確ç«ããå¿ èŠããããŸãã ã¯ãšãªãå®è¡ããã«ã¯ãã¢ã¯ã»ã¹ããŠããã¿ãã«ã¹ããŒã¹ãç¹å®ããå¿ èŠããããŸãã ãã®æ®µéã§ã¯ãTarantoolã®ãã¹ãŠã®ã¹ããŒã¹ãšãã¹ãŠã®ãªããžã§ã¯ãã«çªå·ãä»ããããã¢ã¯ã»ã¹ã¯ãªããžã§ã¯ãã®çªå·ã«ãã£ãŠè¡ãããŸãã ã€ã³ããã¯ã¹çªå·ãã¹ããŒã¹çªå·ãªã©ããããŸãã 次ã®ã¹ã©ã€ãã§ã¯ãæ¥ç¶ã確ç«ãããåŸãã¿ãã«ãæ¿å ¥ãããã¿ãã«ãäž»ããŒã«ãã£ãŠã¢ã¯ã»ã¹ãããPHPã®å Žåã¯åçŽãªé åã®åœ¢åŒã§ããŒã¿ãè¿ãããæ§åã確èªããŸãã ããŒã«ãã£ãŠãåžæã®ã¹ããŒã¹ã§ã¿ãã«ãæŽæ°ããããšãã§ããŸãã
ã¿ãã«ãéžæããå Žåããªã¯ãšã¹ããè¡ãããããŒçªå·ãéžæããŸããããã¯ãçªå·0ã®äž»ããŒãŸãã¯ä»ã®ããŒã§ãã
æ©èœã®äžè¬çãªæŠèŠã説æããã®ã§ãããããæ¢ã«äœ¿çšããä»ã®NoSQLã·ã¹ãã ãšã®éãã«ç§»ããããšæããŸãã
ããã©ãŒãã³ã¹ããå§ããŸãã äžè¬ã«ãããã¯RAMå ã®ããŒã¿ã¹ãã¬ãŒãžã§ãããããããã©ãŒãã³ã¹ã¯æåãããšãã°MySQLãªã©ã®åŸæ¥ã®DBMSã®ããã©ãŒãã³ã¹ãããå€§å¹ ã«é«ããªããŸãã è€æ°ã®æ¥ç¶ã«ã¯éåæI / OãšéåæãµããŒãã䜿çšããŸãã 10,000ã®æŽ»æ§ååç©ãç°¡åã«ä¿æã§ããŸãã å èªã¿ãã°ã«ãã¹ãŠã®å€æŽãæžã蟌ãã§ãããšããäºå®ã«ããããããã1å°ã®ãã·ã³ã§ã®ããã©ãŒãã³ã¹ã ãã¹ãŠã®å€æŽããã£ã¹ã¯ã«èšé²ãããšã1ç§ããã100,000ã®UPDATEãšINSERTã«éããŸãã ãã®ãã·ã³ã§ã®èªã¿åãèŠæ±ã«ã€ããŠã¯ã1ç§ããã260,000 SELECTã®ããã©ãŒãã³ã¹ãéæããŸããã ãããã¯ãã®ãããªã¹ãŒããŒãã£ãžããã§ã¯ãããŸãããMemcacheãŸãã¯Redisã®ããã©ãŒãã³ã¹ã«å¹æµããŸãã
ãããŠãäœã®ã¬ã€ãã³ã·ïŒ å¿çé 延ã¯ãããã§ããïŒ
質åã¯ãšãŠãè¯ãã§ãã
ã¹ã©ã€ããåç §ãããã³ãããŒã¯ã¯10åã®ã¹ã¬ããã§äœæãããåã¹ã¬ããã¯äžåºŠã«10åã®ãªã¯ãšã¹ããéä¿¡ããŸããã ãã³ãããŒã¯ã¯ãã¯ã©ã€ã¢ã³ãåŽãè€æ°ã®èŠæ±ããããã§åä¿¡ããå¿çã䞊è¡ããŠéä¿¡ããããã«æ§ç¯ãããŸããã ãµãŒããŒããã±ãããéä¿¡ãããšããã«ãã¯ã©ã€ã¢ã³ãã¯ãã±ãããèªã¿åããŸããã ãªããã®ãããªããã©ãŒãã³ã¹æž¬å®ã¹ããŒã ãéžæããã®ã§ããïŒ TarantoolãããŒãããããã«ã¯ããŸã 100å°ä»¥äžã®ã¯ã©ã¹ã¿ãŒãå¿ èŠã§ãããèªç±ã«äœ¿ããè»ã¯2å°ãããªãã£ãããã§ãã ããã©ãŒãã³ã¹ã枬å®ãããã®ã¢ãããŒãã§ã¯ãé 延ã¯ãã¡ãããå®éã®è² è·ã§èŠ³å¯ã§ãããã®ãããé«ããªããŸãã å®éãåäžã®ãªã¯ãšã¹ãã¯ãšãªã®å®è¡æéã¯ãããŒã¿ãå€æŽãããã©ããã«å€§ããäŸåããŸãã SELECTã®é 延ã¯æå°éã§ãããµãŒããŒã¯ããŒããã¡ã¢ãªããããŒã¿ãèªã¿åããã¯ã©ã€ã¢ã³ãã«éä¿¡ããã ãã§ãããã¯ã¯ãããŸããã
äžè¬çã«ãTarantoolã¯ããã¯ããªãŒã·ã¹ãã ã§ãããããŒã¿æ§é ãšãã£ãã·ã¥ã®ã¬ãã«ã§ãã¹ãŠã®ããŒã¿ãžã®ã¢ã¯ã»ã¹ã¯é 次å®è¡ãããŸããããããã¯ãŒã¯ã¬ãã«ã§ã¯ãå€ãã®æ¥ç¶ã®äžŠååŠçããµããŒããããŸãã ãã®ã¢ãããŒããå®è£ ããããã«ããããããã³ã«ãŒãã³ãã䜿çšããŸããããã¯ããã©ã€ãããŸãã¯ãã°ãªãŒã³ãã¹ããªãŒã ãšãåŒã°ããŸãã
èŠæ±ãããŒã¿ãå€æŽããå Žåãå€æŽã¯ãã£ã¹ã¯ã«èšé²ããå¿ èŠããããŸãã ãããæžã蟌ã¿ãå®è£ ããã«ã¯ãæ·±å»ãªDBMSã§ãã°ã«ãŒãã³ãããããšåŒã°ããã¢ã«ãŽãªãºã ã䜿çšãããŸããã€ãŸããããã€ãã®èç©ãããå€æŽãåæã«ãã£ã¹ã¯ã«æžã蟌ã¿ãŸãã ããã³ããšã³ããšããã¯ãšã³ãã®2ã€ã®é§ ãçµã¶åè»ãšããŠæ³åããã®ãæãç°¡åã§ãã ãã£ã¹ã¯ã«èšé²ããå¿ èŠããããã¹ãŠã®èŠæ±ã¯ããããã¯ãŒã¯ïŒããã³ããšã³ãïŒã®æäœãæ åœããããã»ã¹ã®ãã©ãããã©ãŒã ã«èç©ãããŸãã 次ã«ããããã®èŠæ±ã¯ãã¹ãŠããã¬ã€ã³ã«æµžæŒ¬ããããŸããã€ãŸãããããã¡ãªã³ã°ãããŠãã£ã¹ã¯ã«æžã蟌ãŸããŸãã 1ã€ã®ã¯ãšãªã°ã«ãŒãããã£ã¹ã¯ã«æžã蟌ãŸãããšããã«ãããã¬ã€ã³ãã次ã®ã¯ãšãªã°ã«ãŒãã«æ»ããŸãã ãããã£ãŠãINSERT / UPDATE / DELETEèŠæ±ã®å®è¡ã®é 延ã¯ããã©ãããã©ãŒã ã䜿çšããŠããç¬éã«äŸåããŸãã ææ°ã®æ©åšã®æ倧å€ã¯0.01ç§ã§ãããŒããã£ã¹ã¯ã®ä»»æã®ã·ãªã³ããŒã®ä»»æã®ãããã¯ã®èšé²æéã§ãã
ã©ã®ãã¡ã€ã«ã·ã¹ãã ã䜿çšããŠããŸããïŒ
ä»»æã®ãã¡ã€ã«ã·ã¹ãã ã䜿çšããŸãã Linuxãªã©ããã®ç¹å®ã®ZFSã§ZFSãå®è¡ããŠããå Žåã¯ããé¡ãããŸãã ãã®å ŽåãPOSIX APIã䜿çšããŠãã¡ã€ã«ãæäœããŸãã ç§ãã¡ã䜿çšããå¯äžã®éPOSIXåŒã³åºãã¯fallocateïŒïŒã®åŒã³åºãã§ããããã¯ãç§ã®æèŠã§ã¯ãJFSãXFSãããã³EXT4ã§ãµããŒããããŠããŸãã
ãªãfallocateïŒïŒã䜿çšããã®ã§ããïŒ ããã¯ãææ°ã®ãã¡ã€ã«ã·ã¹ãã ã®ä»çµã¿ã«ãããã®ã§ãã ããã«ã€ããŠè©³ãã説æããå¿ èŠããããŸããåŸã§èª¬æããŸãã
ã¯ã©ã€ã¢ã³ãã«é¢ããããå ·äœçãªè³ªåã¯ã1ã€ã®å Žæãã1ã€ã®ã¯ã©ã€ã¢ã³ããããåãããŒã®1000åã®GETã«åæã«ã¢ã¯ã»ã¹ããæ¹æ³ã§ãã ã©ããããããããã®ããžãã¹ããããã·ã§ããŸããïŒ ã«1000ãªã¯ãšã¹ããéä¿¡ããªãã§ãã ãã...
GETã¯ã©ã®ããã«æ©èœãããããã·ããããšã¯ã§ããŸããïŒ Tarantoolã«ã¯ã¯ã©ã€ã¢ã³ããããã³ã«ããããŸãã ããšãã°ãMemcacheã¯ããã¹ãããã³ãã€ããªãããã³ã«ããµããŒãããŠããŸãã åæ§ã®æ¹æ³ã§è¡ããŸããã ãã€ããªãããã³ã«ã¯äž»ã«ãGETãã³ãã³ãã®1ã€ã§ããå Žåã«äœ¿çšãããŸãã ã³ãã³ãã³ãŒãã¯èŠæ±ãã±ããããããŒã§4ãã€ãã䜿çšããããããŒå šäœã¯12ãã€ãã䜿çšããŸãã ããããŒã®2çªç®ã®4ãã€ãã«ã¯ããªã¯ãšã¹ãIDãå«ãŸããŠããŸãã ãªã¯ãšã¹ãIDã¯ãç¹å®ã®ãªã¯ãšã¹ããäžæã«èå¥ããããŒãã³ã°ã®æ段ã§ãã ãªã¯ãšã¹ããžã®å¿çãšããŠããµãŒããŒã¯æž¡ããããªã¯ãšã¹ãIDãè¿ããŸãã ããã«ããããªã¯ãšã¹ããéåžžã«ç°¡åã«ãããã·ã§ããMail.Ru Groupã§ç©æ¥µçã«äœ¿çšãããŸãã ãããã·ã¯æ°åã®ãã·ã³ããæ°åã®ãã·ã³ãããªã¯ãšã¹ããåä¿¡ããããããTarantoolã«éä¿¡ããŸãããã®åŸãrequest-idã«ãã£ãŠãªã¯ãšã¹ãã®éä¿¡å ãã·ã³ãç¹å®ãããã®ãã·ã³ã«Tarantoolã®å¿çãéä¿¡ããŸãã
commit, ?
, . . group commit, . wal_fsync_delay â 0.01 . , Linux. Tarantool, MySQL. , , NUMA- MySQL, . â . , - Mail.Ru wal_fsync_delay 0.01 , .
Tarantool?
ã¯ãããããŸãã .
, Tarantool MySQL?
. , Tarantool, MySQL, Mail.Ru Group, . MySQL, .
. . , GET, , 700 . . , .
SET' . , (Intel Core I7, 7200 ), 300 000 700 000 .
, . 1.5 1.4. UPDATE's. , UPDATE'. .
, , , . Tarantool Key-Value, Trantool , .
auto-increment. PHP, NoSQL Tarantool, - -. UPDATE, , , . , . -, , , . .
Tarantool, . , , â .. space 0. , . , â , .
, , . , Tarantool .
« = tuple ()». ãªããªã , . : â 0 â , â 1 â , .. . â 2 , , , , . , . , . top bottom, UPDATE , box.update() â , callback . , UPDATE , , , printf(). , , =p=p=p, '=' () 1 'p' ( ) top, '=' () 2 'p' ( ) bottom, '=' () top val.
UPDATE, , , , , . , . .
, , Lua. , Lua . JavascriptâŠ
. , LuaJIT â just-in-time compiler, open source . â . Lua , , , - . , GitHub Tarantool, .
, , , - â ?
, -, - . , , 2 2 max+1.
, . , . Tarantool . ? , , WAL. 1 Tarantool 1 . , fiber', coroutines - , -. , ; , , , multi-threaded , . ? nodes, Tarantool.
? Mail.Ru Group.
- , , . , , , , . ã€ãŸã , . â Memcache, Memcache- Memcache expiry â , , , , Lua. Mail.Ru. 4 , 2 Tarantool'. 2 , 2 . 60 100 , Mail.Ru .
, , , Tarantool , Tarantool , , , . , . , , , . - , 400 , . , . Tarantool 120 , , . , 2 , 60 . production , , . , , 20%.
. MongoDB. Mongo , . , . , ..
Mongo ? Mongo â , c Write Ahead Log', ?
, .
, Tarantool . Tarantool snapshot', . , , . copy-on-write, Redis. Write Ahead Log. , Write Ahead Log'. , 0.01 .
MySQL , , , . Tarantool ?
. Tarantool, , MSQL? MSQL , Write Ahead Log, , .. MSQL . Tarantool Write Ahead Log â . : Write Ahead Log . , , , . Write Ahead Log (log sequence number, LSN), , , , .
â , : 5, 8. , , , , . ?
, . , . , .
, â , .
, 6, 83, 1, 21, 8 .. : « 44 , 83 ». ? : , , friend-requests .. 5. . 30 friend-requests, 20, .. 20. .
Tarantool. 5 . 2 , â « ». Tarantool , . , , , . , SQL- ? .
â « ». , , , . .
, .
notification_push() . â user_id, . MySQL, , MySQL, .
notification id . .
GitHub.
notification_push(). unread count, UPDATE . .
. , Tarantool â , , . , -, , , , . , , CAP-.
Tarantool, , Voldemort, Riak, , . , 100 â , Mail.Ru, , 4, 6 , .. . , .
, , , , --, . : . ããããšã
ãã®ããã¹ãã¯ãInfospace Centerã§11æ16æ¥ã«éå¬ãããMail.Ru Technology Forum 2011ã§ã® Konstantin Osipovã«ããã¬ããŒãã®è»¢åã§ãããããªã¬ããŒãããã¹ããäœæããããã®æè¡ã®è©³çŽ°ã«ã€ããŠã¯ããã¡ããã芧ãã ããïŒMail.Ruãã¯ãããžãŒãã©ãŒã©ã ã®è£åŽïŒãã€ãã¯ã€ãã³ã管çãä»ã®ã¬ããŒãã®ãããªããŒãžã§ã³ïŒã¢ãã€ã«ããã€ã¹çšã®ããŒãžã§ã³ãå«ãïŒã¯ããã©ãŒã©ã Webãµã€ãtechforum.mail.ruã§å ¥æã§ããŸããã¬ããŒãã®ããã¹ãçã¯ãããããã³ãã©ãŒã©ã ã®Webãµã€ãã§æ¯é±ãŸãã¯ã»ãšãã©åãé »åºŠã§çºè¡ãããŸããããã¹ãã®ã¿ã€ããã¹ã«ã€ããŠPMã§ãç¥ãããã ããã