SIerã ãã©ISUCON4ã«åå ãã¦ã¿ãï¼ãã¼ã ããã¿ã:ãªã³ã©ã¤ã³äºé¸æéï¼ #isucon
åæ3人çµï¼ãã¼ã ããã¿ãï¼ã§ISUCON4åå ãã¾ããã
ã¡ã³ãã¼æ§æ
- èªå: æ®æ®µã¯iOSã¢ããªéçºã®ä»äºãå¤ããã³ã¼ã«æ å½ããªãã©ããã¼äººé
- åæA: Microsoftã«éã売ã£ãç·ãSharePoint製åã®èª¿æ´ãå¾æã¨ããåºç¤å±
- åæB: è¨è¨ãã¬ãã¥ã¼ã顧客調æ´ãæ·±å¤ã®ã³ã¼ã«ããããªãããä¸ã®ããSE
çµæã¯14,657ã§17ææç¹ã§1æ¥ç®39/89ä½ããã®ãã¨ã¹ã³ã¢ä¼¸ã³ãªãã£ãããå¤åããã¡ããä¸ã
éçºå宿ã§ISUCON3ããã£ã¦ã¿ãã¨ãã¯ã2,000ãããªãã£ãã®ã§ã©ãããã¡ã ãã¨æã£ããã©ãæå¤ã¨ããã¦ããã£ãï¼
ISUCONéå§å
8:15ã«æ¸è°·ã®ã¨ã¯ã»ã«ã·ãªã¼ã«ã«ãã§ã«éã¾ãããã¼ã以å¤ã¯çµå±Bashç¥ãããã¼ã ãã¼ã 話ãã¦çµäºããããªãªããAWSã¯ã¼ãã³å ¥åãããããã£ããã«ã¼ã ã«ãã°ã¤ã³ãããã¨ã¦ãçé¢ç®ãªã¼ãã
ååæ¦
ã¾ãã¯ãåæAãLINEã«ãã§ã®ãã¤ã¬ã«ãã£ããã¨ãééãã¦å¤ã«åºã¦ãã¾ãä¸ã«å ¥ããªããªã£ã¦1人å°ãªãç¶æ ã§ã¹ã¿ã¼ããAmazonãããç¡æã¯ã¼ãã³ããããã®ã§ã豪è¯ã«ã¤ã³ã¹ã¿ã³ã¹ã使ç¨ããã³ããã¼ã¯è¨æ¸¬ç¨ãåå人ç¨ã®ã¤ã³ã¹ã¿ã³ã¹ãç«ã¡ä¸ãã ãã³ããã¼ã¯è¨æ¸¬ç¨ã®ã¤ã³ã¹ã¿ã³ã¹ã§ãã³ããã¼ã¯èµ·åãrubyåæå®è£ ã§ã¹ã³ã¢1,200ãããã
æåã¯ä»¥ä¸ã®åæ ã§èª¿æ»ã
- DBãWebãµã¼ãã¼ãªã©ããã«ã¦ã§ã¢ãä½ã使ããã¦ãããã調æ»
- ãã³ããã¼ã¯ããããã¨ãã®vmstatã®å¤ãéè¨
- Webã¢ããªã±ã¼ã·ã§ã³ã®èª¿æ»
ãã®ä¸ã§ãã¡ã°ãã³ã¼ãæ¸ãã¦ãä»äºã«ããã¤ãã¦ãã®ã¯èªåãªã®ã§ã3ãæ å½ã3人ã触ã£ããã¨ããã®ãphpãperlãpythonã ã£ãã®ã§ã¨ããããrubyãperlãpythonã®ã¢ããªã±ã¼ã·ã§ã³ã®æ§æã調ã¹ãã
rubyã¯SinatraãPerlã¯PlackãPythonã¯Flaskã£ã¦ããWebãã¬ã¼ã ã¯ã¼ã¯ã§ã©ããä¸ã¤ã®ãã¡ã¤ã«å ã«ã«ã¼ãã£ã³ã°ã¨å¦çãæ¸ãããã¤ã ã¨ãããã¨ãã¢ããªæ¬ä½ã¯1ã¤ã®ãã¡ã¤ã«ã«ã¾ã¨ã¾ã£ã¦ããã¨ãSQLãè¬ã®ORMã¨ã使ã£ã¦ãªãã§çã®SQLã§æ¸ãã¦ããããç°¡åããã¨ãããã¨ãåãã£ããã©ããä¼¼ããããªæãã ããã©ãã使ã£ããã¨ããªããã¬ã¼ã ã¯ã¼ã¯ï½ã ãããã¨ããããä¸çªã·ã³ãã«ãªãã¡ã¤ã«æ§æã ã£ããPythonãé¸æï¼ï¼ãã®é¸æãã®ã¡ã®ã¡å¤±æã ã£ããã¨ã«æ°ã¥ãï¼
æå®éãã«ãè¨å®ãã¡ã¤ã«ãPythonã«åãæ¿ãã¦Supervisorãåèµ·åãã¦ãããã³ããã¼ã¯ã¯failã°ã£ãã ããããããã¼ã¸ã表示ãããªããªã£ã¦ãã¾ã£ããå°ã£ãæã®åèµ·åã¨ãããã¨ã§ãrebootãããã¨ããããåãåºããã®ã§ããã³ããã¼ã¯è¨æ¸¬ã Pythonã«ããã ãã§ã¹ã³ã¢ã¯1,500ãããã«ãªã£ãï¼
å¾åæ¦
æ¼éããããããã¯ã3人ã®èª¿æ»å 容ãã¨ãã¾ã¨ãã¦ä½æ¦ä¼è°ã«å ¥ãã
ã¾ããvmstatã®å 容ããã
ã¡ã¢ãªãããããã§CPUã使ãåãã¦ãªãã¨ã®ãã¨ãnginxã¯ä½¿ã£ããã¨ãªããã©ããããã¥ã¼ãã³ã°ãããã¨ãããã¨ã«ãããã¦ãnginxã®ã¢ã¯ã»ã¹ãã°ãåºãããã«è¨å®ã追å ãã¦ããªã¯ã¨ã¹ãã¨æéãéè¨ããã以ä¸ã®ãããªçµæã
GET / HTTP/1.1 1.478 GET /images/isucon-bank.png HTTP/1.1 3.041 GET /mypage HTTP/1.1 3.161 GET /report HTTP/1.1 18.786 GET /stylesheets/bootflat.min.css HTTP/1.1 3.11 GET /stylesheets/bootstrap.min.css HTTP/1.1 3.05 GET /stylesheets/isucon-bank.css HTTP/1.1 3.066 POST /login HTTP/1.1 49.171 åè¨ çµæ 84.863
ãã®çµæã¨ã½ã¼ã¹ã³ã¼ããããloginã¨reportãæ¹åã®ä½å°ããããã ãã¨ãªãã
ãã°ã¤ã³ã®å¦çã¨ã¬ãã¼ãã®å¦çã§ãusers
ãã¼ãã«ã¨login_log
ãã¼ãã«ã«selectãã¦ããã©ãã®ã¤ã³ããã¯ã¹ãè²¼ããã¦ããªãã®ã§ãusers.login
ã¨login_log.ip
ã¨login_log.user_id
ã«ã¤ã³ããã¯ã¹ãè²¼ãã
CPUã使ãåãããã¨ãããã¨ã§ãnginxã®workeræ°ã¨ããã³ããã¼ã¯ã®workloadã®æ°ã調æ´ãï¼nginxã¯åãã¦ã ã¨ãè¨ã£ã¦ãã®ã«vmstatã®ãããã¡ã¤ãªã³ã°ã ãã©ããã«æ°ã¥ããªãã¦ãããã¨æã£ãï¼my.cnfã®ãã¥ã¼ãã³ã°ãå ¥ãã¦3人ã®ãã¤ãããããã¨ããªãã¨13,793ï¼éçºå宿ã§ã¯2,000ããåºããªãã£ãããããã£ã¡ãå¬ãããªããããçµããã§ããããããï¼ã¨ãªãæèãä½ã3人çµï½
ãã®æç¹ã§14æãããã
ãã®ç¶æ ã§ããã«ãvmstatãã¨ã£ã¦ãããã¡ã¤ãªã³ã°ãã¦nginxã®keepalive_timeoutãçããã¦ãworker_processã¨ãã³ããã¼ã¯ã®workloadã調æ´ãã¦ã14,657ãæé«ç¹ã
ã¢ããªã±ã¼ã·ã§ã³å´ã¯ãreportã®ã¨ããã§ãforæã§selectãæãã¾ãã£ã¦ãã¨ããããã£ãã®ã§ãããä¿®æ£ãããã£ããã ãã©ãFlaskã¨Pythonã®ãããã°æ¹æ³ãåããããä¿®æ£ã§ããããã¹ã¯ãªããè¨èªã ããç´ãããéæ»åæ ãããã¨æãããå ¨ãåæ ããããrebootãã¦ãã£ã¨åæ ãããå§æ«ãçµå±ãä½ãã§ããã«çµäºï¼ï¼
ãã®è¾ºããã¯æè©°ã¾ãã«ãªãããããã°ã§ããªãããphpã«å¤ãã¦ã¿ããã¨ãªã£ã¦ãçã£ç½ãªç»é¢ã«ãªã£ãããéçãã¡ã¤ã«ãnginxã§ãã£ãã·ã¥ã¿ãããªãã¨ãã¦ããã©ã¼ãã³ã¹ãããããªãããªã£ã¦è©±ã«ãªã£ããã©ãããã誰ã使ã£ããã¨ãªãã£ãã®ã§åæãåãããçµå±ãã¡ãç»åãtiny PNGã§ãµã¤ãºãå°ãããã¦ã¿ããã©ãMD5ããã³ããã¼ã¯ãè¦ã¦ãããfailã«ãªãã¾ããããããã¡ãnginxã«gzipã§è¿ãããã«ãã¦ã¿ããã©ãããfailã«ãªãã¾ããã§ãã¡ã
17æãããããã¯AMIãã¡ããã¨æåºã§ãããrebootãç¹°ãè¿ãã¦benchãå®è¡ããããç¼èå±ãæ¢ãããã§æçµã¹ã³ã¢ã¯ã14,657ã§çµäºã
ã¾ã¨ã
ã©ããæä¸ä½ã ãï¼ã¨ãç½µããã£ã¦ããã®ã§ååãããã®é ä½ã¾ã§ããã¦ããã£ãï¼ã¹ãã¼ãã¿ããã§ã¢ãã¬ããªã³åºã¾ããã§ãã£ã¡ã楽ããã£ãã§ããéå¶ã®çæ§ãç²ããã¾ã§ããã æ¥å¹´ã¯ãæ¬æ¦ã«åºå ´ã§ãããããã«ãªããï¼