ISUCONã§ãã
ä»å¹´ãISUCONï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼
ISUCONããªãã§ãããã¯ä»¥ä¸ã¨ã³ããªãã覧ä¸ããã
isucon.net
ãã£ããã¨
ç§ã¯è¶³åãæ
å½ã§ãããOSã¨ãããã«ã¦ã§ã¢ã¨ãã©ã¤ãã©ãªã¨ãGCPã®æä½ãããã¸ããå
¨é¨æ
å½ã§ãã
å»å¹´ã¯ã¬ã³ã¬ã³ã³ã¼ããããã£ã¦ããã§ãããä»åã¯ãã£ããã²ã¿ãé ãã¾ããã
çç±ã¯ç°¡åã§ã3人ãã¦ãä»2人ã¯Perlãå¾æãªã®ãå ±éã§ãç§ã¯å¾æã§ãªããä»2人ããããµã¼ãã¼å¨ãï¼Linuxã®è¨å®ã¨ãããããã®ï¼ã¯å¾æã ã¨æã£ã¦ããããã§ãã
ãããã¡ã¤ã«å¨ãããã³ãã³ããããã£ããã§ãããNYTProfããªããããããããããã¦ãå·®ãè¾¼ãã ãã¯ãããããçµæ§ããã¸ãã½ãã£ãã®ã§ãã§ããªãã£ãã
ãã°ã®éè¨ã§ã¢ã¯ã»ã¹ãã¿ã¼ã³è§£æã¨ããï¼ãã¾ãå½¹ã«ãããªãã£ããã©ï¼Mysqlã®Slowlogãã¨ã£ããã¨ããã©ããã¦ãidleãä½ãâ¦å¤åããã¯ãã®ã¢ã¯ã»ã¹ãã¿ã¼ã³ãä¹ãè¶ããããªããããã¨ãããããã®ã®èª¿æ»ã¯ãã¾ããã
äºåç®æ¨
å¿è«äºé¸çªç ´ï¼ããã¦åªåï¼ãªã®ã§ããããã®ç®æ¨ãå解ãã¦ãä»åèªåã§åæã«ãããèªåã®ããã·ã§ã³ã¯ã30åã§ãµã¼ãã¼ã®è¨å®ãä»ä¸ãã¦ããã¼ã ã«å¼ã渡ãäºã§ãã
ISUCONã§ãã³ã¼ããæ¬æ ¼çã«è§¦ãå§ããã¾ã§ã®æéãã©ãã ãçãã§ãããã£ã¦æ¬å½ã«éè¦ãªã®ãå»å¹´ã§è§£ã£ã¦ããã®ã§ãããã«å ¨åãæçãããã¨ã«ãã¾ãããæçã¨ããã¤ã¤ãããäºã¯ç´ æ¯ãã§ãï¼å¾è¿°ï¼ãå½æ¥ããå½æ¥ã¾ã§ãéè¦ã
çµæçã«æ¬çªã§30åã¯ã ãªã ã£ããã§ããã©ãã©ããã¦ãç·´ç¿ã§ããªãæåã®ããã¥ã¡ã³ããèªãã§ã©ãããæé ãªã®ããã¨ãã確èªãããã¾ãããï¼ããã¦ä½æ ãã¤ã¡ã¼ã¸ãä½ãã®ã«ãæ®æ®µããæéãããã£ãï¼ãããã¯ãããããã§ããããèªè§£è½åãä¸ããç·´ç¿ã ãããã
ãã¾ã©ãã¯ã»ããã¢ããã¯ãAnsibleã§ããã°ä¸çºãããï¼ãã¨ããã®ã¯ãããã§ããã©ãä»äººã®ãµã¼ãã¼ã¯ã©ãããæ§æã«ãªã£ã¦ããèªããªãã®ã§ï¼ãã£ã¹ããªããã¼ã«ã®æé»çãªäºè§£ãç ´ã£ã¦ãäºã¨ãï¼ãç§ã¯ç§ä¼ã®ããï¼ã·ã§ã«ã¹ã¯ãªãããã³ãããªã©ï¼ãã¤ããã¾ãããæ¥å¹´ãISUCONãããªãã¿ã¬ãã¤ããã¨æãã¾ãï½ãã¨ãåç°å¢æ¯ã«ããªã³ã³ãã¤ã«ãããã¤ããªãã©ã£ããã§ããã調æ´ãããã«ãã¯æ¬å½ã«æéããããã®ã§ãå ã«ãã«ããã¦ãããæ¹ã絶対ã«è¯ãã
çµæã¨ãã¦ï¼ï¼ï¼è¨å®ãã¡ã¤ã«ãPerlãã¤ããªã®å ´æãã©ãã¨ãããããæã«ã¯ãããã¾ããã§ããããè¨å®ãçµãã£ãå¾ã¯ããã¼ã ã¡ã³ãã¼ãOSãããã«ã¦ã§ã¢ã§æ··ä¹±ãããã¨ã¯ãªãã£ãã¨ãããã¾ããPerlã®Moduleã追å ããã®ã¯æ°åã ã£ããããã
ããä¸ç¹ã ãmysqlã®sockã®ä½ç½®ã ãã¯ããã¦ããã£ã¡ãã£ããªã*1
äºåã®ç´ æ¯ãã«ã¤ãã¦
ã»ããã¢ããã¨ã¯ã
ã«ã¼ãã«ãã©ã¡ã¼ã¿ãå
¥ãæãããã
ulimitå¨ããé©åã«ãããã
ããã¾å¥½ãã§ã¯ãªãï¼ãããã¼ã ã¡ã³ãã¼ãããã¾ã詳ãããªãã§ãããï¼systemdãsupervisordã«ããããããã
ï¼ç¨®é¡ãããã®ãã¼ã¸ã§ã³ã®Perlãããããã
Mysqlã«ã¿ã¬ãããããã
å¤ãªç½ ããªããè¦ããã
ããã¦ã§ããè¶³å ´ãã¹ãããã·ã§ããã¨ã£ã¦é
å¸ãããã
ãããããã¤ã§ãã
ããããªè¨ã£ã¦ãããããããã¨ã¯ãªãããªããã§ããã©ãããããµãã¨ã§ãããã¯ç´ æ¯ãã§ãã¾ãããããä½ã®ãã£ã¹ããªãã¥ã¼ã¸ã§ã³ãã§ã¦ãããããããªãã®ã§ãæ³å®ã§ããå¤æ°ã沢山ããã
ä¸å¿ãUbuntuã ãããã¨ããã®ã¯ã©ã£ãã®ã¨ã³ããªã«ããã¾ãããããããè²ã ãªæ å ±ãç®ãããã®ããã«ãã¦ä¸èª¿ã¹ãã¦ãããããããã ãããã¨ããã®ã®äºæ³ããã¦ããããã¾ãããï¼ããããæ å ±åéããä¸åãããã人éã®å½¹å²ã ã£ãã¨æãã¾ãï¼
çµæã¨ãã¦ãUbuntuã®14 LTSããããã¯15ã®å¯è½æ§ãé«ããªãã¨æ±ºãã¦ã¯ãããã®ã®ã念ãå ¥ãã¦
ã»CentOSç³»5,6,7
ã»Ubuntuç³»14.04,14.10, 15.04
ã»Debian jessie Wheezy
ã§ãã¿ã¬ãã¤ããã°ä¸åº¦ãã°ã°ããã»ããã¢ãããã§ããããã«ç¢ºèªããã¾ããã
å®éäºæ³ã®ç¯çã§Ubuntu 15ãã§ã¦ãã¾ãããsystemdã§ããããã¤ã¯å°å³ã«é¢åãªãã§ããï¼ã°ã°ããã«ãµã¼ãã¹ã®èµ·åãåèµ·åãéæ´»æ§åãulimitãä¸ããæ¹æ³etcãç§ã«ã¯ããããªãï½ãã°ã¯ï¼ï¼ã¿ããã«ãªãï½ï¼ããã£ãã¨supervisordã«ã¢ããªï¼Perlã¨Nginxï¼ãå¼ã渡ãæçã«ã¼ããã§ãã¦ããã®ã§ãããã§ã¯ã¾ã£ããããããã«æ¸ã¿ã¾ããã
*2*3
KVSããã£ãã¨ã³ã³ãã£ã°ãæ¸ãã¦ãããã®ã§ãã¹ãã¨ããã¦ãåèµ·åæ¹æ³ããã¼ã ã«æ¸¡ãã ãã§OKã§ãã
çµæãããã«ã¦ã§ã¢å¨ãã®è³ªåããã¼ã ã¡ã¤ãããã»ã¨ãã©ã¨ãã§ããªãã£ãã®ã§ãæºè¶³ã§ãã
ææ³
åã楽ããã£ãã§ããISUCONã§ã¤ã¤ãªã®ã¯ãææ©ããããªãããããªããã¨ãããã§ããã
ç§ã¯ISUCONã®æ¥½ããã£ã¦ãç´ æ¯ãã¨ææ³æ¦ï¼ãããã¯ãæ¥å¹´ã«åãã¦ã®æ°ããªç´ æ¯ãï¼ã ã¨ããããã§ãããã
æ¼ ç¶ã¨ããã£ã¦ãã¨ãªã«ãã£ã¦ããã®ï¼ã£ã¦ãªãã¨ããããã§ããã©ãæåã®ã¹ã¿ã¼ãããã·ã¥ãä¸ç¬ã§çµãããããï¼ã¨ãããã¼ã«ãç¨æãããï¼ã¨ãããããã®ããã楽ããããã§ããã
æ¬çªã®ï¼ï¼ï¼ã¢ããªãã¥ã¼ãã³ã°ã¨ãã失æãããã客ãããããã¡ããã¡ãå±è²¬ãã¦ãå ´åã«ãã£ã¦ã¯æã¾ã§çããªããããªãã¨ããããã ãã©ãISUCONã¯ãªãã®ã§æ¥½ããã
ã¾ããäºé¸çªç ´ã§ããªãã£ãç§ããã£ã¦ããããã¡ï¼ãã¨ãããããåãã¾ããç§ã®åä¸è¶³ãè²¢ç®ä¸è¶³ãããã*4ãã¯ãäºé¸çªç ´ã¾ã§æã£ã¦è¡ããªãã£ããã¨ã¯ãã¼ã ã¡ã¤ãã«ã¯å¤§å¤ç³ã訳ãªãã
ï¼ç§ãã¡ããã£ãä¼å ´ã¯dotsã§ãå¿«é©ãªWifiã¨å¤§ããã¢ãã¿ããã¯ã¤ããã¼ããªã©ããåãããï¼
å¾æï¼ï¼ï¼
ãã£ã±ãç§ã¯PHPerãªãã ãªã
ï¼æå¾ã®2hãããã§ãç§ã¯æãããã¦ãã¾ã£ãã®ã§ãPHPã®ã³ã¼ããã¿ã¯ããã¦ããããã¡ã¤ã«ããããã°ã³ã¼ããããã¾ãã£ãããããã¨ãããæªãã¨ããã®ãè¦ãã¦ãããããã¦ãã®æ
å ±ããã¼ã ã«ã·ã§ã¢ããã®ã§ãå¤å°è²¢ç®ã§ããâ¦ã¨è¨ããã«ã¯æãé
ããããããã¾ããè¨ãã®ï¼ï¼ãã¨ããæãã«ãªã£ã¦ãã¾ã£ãã
ãã¡ã³ã¼ãã®æ¹ä¿®ã¯èªåã¯å²ã¨æ®æ®µãããã£ã¦ããåéã§ï¼ãããããã¨ï¼ç§ã®å¾æåéãããããªãã®ã«ããããã§ãã¦ãªãã£ãããã£ãã¨PHPã§ãããã¦ã³ã³ããããªããã¨ããã®ãå
±æã§ããã°ããã£ããããã¯æ¬å½ã«åçã§ãããç§ã®ææãã¨ãããã¦ãããããªãã
PHPã¯xhprofã¨ããããåªç§ã ãããããã°ããã£ã¡ããããããããã¬ãã¨éçºç¨ã®URLã追å ãã¦ã´ãªãã¨SQLå©ããããã§ããããIDEã¤ããã°é¢æ°ã®å®£è¨ã¸ã£ã³ãã¨ããã§ãããããã¯å¾æ¥ããã°ã«æ¸ãããã¨æãï¼
ãªããPHPã®åæã¹ã³ã¢ã¯900ã§ããããããPHPã§ããï¼ï¼ï¼
ããã¦ãPHPerã ããã¨çãã¦ãPerlã®ã³ã¼ããã»ã¨ãã©ãããªãã£ãã®ã大åçã§ããããã¯ãæå¾ã¯å ¨å¡ã§ã³ã¼ããæ¸ããã°ãªãã¬ã
æè¬
ãã¼ã ã¡ã¤ãã®moznionãã lestrratããæ¬å½ã«ãããã¨ããããã¾ãããå½æ¹è²¢ç®ããããã«ç³ã訳ãªãã次ãããã°ä»åãæ´»ããããã£ã¨æ´»èºã§ããããã«ãã¾ãã
ISUCONéå¶ã®çãã¾ãæ¬æ¦ã¯ãã®å¾ã§ãããã¾ã ã¾ã 大å¤ã§ãããããä»åã¯æ¬å½ã«è¯ãæãã®åé¡ãããã¨ããããã¾ããã大å¤åå¼·ã«ãªãã¾ãããä»å¾ã«æ´»ããã¦ãããã¨ãããã¾ãã
ä»ã®åå è ã®çãã¾ã«ããè²ã åºæ¿ãããã ãããã§ã«æ§ã ãªç¥è¦ãã·ã§ã¢ããã¦ãã¦å¤§å¤åå¼·ã«ãªãã¾ãããã®å¾ããã«å¢ãããã§ãããããæ¼ãããèªãã§ãç§ãããã«ããã°ã£ã¦ãããããã«ãããã¦ãã¤ãã¯ç§ããªã«ããã·ã§ã¢ã§ããããã«ãªããããªã¨æãã¾ãã
ãã¨ãä¼å ´ã®dotsæ§ãå¿«é©ãªç°å¢ãããã¨ããããã¾ããï¼
https://eventdots.jp/spaceeventdots.jp
æ¬å½ã«æãé£ããããã¾ããï¼ã¾ãæ¥å¹´ï¼ï¼ï¼ï¼ï¼ï¼ï¼
æ親ä¼æã®ä½è«
ç§ãã¨ããã§ç§ã®èº«è¿ã«PHPerãªISUCONã¡ã¤ããããªããã§ããããã¯ã
æãããªããæãããããªãã®ï¼ã
ç§ããªã«ãï¼æããªãã§ããï¼ã
æãæããã
ç§ãæããªããï¼ã
æããã²ãã
ç§ããã²ãã
ãã²ãæªããã§ããï¼
*1:æ¸ãæããåã«ãã¹ã¿ã¼ã¤ã¡ã¼ã¸ã渡ãã¦ãã¾ã£ã¦ãææ»ãããããªãã£ã
*2:ããã¥ã¢ã«ã«ãsystemdã®èª¬æãã»ã¨ãã©ãªãã£ãã®ã§ãsystemdããããããã¼ã ã«å¯¾ãã¦ã¯æå©ã ã£ãã®ã§ã¯ï¼ã¨ããã£ã
*3:ã¨ããã§systemdã¯çµå±SYSVã®è¨å®ããã£ã¦è²ã æ··å¨ãã¦ãã®ãã¤ã¤ã§ãããã¾ã£ãã
*4:Perlããã£ã¨ã¬ã³ã¬ã³ãããã°ããã£ã¨è²¢ç®ã§ããã®ã«ãããã¡ã§ãããã¹ã³ã¢ã«è²¢ç®ã§ããã«åçãã¦ãã¾ããåçä¼ã§å¼·ãæãã¾ãã