ä¸ã大è¦æ¨¡ãµã¼ãã¹ã®ã¤ã³ãã©ã®æ§åãç¥ãããã¢ããªã±ã¼ã·ã§ã³ã¨ã³ã¸ãã¢åãã«ããã¨ãã¨ã¢ããªã±ã¼ã·ã§ã³ã³ã¼ããæ¸ãã¦ããè¦ç¹ãããå人çãªä½é¨ããã¼ã¹ã«ã¯ã¦ãªã§å¤§è¦æ¨¡ãµã¼ãã¹ã®ã¤ã³ãã©ãå¦ãã éç¨ãå¦ãã å 容ã®ä¸é¨ãç´¹ä»ãã¾ãã
- Webã¢ããªã±ã¼ã·ã§ã³ã®ãã©ãã¯ããã¯ã¹
- Webã¢ããªã±ã¼ã·ã§ã³ãã¬ã¼ã ã¯ã¼ã¯ã®åããå´
- ãªãè¤æ°ã®ãµã¼ããå¿ è¦ãªã®ã
- çªç¶ã®Webãµã¼ãã¹3層æ§æ
- ãã®ä»ã®ã³ã³ãã¼ãã³ã
- Mackerelã®å ´å
- åè
- ã¾ã¨ã
Webã¢ããªã±ã¼ã·ã§ã³ã®ãã©ãã¯ããã¯ã¹
ä»å¹´ãã¯ã¦ãªã¤ã³ã¿ã¼ã³ã®ææãè¿ã¥ãã¦ããã æ¯å¹´ã§ã¯ãªããã©ãã¯ã¦ãªã¤ã³ã¿ã¼ã³ã§ã¯ãã¤ã³ãã©è¬ç¾©ãã¨ããã®ããã£ã¦ããã ä»å¹´ã¯ã¤ã³ãã©è¬ç¾©ã®è¬å¸«ã¨ãã¦ã¢ãµã¤ã³ãããã®ã§ã¡ããã©ä½ã話ããããèãã¦ããã¨ããã ã
åã¯2011å¹´ã®ã¯ã¦ãªã¤ã³ã¿ã¼ã³ã«åå ãã¦ããã ä»ã§ããWebãªãã¬ã¼ã·ã§ã³ã¨ã³ã¸ãã¢ï¼ã¤ã³ãã©ã¨ã³ã¸ãã¢ï¼ããã£ã¦ããããå½æã¯Webã¢ããªã±ã¼ã·ã§ã³ã¨ã³ã¸ãã¢åãã®ããã°ã©ã ãããªãã£ããããã¤ã³ã¿ã¼ã³ã§ã¯ä¸»ã«Webã¢ããªã±ã¼ã·ã§ã³ãæ¸ãã¦ããã ã¨ãããããã®ã¨ãã¯ãèªåãã¤ã³ãã©ãããã¨ã¯å ¨ç¶èãã¦ããªãã£ãã å½æã®ã¤ã³ãã©è¬ç¾©ã¯ãå¾ã«ååã¨ãªã id:halfrack ãããæ å½ããã¦ãããã¯ã¦ãªã®èªä½ãµã¼ããã¯ã¦ãªããã¯ãã¼ã¯ã®æ§æäºä¾ãã¯ã¦ãªã®ãããã¯ã¼ã¯ã«é¢ããå 容ã ã£ãã¨æãã ãã®é ã¯ãªãã¼ã¹ãããã·ãä½ããããããããªãç¶æ ã ã£ãã®ã§ãè¬ç¾©å 容ã®åå以ä¸ã¯ããããããªãã£ãã ãããããã¨ãã¨è¨ç®æ©ã®ã¢ã¼ããã¯ãã£ãåæ£ã·ã¹ãã (è¤æ°å°ã®ãµã¼ãã使ã£ã¦ä½ãããããããã®éãªã¤ã¡ã¼ã¸)ã«èå³ããã£ããããããããããªããã©ãªããããããããã ãªã¨ããææ³ãæã£ãã®ã¯ããè¦ãã¦ããã
ã¤ã³ã¿ã¼ã³ã®åå¾ã§Ruby on Railsã使ã£ã¦ä½ããæ¸ãã¦ããæ°ãããã ãµã¼ããµã¤ãã®Webéçºã¯ã¾ãRailsã®ãããªã¦ã§ãã¢ããªã±ã¼ã·ã§ã³ãã¬ã¼ã ã¯ã¼ã¯ã®ä½¿ãæ¹ãè¦ããã¨ããã®ãæåã®ã¹ãããã«ãªã£ã¦ããã ã¨ããããTwitterã¨é£æºããããã«ãOmniAuthã¨ãDeviseããªã«ãã使ã£ã¦ãOAuthèªè¨¼ããããã®Railsç¨ã®ãã©ã°ã¤ã³ã¿ãããªãã¤ãããããããã«åã§ä½¿ã£ã¦ã2~3æ¥ããã¦ãTwitterã§ãã°ã¤ã³ã§ããããã«ãªãã¨å¤§åã³ã ãããããé©å½ã«ãã¤ã¼ãæ å ±ããã©ãã¼ã»ãã©ãã¯ã¼æ å ±ãåå¾ãã¦ãã¡ãã£ã¨ãã¸ãã¯æ¸ããããã¦ããã¨ãã®ãã¡é£½ããã ãã¼ã¿ãã¼ã¹ã®ã¹ãã¼ãè¨è¨ãã¡ãã£ã¨æ°ã«ãããããã¯ãããã©ããªã¬ã¼ã·ã§ã³ã®æ£è¦åã¨ãæèããã«åã§è¨è¨ãããããã ãã¼ã¿ãã¼ã¹ã®ãã¼ãã«ã«ã¤ã³ããã¯ã¹ãä½æãã¦ããã°ãªããéããããã 大å¦ã®æ å ±ç§å¦ç§ã«æå±ãã¦ããããããããã«ãªã¬ã¼ã·ã§ã³ã®æ£è¦åã¯ä¸å¿å¦ãã§ããããB+treeã¤ã³ããã¯ã¹ãç´æ¥å¦ã¶æ©ä¼ã¯ãªãã£ããã©ããªãã¨ãªãé°å²æ°ã¯ãããã ã¨ã¯ãããã¯ããã¦ã®ãµã¼ããµã¤ãã®Webéçºã®é°å²æ°ã¯ãããªæããªããããªããã¨æãã
Twitterの日本人エンジニアに聞く、世界に通用するハッカーになるには - YouTube ã®ã¤ã³ã¿ãã¥ã¼ãçµæ§å¥½ãã§ãåç»ã®å ¬éå½æããä½åº¦ã観ã¦ããã ã¤ã³ã¿ãã¥ã¼ä¸ï¼12:00~13:00ãããï¼ã«ãæå¤ã«ãTwitterã®éçºç°å¢ã¯æ®éã®Railsã¨åãã ãã¨ããæèã§ã(Railsã®)ã¢ãã«ã®é¨åã¯ãããã¤ã³ãã©ããã®å ã«ãããã¨ãã話ãã§ã¦ããã 確ãã«æåã¯å¤§è¦æ¨¡ãµã¼ãã¹ã®ã¤ã³ãã©ã£ã¦ã¾ãã«ãããªéãªã¤ã¡ã¼ã¸ããã£ãã è¦ã¯O/Rãããã¼ã®ãã®å ãå®å ¨ã«ãã©ãã¯ããã¯ã¹ã ã£ãã
ä¾ãã°ã¯ã¦ãªããã¯ãã¼ã¯ã®ã·ã¹ãã ãçºãã¦ã¿ãã¨ç¸å½è¤éã§ã¯ããã 10å¹´éç¨ãã¦ããã·ã¹ãã ãªã®ã§ãæ´å²çäºæ ã«ããè² åµãèç©ãã¦ãããä»ã®ãµã¼ãã¹ã¨é£æºãã¦ãããããã¨ã©ããã¦ãè¤éã«ãªãã æ´å²çäºæ ãé¤ããããã¯ã¦ãªããã¯ãã¼ã¯ã®ã·ã¹ãã åä½ã§ã¿ãã¨ãã¦ãããããªãã«ã¯è¤éã ã¨æãã
ã¯ã¦ãªã¤ã³ã¿ã¼ã³ã§èªåãæ¸ããã³ã¼ãã¯ãä¸å¿ä»ããããã¯ã·ã§ã³ã§åãã¦ãããã©ãå®ã¯ãã¼ã¿ãã¼ã¹ãåç´åå²ããã¦ããã¨ãä½ãæèãã¦ããªãã£ãã ãªããMySQLã®ã¹ã¬ã¼ãã並ãã§ãããããããã®ã¤ã¡ã¼ã¸ã ã¤ã³ã¿ã¼ã³æéä¸ã§ã¯ã¨ã¦ãã§ã¯ãªããã©ã·ã¹ãã ã®å ¨ä½åã¯æ´ããªãã
ä¸æ¹ã§ãå人éçºã®ãµã¼ãã¹ã®æ§æã¯é常ã«åç´ã ããã¡ãããä¾å¤ã¯ãããã§ãããã¨ã¯æãã
ä»ã¯Herokuã®ãããªPaaSã使ãã®ãä¸è¬çãªã®ã§ããããããµã¼ãã¨ãããã®ãæèãããã¨ã¯å°ãªãã
å¤å°ããã°ã£ã¦ãããã¤ãããªãããããVPSã使ã£ãããããããããªãã
å¾è
ãªããLinuxãµã¼ãã«NginxãMySQLãã¤ã³ã¹ãã¼ã«ãã¦ãã¢ããªã±ã¼ã·ã§ã³ã³ã¼ããgit clone
ãrsyncãç¨ãã¦ãµã¼ãã«é
ç½®ãã¦èµ·åã³ãã³ããå©ãããããã
ããã¡ãã£ã¨ããã°ã£ã¦ãChefãAnsibleã使ã£ã¦ããããã®æé ãèªååãããã¨ã¾ã§ãããããããªãã
å人éçºã®è¦ç¹ã§ã¿ãã¨ã大è¦æ¨¡ã·ã¹ãã ã¨ããã®ã¯ã¨ã«ãããããã¨ããã¤ã¡ã¼ã¸ãããã ãã¼ã¿ãã¼ã¹ã®ä½¿ãæ¹ã¨ããã¼ã¿éãå ¨ç¶éãã ãããããã¼ããã©ã³ãµã¨ã使ã£ã¦è¤æ°å°æ§æã«ãã¦ã¦ãªãããã£ãããã ãããã¯ã¼ã¯ã®ã¬ã¤ã¤ã«ãªãã¨ã¤ã¡ã¼ã¸ãã§ããªãã ã¢ããªã±ã¼ã·ã§ã³ãã®ãã®ã¨ãããããããããããã«ã¦ã§ã¢ãçµã¿åããã¦ä½¿ã£ã¦ãããããããã¯ã¼ã¯ããããã¨ããããªãã¨ãªãæ¼ ç¶ã¨ããã¤ã¡ã¼ã¸ããã£ãã
ããããæè¿éè¦ã ã¨æããã®ã¯ããã¨ã大è¦æ¨¡ãªã¤ã³ãã©ã§ãããã¨ãã·ã¹ãã ã®ä¸å¿ã¨ãªãã®ã¯ããã¾ã§ã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã§ãããã¨ãããã¨ã ã è¶ å¤§è¦æ¨¡ãªã·ã¹ãã ã ã¨ããããããªããã©ãã¯ã¦ãªãããã®è¦æ¨¡ãªããã®ããã«æããã ç¹ã«ããã©ã¼ãã³ã¹ã®å¤§é¨åãæã£ã以ä¸ã«ã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã®ãã¸ãã¯ã使ç¨ããã·ã¹ãã ç³»ã®ã©ã¤ãã©ãªã«ä¾åããã¨æã£ã¦ããã 以éã§ã¯ãã¢ããªã±ã¼ã·ã§ã³ãµã¼ããä¸å¿ã¨ããã¤ã³ãã©ã®ä¸çãã¿ã¦ã¿ããã
Webã¢ããªã±ã¼ã·ã§ã³ãã¬ã¼ã ã¯ã¼ã¯ã®åããå´
å è¿°ããããã«ãWebã¢ããªã±ã¼ã·ã§ã³ãã¬ã¼ã ã¯ã¼ã¯ã¨O/Rãããã¼ã«ãããéçºã楽ã«ãªã£ãåé¢ããã®å ã¯ãã©ãã¯ããã¯ã¹ã¨ãã¦æ±ãããã¡ã«ãªã£ã¦ããã 極端ãªå ´åããã¬ã¼ã ã¯ã¼ã¯ããä¸ã®ã¬ã¤ã¤ããã¤ã³ãã©ãã¨ãã¦æ±ãããããã«ãªã£ã¦ããã¨æãããã¨ãããã
WAFããä¸ã®ã¬ã¤ã¤ã¼ãã¿ããªã¤ã³ãã©ã«ãªã£ã¦ãã¾ã£ã
— yuuki (@y_uuk1) 2014, 10æ 31
ãã®ãããªç¶æ³ã§ããã¤ã³ãã©ãã«éãã¦ããããã«ã¯ã©ãããããããã
åã®å ´åã¯ãã¯ã¦ãªã«ã¢ã«ãã¤ãã«ããã¨ãã«ããã§ã«ããã¸ã§ã¯ããã¨ã«æä½éã®ãã¬ã¼ã ã¯ã¼ã¯ãä½ãã¨ããæåã ã£ãã Perlã®ä¸çã«ã¯ãPlackï¼Rubyã§ããã¨ããã®Rackï¼ãURLã«ã¼ã¿ã¼ããã¼ã¿ãã¼ã¹ã¢ã¯ã»ã¹ç¨ã®å°ããªã¢ã¸ã¥ã¼ã«ãªã©ããã¬ã¼ã ã¯ã¼ã¯ãä½ãããã®é¨åãéã¾ã£ã¦ãããããèªåã§å¥½ããªé¨åãçµã¿åããã¦ãã¬ã¼ã ã¯ã¼ã¯ãä½ããã¨ã¯é£ãããªãã£ãã O/Rãããã¼ï¼ã¨ããããã¯éãã®ãã¼ã¿ãã¼ã¹ã¢ã¯ã»ã¹ã©ã¤ãã©ãªï¼ãèªä½ããããããã
Webã¢ããªã±ã¼ã·ã§ã³ãã¬ã¼ã ã¯ã¼ã¯ãä½ããã¨ããã¨ããªã¯ã¨ã¹ãã®åä¿¡ãã対å¿ããã¬ã¹ãã³ã¹ã®éä¿¡ã¾ã§ã®ã©ã¤ããµã¤ã¯ã«ãæèããããã«ãªãã ãªã¯ã¨ã¹ããåä¿¡ãã¦ããé¨åãæ¢ãã«ããã¨ãPlackã®ä¸ã§åãã¦ããWebãµã¼ãï¼Starletãªã©ï¼ã®ã³ã¼ãã«è¡ãå½ããã UNIXããã»ã¹ã¨ã½ã±ããã®ä¸çã ãã®ãããã®ä»çµã¿ãããã£ã¦ããã¨ãä¾ãã°ã¢ããªã±ã¼ã·ã§ã³ã³ã¼ãå ã§ã°ãã¼ãã«å¤æ°ã«çªã£ããã ãªãã¸ã§ã¯ãã¯ã©ããªãã®ãã¨ãã£ããã¨ããããããã«ãªãã Starletã¯Preforkã¢ãã«ã®Webãµã¼ãã§ãããå¾ç¶ã®ãªã¯ã¨ã¹ãå¦çãããããã«åãããã»ã¹ã使ãã¾ããã¦ãããããã°ãã¼ãã«å¤æ°ã¯å¾ç¶ã®ãªã¯ã¨ã¹ãå¦çä¸ã«ãåç §ããå¾ãã¨ããããããã¨ããããã ãã«ãã¹ã¬ããã¢ãã«ãªãã°ãå ¨ã¦ã®ãªã¯ã¨ã¹ãå¦çä¸ã«åæã«ã¢ã¯ã»ã¹ããå¾ãã¨ãããã¨ããããã Webãµã¼ãã®ä»çµã¿ã«ã¤ãã¦ã¯ã以åããã°ã«æ¸ããã®ã§ã詳ããã¯ãã¡ããåç §ãã¦ã»ããã
ä¸æ¹ã§ãO/Rãããã¼ãä½ããã¨ããã¨ããã¼ã¿ãã¼ã¹ã¨ã®æ¥ç¶ç®¡çã«æ°ã使ãããã«ãªãã
æ¢åã®O/Rãããã¼ã®ã³ã¼ããèªãã¨ãæ¥ç¶ãåãã¦ããªããã PING
ã§ç¢ºèªãã¦ãåæ¥ç¶ãããããªå¦çãå
¥ã£ã¦ãããããã
ã©ã®ãããªã±ã¼ã¹ã§æ¥ç¶ãåããã®ããåæ¥ç¶ããªãã¨ã©ããªãã®ãã¨ãããã¨ãæ°ã«ãªãå§ããã
Webã¢ããªã±ã¼ã·ã§ã³ã«ããããã¼ã¿ãã¼ã¹æ¥ç¶ã«ã¤ãã¦ã¯ã以ä¸ã®ã¨ã³ããªã«æ¸ãã¦ããã
ã·ã¹ãã ã®è¦æ¨¡ãå°ããã£ãããã·ã¹ãã ã®ç¨¼åçãæ°ã«ãããããªç°å¢ã§ãªããã°ã以ä¸ã®ãããªå 容ã¯ããã»ã©æ°ã«çããªãã¦ããããããããªãã ä¾ãã°ãã¼ã¿ãã¼ã¹ã®åæ¥ç¶ããããªãã¨ããã¼ã¿ãã¼ã¹å´ã§ãã§ã¤ã«ãªã¼ãããã¨ãã«ãå¤ãæ¹ã®ãã¼ã¿ãã¼ã¹ã¸ã®æ¥ç¶ãã¦ããã¤ããã«ãªã£ãã¾ã¾å¾ ã¡ç¶æ ã«ãªãããã»ã¹ããããããã ãã®ããã«æ¥ç¶ãæ®çããçç±ã¯ããã¤ãããããä¾ãã°AWSã®RDSã使ç¨ãã¦ãã㨠ã¢ã¯ã»ã¹æ°ãå°ãªããã°åé¡ãªãããã¢ã¯ã»ã¹æ°ãå¤ããã°ãã£ã¨ããéã«æ®çããã»ã¹ãWebã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã®ã¯ã¼ã«ã¼ããã»ã¹ãå æãã¦ãæ°è¦ã®ãªã¯ã¨ã¹ããåãä»ããããªããªããã¨ãããã ãããªãã¨ããã¢ããªãµã¼ããåèµ·åãããããªãã
@sonotsãããå¥ã®è¦ç¹ã§ä¼¼ããããªãã¨ãæ¸ããã¦ããã運用を楽にするためのアプリケーションコードを書くということ - sonots:blog
ã¯ã¦ãªï¼ã¨æ¥æ¬ã®Perlã³ãã¥ããã£ã®ä¸é¨ï¼ãå¿ è¦ãªåã ãèªä½ãããããªæåã ã£ããã¨ã¯èªåã«ã¨ã£ã¦å¹¸éã ã£ãã ãããRailsã ã£ããè¤éããã¦ã³ã¼ãã追ã£ã¦ä»çµã¿ãææ¡ããã®ã¯ããã¸ãã ã£ãã¨æãã
ãªãè¤æ°ã®ãµã¼ããå¿ è¦ãªã®ã
以ä¸ãã¤ã³ãã©è¦ç¹ã§ã¿ãã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã®è©±ã«ãªãã ããã¾ã§ã¯ãåºæ¬çã«åä½ã®ãµã¼ãã®è©±ã ã£ãã ä¸æ¹ã§ãä¸ã大è¦æ¨¡ãªã¤ã³ãã©ã¯åºæ¬çã«è¤æ°ã®ãµã¼ãã§æ§æãããã
Webãµã¼ãã¹ã®ãµã¼ãæ§æã¨ããã¨ä¸è¬ã«ãªãã¼ã¹ãããã·ãµã¼ããã¢ããªã±ã¼ã·ã§ã³ãµã¼ãããã¼ã¿ãã¼ã¹ãµã¼ãã®3層ã ã Webãµã¼ãã¹3層æ§æã«ã¤ãã¦ã¯ãå¾è¿°ããã¨ãã¦ããããããªãè¤æ°ã®ãµã¼ããå¿ è¦ãªã®ãã¨ãããã¨ãæ´çãããã
ãµã¼ããè¤æ°å°å¿ è¦ãªçç±ã¯ãã·ã¹ãã ã®å¯ç¨æ§ã®æ ä¿ã¨è² è·åæ£ãççµååã§ãããã¨æã£ã¦ããã ããããï¼ã¤ã ãã®çç±ã§è¤æ°å°æ§æã«ãããã¨ãããã°ãè¤åçãªçç±ã§è¤æ°å°æ§æã«ãããã¨ãããã
ã¾ããã·ã¹ãã ã®å¯ç¨æ§ã«ã¤ãã¦ããµã¼ãã¯ç©ççã«å£ãããéè² è·ããªãã¬ã¼ã·ã§ã³ãã¹ã§åæ¢ããããããã¨ãããããããã£ã¦ã1å°å£ãã¦ã大ä¸å¤«ãªããã«ã¹ã¿ã³ãã¤æ©ãç¨æãã¦ããã¦ãã¹ã¿ã³ãã¤æ©ã«å¦çãå¼ãç¶ãã¨ãããããªãã¨ãããããããåé·åã¨å¼ã¶ãå¿ ããããã®ãããªã¢ã¯ãã£ãã»ã¹ã¿ã³ãã¤æ§æãã¨ãããã§ã¯ãªãããå°ãªãã¨ãã¯ã¦ãªã§ã¯ä»£è¡¨çãªåé·åã®æ¹æ³ã ã åé·åããããã«keepalivedãHeartbeatã使ããã¨ãå¤ãã ãããã®ãã¼ã«ã¯åºæ¬çã«ã¢ã¯ãã£ãã»ã¹ã¿ã³ãã¤éã§çéç£è¦ããã¦ãã¢ã¯ãã£ãå´ã«ç°å¸¸ãããã¨å¤æããã°ã¹ã¿ã³ãã¤ãã¢ã¯ãã£ãã«ææ ¼ããã ææ ¼ããå ´åãã¢ã¯ã»ã¹å ãåãæ¿ããå¿ è¦ããããã¨ã¯ãããã¢ããªå´ã§ãã§ã¤ã«ãªã¼ããæ¤ç¥ãã¦ãå¥ã®IPã¢ãã¬ã¹ã¸åãå ãå¤ããã®ã¯ããªãé£ããã å®éã«ã¯ãVIPã¨ããä»çµã¿ãç¨ãã¦ããµã¼ãã®å®IPã¢ãã¬ã¹ã¨ã¯ã¾ãå¥ã®åé·åç¨IPã¢ãã¬ã¹ãã¢ã¯ãã£ãå´ã«ä»ãããããã¨ã«ãããã¢ããªå´ã§ã¯ä½ãããã«ãåãå ãå¤æ´ããã
次ã«ãè² è·åæ£ã«ã¤ãã¦ãLVSãHAProxyãELBã®ãããªãã¼ããã©ã³ãµãå段ã«ããã¦ãåãå½¹å²ã®ãµã¼ã群ã«å¯¾ãã¦ããªã¯ã¨ã¹ããSQLã¯ã¨ãªãæ¯ãåãããã¨ããã®ã代表çã ã ãã¼ã¿ãã¼ã¹ã®å ´åãå¾è¿°ããåç´åå²ãæ°´å¹³åå²ãç¨ãããã¨ãããã Nginxã®ãããªãªãã¼ã¹ãããã·ããã¼ããã©ã³ãµã¨ãã¦ä½¿ãããããå°ç¨ã®ãã¼ããã©ã³ãµãå°å ¥ããã®ãé¢åãªãã°ãã¡ãã使ã£ã¦ãããã ãã¼ããã©ã³ãµã«ã¯ãå è¿°ããVIPã®ãããªã¨ã³ããã¤ã³ãï¼FQDNï¼ãè¨å®ããã¦ãã¦ããããã·ãã¢ããªã±ã¼ã·ã§ã³ããã¯ãã®ã¨ã³ããã¤ã³ãã«åãã¦ã¢ã¯ã»ã¹ãããã°ãåæã«æ¯ãåããããã
æå¾ã«ãççµååã«ã¤ãã¦ããã¾ãççµååã¨ããè¨èãé©åãã©ããèªä¿¡ããªãã ä¾ãã°ãåããã¹ãã«ã¢ããªãµã¼ããµã¼ãã¨ãã¼ã¿ãã¼ã¹ãµã¼ããåå± ããããã¨ã¯ã§ããã¨ããã°ã§ããã å®éã«ã¯ãåé¡ã®åãåãã®ããããããã¢ããªãµã¼ãã¨ãã¼ã¿ãã¼ã¹ãµã¼ãã®è² è·ãåæ£ããããã¨ãã£ãç®çã§ããã¹ããã¨åãããã¨ãå¤ãã å½¹å²ã®ç°ãªããã®ã¯ä¸ç·ã«ããªãã¨ããã®ã¯ä»ã®åéã§ãéç¨ãã話ãããããªãã ãã ããå½¹å²ãç°ãªãããã¨ãã£ã¦ãå ¨é¨åããã»ããããããã§ã¯ãªããããããã«ãµã¼ãã®æ°ãå¢ãã¦ãã¾ãæãããããããåå± ããã¦ãå°ããªãã¨å¤æããã°åå± ããã¦ãããã¨æãã
çªç¶ã®Webãµã¼ãã¹3層æ§æ
Webãµã¼ãã¹ã®æ¨æºçãªãµã¼ãæ§æã¯ãªãã¼ã¹ãããã·ãµã¼ããã¢ããªã±ã¼ã·ã§ã³ãµã¼ãããã¼ã¿ãã¼ã¹ãµã¼ãã®3層ã¨ãªãã ãªã3層æ§æãªã®ãã¯èª¬æãããã¨ããã¨æå¤ã¨é£ããã ãããããã®ã ããã¨ã¹ã«ã¼ããããã¨ãå¤ããããªæ°ãããã
å³ã§ã¯çç¥ãã¦ããããå®éã«ã¯ããªãã¼ã¹ãããã·ãã¢ããªã±ã¼ã·ã§ã³ãµã¼ãããã¼ã¿ãã¼ã¹ã®åç §å°ç¨ã¹ã¬ã¼ãã®å段ã«ãã¼ããã©ã³ãµãæããã¨ãå¤ãã ã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã¨ãã¼ã¿ãã¼ã¹ãµã¼ããããã¨ããã®ã¯ç¹ã«çåã¯ãªãã æå ã®éçºç°å¢ã§ããã¢ããªã±ã¼ã·ã§ã³ã¨ãã¼ã¿ãã¼ã¹ãèµ·åãã¦éçºãã¦ããã®ã§ãããããå¥ã ã®ãµã¼ãã«åããã ãã ã ãªãã¼ã¹ãããã·ã¨ããã®ãä½ãªã®ãã主ãªé¢å¿ã«ãªãã¨æãã
ãªãã¼ã¹ãããã·
ãªãã¼ã¹ãããã·ã®èª¬æã¨ãã¦ããµã¼ãã»ã¤ã³ãã©ãæ¯ããæè¡ã®2ç« ã«ä»¥ä¸ã®ãããªè¨è¿°ãããã
ãªãã¼ã¹ãããã·ãå©ç¨ããã¨ãã¯ã©ã¤ã¢ã³ãããã®è¦æ±ãWebãµã¼ãã¸å±ãéä¸ã®å¦çã«å²ã£ã¦å ¥ã£ã¦ããã¾ããªåå¾å¦çãæ½ããã¨ãã§ããããã«ãªãã¾ãã ãããããªãã¼ã¹ãããã·å°å ¥ã®ã¡ãªããã§ããããå ·ä½çãªå©ç¹/æ©è½ã«ã¯ä»¥ä¸ãæãããã¾ãã
- HTTPãªã¯ã¨ã¹ãã®å 容ã«å¿ããã·ã¹ãã ã®åä½ã®å¶å¾¡(L7ã¹ã¤ãããæããå½¹å²ã¨ä¼¼ã¦ãã)
- ã·ã¹ãã å ¨ä½ã®ã¡ã¢ãªä½¿ç¨å¹çã®åä¸
- Webãµã¼ããå¿çãããã¼ã¿ã®ãããã¡ãªã³ã°ã®å½¹å²
- Apacheã¢ã¸ã¥ã¼ã«ãå©ç¨ããå¦çã®å¶å¾¡
ãªãã¼ã¹ãããã·ã¯ãã¾ãã¾ãªæ©è½ãæã¤ããããããæ£ãããªãã¼ã¹ãããã·ã®èª¬æã¨ããã®ã¯é£ããã NginxãApacheãªã©ã®ããç¾å ´ã§æ¡ç¨ããã¦ãããªãã¼ã¹ãããã·ã¯ããããã·ã¨ãã¦ã®æ©è½ä»¥å¤ã«ãã¼ããã©ã³ã·ã³ã°ããã£ãã·ã¥ã®ä»çµã¿ãæã¤ã è¦ã¯ã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã®å段ã«å¶å¾¡å¯è½ãã¤ã³ããå¢ããã¦ãããã©ã¼ãã³ã¹ãåä¸ãããããã·ã¹ãã å ¨ä½ã®éç¨å¹çãä¸ããããããã¨ãã§ããã¨ãã£ããã£ããããå½¹å²ãããã
ä¾ãã°ãCSSãJSãç»åãã¡ã¤ã«ã®ãããªéçãªã³ã³ãã³ãããªãã¼ã¹ãããã·ã§é ä¿¡ããã¦ãã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã®è² è·ãæ¸ããããããã®ã³ã³ãã³ãã®ã¬ã¹ãã³ã¹ã¿ã¤ã ãå°ããã§ããã ã¾ãã¯ãHTTPãããã®User-AgentãIPã¢ãã¬ã¹ãã¿ã¦ãè¿·æè¡çºãè¡ãã¢ã¯ã»ã¹å ã«å¯¾ãã¦ãªãã¼ã¹ãããã·ã§é®æãã¦ãã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã¸ã¢ã¯ã»ã¹ãããªããã¨ãã§ããã ãããã¯ãã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã®å段ã®ãã¼ããã©ã³ãµã¨ãã¦ä½¿ç¨ã§ããã ãããã¯ãæ¤ç´¢ã¯ãã¼ã©ç¨ã®ã¢ã¯ã»ã¹ãå¦çãããããã®å°ç¨ã®ã¢ããªã±ã¼ã·ã§ã³ãµã¼ã群ãç¨æãã¦ããªãã¼ã¹ãããã·ãHTTPãããã®User-Agentãã¿ã¦ã¯ãã¼ã©ãã©ãããå¤å®ãã¦ãã¯ãã¼ã©ç¨ãã¦ã¼ã¶ç¨ãã©ã¡ããã®ã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã¸æ¯ãåããã ããã¯ãæ¤ç´¢ã¯ãã¼ã©ã®ã¢ã¯ã»ã¹ãå¢ãã¦ãã¦ãã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã®preforkãããã¯ã¼ã«ã¼ããã»ã¹ãå æãã¦ãã¦ã¼ã¶ã®ãªã¯ã¨ã¹ããåãä»ããããªãã¨ãã£ãåé¡ã«å¯¾ãã対çã ã
ãªãã¼ã¹ãããã·ã®å°å ¥ã¯å¿ é ã¨ããããã§ã¯ãªãã ã·ã¹ãã ãããåç´ã§ããã©ã¼ãã³ã¹ããµã¼ãè² è·ã«å°ã£ã¦ããªããªããã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã®å段ã«ELBã®ãããªãã¼ããã©ã³ãµãç½®ãã¦ãããã¨ããã¨ãã«ã¢ããªã±ã¼ã·ã§ã³ãµã¼ããå¢ãããããã«ãã¦ããã ãã§ååã ããã ãããã¯ããªãã¼ã¹ãããã·ã¯ã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã«æ¯ã¹ã¦ã¡ã¢ãªä½¿ç¨éãæ§ããã§åä½ãé«éãªãããã·ã¹ãã ã®è¦æ¨¡ãå°ãããã¡ã¯ã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã¨åããµã¼ãä¸ã«é ç½®ãããã¨ãããã
ã¢ããªã±ã¼ã·ã§ã³
ã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã¯Webãµã¼ãä¸ã§ã¢ããªã±ã¼ã·ã§ã³ãã¸ãã¯ãå®è¡ããã ãã¼ã¿ãã¼ã¹ã«ã¢ã¯ã»ã¹ããããmemcached/Redisã®ãããªKVS/NoSQLãµã¼ãã«ã¢ã¯ã»ã¹ãããã¨ãããã 詳ãã㯠2015年Webサーバアーキテクチャ序論 - ゆううきブログ ã«æ¸ããã
æã¯Webãµã¼ãã¨ãã¦Apacheãç¨ãããã¨ããã£ãããæè¿ã§ã¯ã¢ããªã±ã¼ã·ã§ã³ãã¸ãã¯ãæ¸ãè¨èªã¨åãè¨èªã§æ¸ãããWebãµã¼ããç¨ãããã¨ãå¤ãã Perlã®å ´åã¯ãStarletãStarmanãMonocerosãRubyã®å ´åã¯ãUnicornãThinãPassengerãªã©ã ããã ãããã®Webãµã¼ãã¯å段ã«ãªãã¼ã¹ãããã·ãç½®ããã¦ããåæã§å®è£ ããã¦ãããã¨ãããã Webãµã¼ãã¯é常ã°ãã¼ãã«ã«å ¬éããã¦ã第ä¸è ã§ããã¦ã¼ã¶ã®ã¢ã¯ã»ã¹ãç´æ¥åãããã®ã ã å½ç¶ãããããªãã©ã¼ãããã®ãªã¯ã¨ã¹ããããããããã¨ãããããããã¾ãã¾ãªã¨ã©ã¼å¦çãå®è£ ãã¦ãããªããã°ãªããªãã ãããã£ã¦ããªãã¼ã¹ãããã·ãç¨ããã¨ãNginxãApacheã®ãããªå®ç¸¾ã®ããWebãµã¼ããã¦ã¼ã¶ã«å ¬éããã¢ããªã±ã¼ã·ã§ã³ãã¸ãã¯ãå®è¡ããWebãµã¼ãã¯å é¨ã«é ãã¨ããå½¢ã«ãªãã ã¦ã¼ã¶ã®HTTPãªã¯ã¨ã¹ããç´æ¥åããªããã°ããããããªãã¼ã¹ãããã·ã§ã¯ãªãELBã®ãããªHTTPã¬ãã«(L7)ã®ãã¼ããã©ã³ãµã使ç¨ããã¨ãELBãã¦ã¼ã¶ã®ãªã¯ã¨ã¹ãããã¼ã¹ãã¦ãããã
ãã¼ã¿ãã¼ã¹
ãã¼ã¿ãã¼ã¹ã¨ãã¦ãããã§ã¯MySQLãé¸æããã¨ããã MySQLã¯åºæ¬çã«ãã¹ã¿1å°ãã¹ã¿ã³ãã¤æ©ãããã¦2å°ã§éç¨ãããã¨ãå¤ãã ããã©ã¼ãã³ã¹ãè½ã¡ã¦ãããããã£ã¹ã¯ã足ããªããªã£ã¦ãããããã¹ã¿ã®ãµã¼ããã¹ã±ã¼ã«ã¢ããããã åºæ¬çã«ãé »ç¹ã«åç §ããããã¼ãã«ã®ãã¼ã¿åãå ¨é¨ã¡ã¢ãªã«è¼ã£ã¦ãã¦ããã¼ãã«ã«é©åã«ã¤ã³ããã¯ã¹ãã¯ããã¦ããã°1å°ã§ããªãã®è¦æ¨¡ã¾ã§æããã
ãã¹ã¿ã®ã¹ã±ã¼ã«ã¢ããã«éçãããããè² è·åæ£ã®ããã«åç §å°ç¨ã®ã¹ã¬ã¼ããç¨æããã
MySQLãªã©ã®ãã¹ã¿ã»ã¹ã¬ã¼ãåã®ãã¼ã¿ãã¼ã¹ã«ãããè² è·åæ£ã¨ããã¨ãåç §å°ç¨ã®ã¹ã¬ã¼ãã並ã¹ãã¨ããã®ã¯ããç¥ããã¦ããã åºæ¬çã«ãã¹ã¿ã«æ´æ°ã¯ã¨ãªãæãã¦ãã¬ããªã±ã¼ã·ã§ã³ã¨ããä»çµã¿ã§ãã¹ã¬ã¼ãã«æ´æ°å 容ãä¼æ¬ãããã åç §å°ç¨ã®ã¹ã¬ã¼ãã«å¯¾ãã¦ãå段ã«ãã¼ããã©ã³ãµãé ç½®ããã¢ããªã±ã¼ã·ã§ã³ãµã¼ãããã¯ãã¼ããã©ã³ãµçµç±ã§ã¹ã¬ã¼ãã«ã¯ã¨ãªãæããã
åç
§ã¯ã¨ãªãåç
§å°ç¨ã®ã¹ã¬ã¼ãã«æããã«ã¯ã©ããããã
ããã¯åã«SELECT
ã§å§ã¾ãã¯ã¨ãªãåç
§å°ç¨ã¹ã¬ã¼ãã«æããã°ããã¨ãã話ã§ã¯ãªãã
ã¬ããªã±ã¼ã·ã§ã³ã¯åºæ¬çã«ãã¹ã¿ã»ã¹ã¬ã¼ãéã®ãã¼ã¿æ´æ°ã¿ã¤ãã³ã°ã«é 延ãããã ã¤ã¾ããã¢ããªã±ã¼ã·ã§ã³ãµã¼ãããã¿ã¦ãã¹ã¿ã¸ã®æ´æ°ãæåãã¦å¦çãæ»ã£ã¦ãã¦ããã¹ã¬ã¼ãã§ã¯ã¾ã æ´æ°å 容ãåæ ãã¦ããããä¸å®ã§ããã¨ãããã¨ã ã MySQLã®ã¬ããªã±ã¼ã·ã§ã³é 延ã«ã¤ãã¦ã¯ @nippondanji ããã®è³æãåèã«ãªãã 漢(オトコ)のコンピュータ道: MySQLにおけるレプリケーション遅延の傾向と対策
ã¬ããªã±ã¼ã·ã§ã³é 延ãã¢ããªã±ã¼ã·ã§ã³ã«ã¨ã£ã¦åé¡ã«ãªãã±ã¼ã¹ãããã ä¾ãã°ãã¹ã¿ã«æ´æ°ããå 容ãã¢ããªã±ã¼ã·ã§ã³ããããã«åç §ãããã¨ããã¨ãåç §ã¯ã¨ãªãã¹ã¬ã¼ãã«æãããã¦ãã¹ã¬ã¼ãã«ã¯ã¾ã æ´æ°å 容ãä¼æ¬ãã¦ããããæå³ããªããã¼ã¿ãåå¾ãããã¨ã«ãªããããããªãã ãããã£ã¦ãã¢ããªã±ã¼ã·ã§ã³å´ã§ã¬ããªã±ã¼ã·ã§ã³é 延ãèæ ®ãã¦ãã¹ã¿ã«åç §ã¯ã¨ãªãæããªããã°ãªããªããã¨ãããã ãã®ããããã¹ã¿ã«ã¯ã¨ãªãåããã®ããã¹ã¬ã¼ãã«ã¯ã¨ãªãåããã®ããé½åº¦é¸æã§ããããã«ããããã«ããã¹ã¿ç¨ã®DBã®ã¤ã³ã¹ã¿ã³ã¹ã¨ã¹ã¬ã¼ãç¨ã®DBã®ã¤ã³ã¹ã¿ã³ã¹ãç¨æãããããã ãã®ãããªåé¡ãããããããªãã¹ãåç §å°ç¨ã¹ã¬ã¼ãã®å°å ¥ã¯é¿ãã¦ããã¹ã¿ãã¹ã±ã¼ã«ã¢ããããã®ã楽ã ã
MySQLï¼ã«éããªãï¼ã®ãµã¼ãæ§æã«ã¤ãã¦ãpixivã® @harukasan ãããé常ã«ããããããè³æãæ¸ããã¦ããã http://blog.harukasan.jp/entry/2014/09/11/181006
åç §ç¨ã®ã¹ã¬ã¼ãã«ããè² è·åæ£ã¯å½ç¶ã®ãã¨ãªããåç §ã¯ã¨ãªã®ã¿ãã¹ã±ã¼ã«ãããã æ¸ãè¾¼ã¿ç³»ã®ã¯ã¨ãªãè² è·åæ£ããããã°ã©ãããã®ããæ°´å¹³åå²ï¼ã·ã£ã¼ãã£ã³ã°ï¼ãåç´åå²ãããããã ãããã®ãããã«ã¤ãã¦ããä¸è¨ã®è³æã«ããããããæ¸ããã¦ããã
ä½è«ã ãã2~3å¹´ãããåã«ã¯ã¦ãªã®é¢æ¥ãåããã¨ãã«ãã¨ããã·ã¹ãã ããã®å ´ã§è¨è¨ãã¦è°è«ãã¦ããã¨è¨ãããã ãªã¢ã«ã¿ã¤ã éç¥ç³»ã®ã·ã¹ãã ã ã£ãã¨æãã ãªã¢ã«ã¿ã¤ã ç³»ãªã®ã§ãæ¸ãè¾¼ã¿ç³»ã®ã¯ã¨ãªãå¤ããã¨ãäºæ³ã§ããã ãã¼ã¿ãã¼ã¹ã®æ¸ãè¾¼ã¿ã§è©°ã¾ã£ãæã©ãããï¼ã¨ããåãã«ãã¾ãçããããªãã£ããã¨ãè¦ãã¦ããã ã·ã£ã¼ãã£ã³ã°ã£ã¦ãªãã ã£ããæ°´å¹³åå²ãåç´åå²ãã¡ããã¨ç解ãã¦ããªãã£ãã
ã¡ãªã¿ã«ãRedisã®ãããªNoSQLã使ãã®ãæ£è§£ã¨è¨ããããããªæ°ãããã 確ãã«ãã¨ããæãã ã£ãã
ãã®ä»ã®ã³ã³ãã¼ãã³ã
ä¸è¨ã®3層æ§æ以å¤ã«ããç¨ããããã³ã³ãã¼ãã³ããç´¹ä»ããã
ãã£ãã·ã¥ã¯éº»è¬
ããã©ã¼ãã³ã¹å¯¾çã®å ¸åã®ï¼ã¤ã¨ãã¦ããã£ãã·ã¥ãããã ãã®å ´åããã£ãã·ã³ã°ã¨ãã£ãã»ããæ£ããæ°ããããããã£ãã·ã¥ã¨å¼ã¶ãã¨ã«ããã
ãã£ãã·ã¥ã¯æ§ã ãªã¬ã¤ã¤ã¼ã§ä½¿ããã¦ããé«éåã®ããã®æè¡ã ã ãã£ãã·ã¥ã¨ããä»çµã¿èªä½ã¯æ示çã«ä½¿ç¨ããªãã¦ãæé»çã«ä½¿ãã¦ããããããã¨ãå¤ãã CPUã®ãã£ãã·ã¥ã¡ã¢ãªï¼L1,L2,L3ãã£ãã·ã¥ãªã©ï¼ããOSã®ãã¼ã¸ãã£ãã·ã¥ãMySQL InnoDBã®ãããã¡ãã¼ã«ãªã©ãããã«ãããã ä¸æ¹ãWebãµã¼ãã¹ã§æ示çã«ä½¿ç¨ãããã£ãã·ã¥ã®ä»çµã¿ã¯ãmemcachedã®ãããªåæ£ãã£ãã·ã¥ãµã¼ãã使ã£ãããVarnish/Squidã®ãããªãã£ãã·ã¥æ©è½ããã£ããªãã¼ã¹ãããã·ã使ããã¨ãå¤ãã ããã ç»åãªã©éçãªã³ã³ãã³ãã¯ãCDNã§é ä¿¡ãããããã ãã¡ãããã¢ããªã±ã¼ã·ã§ã³ã®ããã»ã¹å ã§ãã£ãã·ã¥ãããã¨ããããçæãããªãã¸ã§ã¯ãã®ä½¿ãåããªããã¯ãããã£ã¦ãã¨æãã
memcachedã¨Varnish/Squidãã©ã®ããã«ä½¿ãåããã®ãã å¾è ã¯ã¢ããªã±ã¼ã·ã§ã³ãµã¼ããçæãããã¼ã¸ã丸ãã¨ãã£ãã·ã¥ããã®ã«åãã¦ããã ã¯ã¦ãªããã¯ãã¼ã¯ã®ãããã¨ã³ããªã®ãããªå¤ãã®ã¦ã¼ã¶ãåãå 容ãã¿ããããªãµã¼ãã¹ã«é©ãã¦ããã
ä¸æ¹ã§ãæ¨ä»ã®Webãµã¼ãã¹ã¯ã¦ã¼ã¶ã«ãããã¦åçã«ã³ã³ãã³ããçæãããã¨ãå¤ããããä»ã®ã¦ã¼ã¶ãçæããã³ã³ãã³ãããã£ãã·ã¥ãã«ããã¨ããåé¡ãããã ãã®å ´åãmemcachedã®ãããªãã£ãã·ã¥ãµã¼ãã«ç²åº¦ã®å°ãããã¼ã¿ããã£ãã·ã¥ãã¦ããã
ãã£ãã·ã¥ã¯éº»è¬ã¨ããåè¨ãããã ãã£ãã·ã¥ã¯åããã¼ã¿ãè¤æ°ç®æã«æ ¼ç´ãããã¨ã«ãªããããåç®æã§ãããããã¼ã¿ã®æ´åæ§ãã¨ãã¦ããããæèããå¿ è¦ãããã ãªãªã¸ã«ã®ãã¼ã¿ãå¤æ´ããå ´åã«ããªãããã®æ¹æ³ã§ãã£ãã·ã¥ãã¼ã¿ãæ´æ°ããªããã°ãªããªãã
ãµã¼ãã¹ã®æ§è³ªãå©ç¨ãã¦ãå ´åã«ãã£ã¦ã¯ããªãªã¸ã«ã®ãã¼ã¿ã®æ´æ°ã«ãããã¦ããã£ãã·ã¥ãã¼ã¿ãé次æ´æ°ããå¿ è¦ããªããã¨ãããã ãã®å ´åããã£ãã·ã¥ãã¼ã¿ã«ãã£ãã·ã¥ãã¦ããæéã決ãã¦ããã¨ãã£ããã¨ãããã æéããããã¨ãã«ä¸æã«ãªãªã¸ã³ã¸ã¢ã¯ã»ã¹ã殺å°ããã¨ãã£ãåé¡ï¼Thundering Herdåé¡ï¼ããªããã©ãããæèããã
Facebookã§ã¯ãæ°åå°ã®memcachedãµã¼ããéç¨ãã¦ãããããããã®æ§åãè«æã¨ãã¦å ¬éãã¦ããã ã·ã¹ãã ã®è¦æ¨¡ãå¢ããã«ã¤ãã¦ã段éçã«ãã¾ããªå·¥å¤«ããã¦ããã Facebookの数千台規模のmemcached運用について - ゆううきブログ
ãã£ãã·ã¥ã«ã¤ãã¦èå³æ·±ããã¤ã¼ãããã£ãã®ã§è¨åãã¦ããã
OSã®ãããªä½ã¬ã¤ã¤ã§ããã£ãã·ã³ã°ã«ããI/Oã¢ã¯ã»ã¹ã軽æ¸ããå¦çãããã®ãªããDBã®ãã£ãã·ã¥æ©æ§ããmemcacheãã¢ããªå´ã®ãã£ãã·ã³ã°éã¯ä¸ä½ä½ã®æå³ãæã¤ã¨ããã®ã â¦â¦
— ãã (@sairoutine) 2014, 12æ 24
ãã£ãã·ã¥ã«ããé«éåãããã®ã¯I/Oã¢ã¯ã»ã¹ã ãã§ã¯ãªãã¨ããã®ã解çã ã¨æãã å段ã§ãã£ãã·ã¥ããã°ããã»ã©ãå¾ç¶ã®ãµã¼ãã¸ãªã¯ã¨ã¹ããã¯ã¨ãªãéä¿¡ãã¦åä¿¡ããã¾ã§ã®ãããã¯ã¼ã¯ã¬ã¤ãã³ã·ãCPUå¦çãã¹ãããã§ããã ãã¼ã¿ãã¼ã¹ã«æ ¼ç´ããã¦ãããã¼ã¿æ§é ã§ã¯ãã©ããã¦ãã¢ããªã±ã¼ã·ã§ã³ã«å¿ è¦ãªãã¼ã¿ãåãåºãã¾ã§ã«æéãããããããã¢ããªã±ã¼ã·ã§ã³ã«ã¨ã£ã¦ä½¿ãããããã¼ã¿æ§é ã§memcachedã«æ ¼ç´ãã¦ããã¨ããèãæ¹ãããã
é£ã³éå ·ã¨ãã¦ã®KVS/NoSQL
å ã»ã©ãæ´æ°ç³»ã¯ã¨ãªã®å¤ãã·ã¹ãã ã§Redisãç¨ããã¨ãã話ãããã Redisã¯memcachedã¨ç°ãªããåºæ¬ã¯ãªã³ã¡ã¢ãªãã¼ã¿ãã¼ã¹ã ãããã£ã¹ã¯ã«ãã¼ã¿ãä¿åãããã¨ãã§ãããããæ°¸ç¶ã¹ãã¬ã¼ã¸ã¨ãã¦ä½¿ç¨ã§ããã Redisã®æ´æ°æ§è½ã¯æ°¸ç¶åã®ã¢ã¼ãã«ãã大ããå¤ããããé次æ¸ãè¾¼ã¿ã¢ã¼ãã§ãªããã°åºæ¬ã¯ãªã³ã¡ã¢ãªãªã®ã§é«éã ã MySQLã®ãããªRDBMSã¯åºæ¬çã«ãã£ã¹ã¯ã¹ãã¬ã¼ã¸ã§ããããã¼ã¿ã®æ¸ãè¾¼ã¿ã«å ãã¦ããã©ã³ã¶ã¯ã·ã§ã³ãã°ãæ¸ãè¾¼ãã³ã¹ããããã ãã®ä»£ããããã¼ã¿ãã¼ã¹ãã¯ã©ãã·ã¥ããã¨ãã®ãã¼ã¿ãã¹ãã®ãªã¹ã¯ãä½ããªã©ã®ãã¹ãã¬ã¼ã¸ã¨ãã¦ã®å®å¿æãããã
ãã®ããã«è² è·åæ¸ãããã©ã¼ãã³ã¹åä¸ã®ããã«ãRDBMSã«åãã¦ããªãæ©è½ãKVSãNoSQLã¨å¼ã°ãããã¼ã¿ãã¼ã¹ããã£ãã·ã¥ãµã¼ãã«è©ä»£ããããããã¨ãããã
ä¾ãã°æç³»åãã¼ã¿ãã¼ã¹ãããã§ãããæç³»åãã¼ã¿ãã¼ã¹ãé常ã«æ¸ãè¾¼ã¿ãå¤ãã Mackerelã§ä½¿ã£ã¦ããæç³»åãã¼ã¿ãã¼ã¹ã«ã¤ãã¦ã¯ä¸è¨ã®ã¨ã³ããªã«æ¸ããã
éåæå¦ç
éåæã¨ããè¨èã¯æ§ã ãªæèã§èªããããã¨ãå¤ãã ããã§ã®éåæå¦çã¯ãã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã®å¦çã®ãã¡ãã¡ã¼ã«ã®éä¿¡ãTwitterã¸ã®æ稿ãªã©å¤é¨ã®ã·ã¹ãã ã«ä¾åãã¦ãããã®ãå®è¡æéãé·ããã®ãåé¢ãã¦ããã¨ã§å®è¡ããã¨ãããã®ã ã å¤é¨ã®ã·ã¹ãã ã«ä¾åãã¦ããã¨ãå¤é¨ã®ã·ã¹ãã ã®é害ã«å¼ãã¥ããã¦ãã·ã¹ãã ãåæ¢ãããã¨ãããã éè¨ç³»ã®å¦çã§ã©ããã¦ãå®è¡æéãé·ããã®ã¯ã¦ã¼ã¶ã«åæçã«ã³ã³ãã³ããè¿å´ãããã¨ã諦ãã¦ãéããã¦åæ ããããã¨ã§è§£æ±ºãããããã ã¡ã¼ã«ã®éä¿¡ãªã©ãã¦ã¼ã¶ã«ã¨ãã«ã³ã³ãã³ããè¿å´ãããã®ããªãå¦çã¯ãéåæåããããã
éåæå¦çã®å®ç¾æ¹æ³ã¯ãã¾ãã¾ã ããã¯ã¦ãªã§ã¯åºæ¬çã«MySQLãã¹ãã¬ã¼ã¸ã¨ããã¸ã§ããã¥ã¼ã使ç¨ãã¦ããã ã¸ã§ããã¥ã¼ã®ä»çµã¿ã®æ¦è¦ã¯ããã»ã©é£ãããªãã éåæåãããå¦çãã¸ã§ãã¨ãã¦ãã¸ã§ãã表ç¾ããã¯ã©ã¹ã®ç¹å®åã®ã¡ã½ããã¨ãã¦å®è£ ãã¦ãããã¦ã¼ã¶ã®ãªã¯ã¨ã¹ãå¦çä¸ã«ãã¸ã§ããã¥ã¼ç¨ã®ãã¼ã¿ãã¼ã¹ã«è©²å½ã¯ã©ã¹åã¨ã¡ã½ãããã©ã¡ã¼ã¿ãçªã£è¾¼ãã§ããã ããã¨ã¯å¥ã«ã¯ã¼ã«ã¼ã¨å¼ã°ããã¸ã§ããå®è¡ããããã®ããã»ã¹ãåãã¦ãã¦ãã¸ã§ããã¥ã¼ç¨ã®ãã¼ã¿ãã¼ã¹ã«æ°è¦ã®ã¸ã§ãããªããã©ãããå®æçã«ãã¼ãªã³ã°ãã¦ãã§ãã¯ãã¦ãããæ°è¦ã®ã¸ã§ããããã°ãã¸ã§ãã¬ã³ã¼ãããã¯ã©ã¹ããã©ã¡ã¼ã¿ãåå¾ãã¦ã該å½ã¸ã§ãã®ãã¸ãã¯ãå®è¡ããã
ä¾ãã°ã¦ã¼ã¶ç»é²ã¡ã¼ã«ã®éä¿¡ã¯å¤å°é ãã¦å®è¡ãã¦ãããããå®è¡ãããªããã¨ãããã¨å°ããããMySQLã®ãããªæ°¸ç¶ã¹ãã¬ã¼ã¸ã«ã¸ã§ããç»é²ããã®ãããã ã¸ã§ãã®ç¨®é¡ã«ãã£ã¦ã¯ããã¹ããã¦ããããã¨ã«ããæ°ãå¤ããã¨ãããããããªã³ã¡ã¢ãªã®ã¸ã§ããã¥ã¼ã使ããã¨ãããã
ãµã¼ãæ§æã¨ãã¦ã¯ãã¸ã§ããã¥ã¼ç¨ãã¼ã¿ãã¼ã¹ã¨ã¯ã¼ã«ã¼ç¨ã®ãµã¼ããå¿ è¦ã«ãªãã
æ°ããã¸ã§ããã¥ã¼ã·ã¹ãã ã®è¨è¨ã«ã¤ãã¦ã以åã¨ã³ããªã«æ¸ãããç¾è¡ã·ã¹ãã ã§å°ã£ã¦ãããã¨ãã¾ã¨ãã¦ããã
ãããå¦ç
å®æçã«æ å ±ãæ´æ°ãããå ´åãããããµã¼ããç¨æãã¦ãããããµã¼ãä¸ã®cronã§ãã¸ãã¯ãå®è¡ããã æ¯æã¦ã¼ã¶ã«ã¡ã¼ã«ãé ä¿¡ãããã¨ãããããªç¨éã«ç¨ããã ããããµã¼ãä¸ã§ã¯ãã¹ã¯ãªãããåä½ãã¦ãã¸ãã¯ãå®è¡ããã
ãããå¦çã¯ããã¼ã¿ãã¼ã¹ã®å 容ãéè¨ãããããªéãã¯ã¨ãªãæãããããã¨ãå¤ãããã¹ã¿DBã®è² è·ãä¸ãã£ã¦ãã¾ããã¨ãããã ãã¹ã¿DBã®è² è·ã«ãããã·ã¹ãã ãä¸å®å®ã«ãªããã¨ãé²ãããããããå¦çå°ç¨ã®ã¹ã¬ã¼ããç¨æãããã¨ãããã
Mackerelã®å ´å
3層æ§æã«å ãã¦ããã£ãã·ã¥ãµã¼ããKVS/NoSQLãã¸ã§ããã¥ã¼ããããå¦çã¨ãã£ããªãã·ã§ã³çãªãµã¼ãæ§æã«ã¤ãã¦èª¬æããã
å®éã®ã·ã¹ãã ã¯ã©ããªã£ã¦ãããã®åèã®ããã«Mackerelã®ãµã¼ãæ§æã®å³ã ããç¨æããã åºæ¬çãªã·ã¹ãã ã®æ¦è¦ã«ã¤ãã¦ã¯ãMackerelで採用している技術一覧とその紹介 - Hatena Developer Blog ã«æ¸ããã¦ããã
ããå°ã詳細ãªãµã¼ãæ§æãä¸å³ã«ç¤ºãããããªãç°¡ç¥åããå³ã«ãªã£ã¦ãããç¹ã«Graphiteã®æ§æã«ã¤ãã¦ã¯ã»ã¼å ¨ã¦çç¥ãã¦ãããããMackerelを支える時系列データベース技術 - ゆううきブログ ã®è¨äºãåç §ãã¦ã»ããã
Mackerelã¯ã¾ã æ°ãããµã¼ãã¹ã§æ´å²çäºæ ãå°ãªãã·ã¹ãã ã ã ãããããµã¼ã管çãã¼ã«ã¨ãããã¨ããããã¢ããªã±ã¼ã·ã§ã³ãã¸ãã¯ãè¤éãªãããããã«ãããã¦ãããªãã«è¤éãªã·ã¹ãã ã«ãªã£ã¦ããã
ã¨ã¯ãããåºæ¬ã¯proxy-app-dbã®3層æ§æã«ãªã£ã¦ãããã¨ã«æ³¨ç®ãã¦ã»ããã è¤éã ããã¨ãã£ã¦ã4層ã«ãªã£ã¦ãããã5層ã«ãªã£ã¦ããã縦ã«å±¤ãå¢ãããã¨ã¯ãã¾ããªãã ã¢ããªã±ã¼ã·ã§ã³ãµã¼ããããã¾ã§ä¸å¿ã§ã3種é¡ã®ãã¼ã¿ãã¼ã¹ã使ãåãã¦ããã ãã¨ãè¨ããã
åè
- Reverse Proxy がなぜ必要か - naoyaのはてなダイアリー
- ペパボ新卒エンジニア研修2015・Webオペレーション研修が始まっています | blog: takahiro okumura
- ソーシャルゲームスケールアウトの歴史
ã¾ã¨ã
ã¯ã¦ãªã®å¤§è¦æ¨¡ãªã¤ã³ãã©ã«ãããã¢ããªã±ã¼ã·ã§ã³ã®æ§åã¨ãµã¼ãæ§æã®åºæ¬ãç´¹ä»ãã¾ããã
ã¯ã¦ãªã®ã¤ã³ãã©ã§å¦ãã ãã¨ãå¦ã³ãããã¨ã¯ã¾ã ã¾ã ããããããã¾ãã ãµã¼ãããã©ã¼ãã³ã¹ãä»®æ³åãã¢ãã¿ãªã³ã°ããããã¯ã¼ã¯ããªã³ãã¬ã¨ã¯ã©ã¦ãããµã¼ããããã¸ã§ãã³ã°...etcã æ¯ãè¿ã£ã¦ã¿ãã¨ã4å¹´åã¯ããã®ããããªãã£ãWebã·ã¹ãã ã®ã¤ã³ãã©ãã¡ããã¨ç解ã§ãã¦ãããã¯å¥ã¨ãã¦ä»ã§ã¯äººã«èª¬æãããããããã«ãªã£ããã ã¨å®æãã¾ãã
@hfm ãã¨ãã£ãããããè¨ã£ã¦ãã(å³å¯ã«ã¯ãã¦ã§ããªãã¬ã¼ã·ã§ã³ãã¨ããæ¬ã«æ¸ããã¦ãã)ã®ããã¦ã§ããªãã¬ã¼ã·ã§ã³ã¯ç§å¦ã§ã¯ãªãæè¸ã§ããã¨ãããã¨ã§ãã æè¸ãã¤ã¾ãæã®ä¸çãªã®ã§ãããããã¦ã³ã«çµè«ãå°ãããã¨ããããã¯ãç¾å ´ã®çµé¨ããããã ã¢ããã«è§£ãæ±ããã¡ã§ãã ãããã£ã¦ã大è¦æ¨¡ãµã¼ãã¹ã®ã¤ã³ãã©ã®æ§åã¨ããã®ã¯ä¸ã®äººã«ããããããªããã¨ãå¤ãã§ãããã ã¤ã³ã¿ã¼ã³è¬ç¾©ãã¡ããã©ããæ©ä¼ã ã£ãã®ã§ãå®éã«èªåãã¤ã³ãã©ããããã¨æã£ã¦ããã¨ãã®æ°æã¡ãæãåºãã¦ããããå°ã¨ãã¦ãªãã¹ãã¢ããªã±ã¼ã·ã§ã³ã¨ã³ã¸ãã¢è¦ç¹ããä¸ã«éãã¦ããã¨ããæ°åã§æ¸ãã¦ã¿ã¾ããã
æ¬é¡ã¨ã¯é¢ä¿ãªãã§ãããããããã°ãæ°ã¥ãã°æè¡ããã°ã¨ã³ããªãæ¸ãã¦ã¯ã¦ãªããã¯ãã¼ã¯ã§200users以ä¸ãç²å¾ãããã¨ãæ課ã«ãã¦ãã¾ããã ãã®æ´»åãä»åã§æå¾ã«ãããã¨æãã¾ãã å¤åãè¨é²ä¸ã¯9ã¶æãããç¶ãããããªæ°ããã¾ããæèããã®ã¯åå¹´ãããã§ãã æ°åä¸ã®ç®æ¨ã¯200users以ä¸ã§ãã£ããã®ã®ãä»ã«ãè¤æ°ã®æé»ã®å¶ç´ã課ãã¦ããããããããã®å¶ç´æ¡ä»¶ãåæã«æºããå 容ãæ¸ãã®ã¯æ³å以ä¸ã«ããã¸ãã§ããã ãã¿ã¯ä¸å¿ã¾ã ãããã®ã®ããã®ãã¼ã¹ã ã¨ãã®ãã¡å 容ãæµ ããªã£ã¦ãããã¨ãè¦ãã¦ãã¾ããã ããã§ãä¸æ¦ããã°ã§ã®ã¢ã¦ããããã«ãããæéãæ¸ããã¦ãå¥ã®ãã¨ã«éä¸ãããã¨æãã¾ãã
é大æã¨ãã¦ãä»åã®æ´»åã«ã¤ãã¦æ¥æã®YAPC::Asiaã§è©±ãã¾ãã ãã¼ã¯æ¥ç¨ã¯åå¤ç¥ã¨ãããã¨ã§ãã©ã®ãã±ããã§ãåå ãã¦ããã ããããã§ãã
- ä½è : å®äºç伸,横å·åå,ã²ããã¾ããã,ä¼è¤ç´ä¹,ç°ä¸æ å¸,åè¦ç¥å·±
- åºç社/ã¡ã¼ã«ã¼: æè¡è©è«ç¤¾
- çºå£²æ¥: 2008/08/07
- ã¡ãã£ã¢: åè¡æ¬ï¼ã½ããã«ãã¼ï¼
- è³¼å ¥: 133人 ã¯ãªãã¯: 2,270å
- ãã®ååãå«ãããã° (288件) ãè¦ã
ã¦ã§ããªãã¬ã¼ã·ã§ã³ âãµã¤ãéç¨ç®¡çã®å®è·µãã¯ãã㯠(THEORY/IN/PRACTICE)
- ä½è : John Allspaw,Jesse Robbins,è§å¾å ¸
- åºç社/ã¡ã¼ã«ã¼: ãªã©ã¤ãªã¼ã¸ã£ãã³
- çºå£²æ¥: 2011/05/14
- ã¡ãã£ã¢: 大åæ¬
- è³¼å ¥: 10人 ã¯ãªãã¯: 923å
- ãã®ååãå«ãããã° (50件) ãè¦ã