å ææ稿ãã2015å¹´Webãµã¼ãã¢ã¼ããã¯ãã£åºè«ã§ã¯ãWebãµã¼ãã¢ã¼ããã¯ãã£ãå¦ã¶éã®ãã¨ä»£è¡¨çãªå®è£ ã¢ãã«ã®æ¦è¦ãç´¹ä»ãã¾ããã
ä»åã¯ãåååæ§ã主ã«æ°åWebã¨ã³ã¸ãã¢åãã«ãWebã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã¨ãã¼ã¿ãã¼ã¹ãµã¼ãéã®æ¥ç¶ç®¡çã¢ãã«ã¨éç¨äºæ ã«ã¤ãã¦ç´¹ä»ãã¾ãã ãã¼ã¿ãã¼ã¹æ¥ç¶ã®æ°¸ç¶åãã³ãã¯ã·ã§ã³ãã¼ãªã³ã°ã¨ã¯ä½ãªã®ãããªãå¿ è¦ãªã®ãã¨ãã£ããã¨ã主ãªè©±é¡ã§ãã
- èæ¯
- ãã¼ã¿ãã¼ã¹æ¥ç¶ã®æ°¸ç¶åã¨ã¯ãªã«ã
- ã³ãã¯ã·ã§ã³ãã¼ãªã³ã°ã¨ã¯ãªã«ã
- PostgreSQLã¨MySQL
- åèè³æ
- ã¾ã¨ã
èæ¯
2015å¹´Webãµã¼ãã¢ã¼ããã¯ãã£åºè«ã§ã¯ãWebãµã¼ãã¢ã¼ããã¯ãã£ã®è©±ã¨Webã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã»Rediséã®æ¥ç¶ç®¡çã®è©±ãåé ã«ãã£ãã該å½é¨åãä¸è¨ã«å¼ç¨ãã¦ã¿ãã
ãã®æ¥ã«å ¥ç¤¾ããæ°åã®Webã¢ããªã±ã¼ã·ã§ã³ã¨ã³ã¸ãã¢ã¨è©±ããã¦ãã¦ããpreforkã£ã¦ãªãã§ãããã¨ãã話ã«ãªã£ãã ã¢ããªã±ã¼ã·ã§ã³ãµã¼ãããRedisã¸æ¥ç¶ãã¦ããã³ãã¯ã·ã§ã³æ°ã®ã°ã©ããçºãã¦ãã¦ãã ãããã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã®ã¯ã¼ã«ã¼ããã»ã¹æ°ã«çãããã妥å½ãªæ°å¤ã ãããã¨ããããã話ããã¦ããã¨ãã ã£ãã¨æããã¡ãã£ã¨åã¾ã§AnyEvent::Redisã使ã£ã¦ããã¨ãã«ãã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã»Rediséã®ã³ãã¯ã·ã§ã³æ°ãç°å¸¸ãªæ°å¤ã«ãªã£ã¦ãã¦ãAnyEvent::Redisããããããé常å¤ã«æ»ã£ãã¨ããèæ¯ãããã
ãã®è©±ã«ã¯2ã¤ã®æé»çãªç¥èãåæã«ããã1ã¤ã¯å¯¾è±¡ã®ã¢ããªã±ã¼ã·ã§ã³ãµã¼ããpreforkåã®ã¢ã¼ããã¯ãã£ã§åä½ãã¦ããã¨ãããã¨ããã1ã¤ã¯ã¯ã¼ã«ã¼ããã»ã¹åä½ã§Redisã¸ã®ã³ãã¯ã·ã§ã³ããã£ãã·ã¥ãã¦ããã¨ãããã¨ã ã
åè ã®Webãµã¼ãã¢ã¼ããã¯ãã£ã«ã¤ãã¦ã¯ãUNIXã®ããã»ã¹ã¨ãããã¯ã¼ã¯APIã®è©±ãããWebãµã¼ãã®ä»£è¡¨çãªãããã¯ã¼ã¯I/Oã¢ãã«ã¾ã§è°è«ããã ãã®ã¨ãããµã¼ããµã¤ãã®ãªã¯ã¨ã¹ãå¦çã®å 容ã«ã¤ãã¦ã¯ç¹ã«è¨åããªãã£ãã ä¸æ¹ãå¾è ã®Webã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã»Rediséã®æ¥ç¶ç®¡çã¯ããªã¯ã¨ã¹ãå¦çä¸ã«Redisã¨ã®ããã¨ããå«ã話ã«ãªãã
Redisã«éãããMySQLãMemcachedãªã©ãä»ã®ãµã¼ãä¸ã§åä½ãããã¼ã¿ãã¼ã¹ããã»ã¹ã¨Webã¢ããªã±ã¼ã·ã§ã³ã®æ¥ç¶ã«ã¤ãã¦èãã¦ã¿ããã é常ã«å°å³ãªãã¼ãã ãããããã·ã¹ãã ãéç¨ãã¦ããç«å ´ããããã¨ãã·ã¹ãã ã®å®å®éç¨ã®ããã«ã¯æå¤ã¨éè¦ãªæè¡ã§ã¯ããã Webã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã ãã§ãªãããã¼ã¿ãã¼ã¹ãµã¼ãã®ã¢ã¼ããã¯ãã£ãæèãããã¨ã«ãªãããã奥ãæ·±ãã Webã¢ããªã±ã¼ã·ã§ã³ãã¬ã¼ã ã¯ã¼ã¯ãORMã®é¸å®ã«ãå½±é¿ããããããªãã¬ã¼ã·ã§ã³ã¨ã³ã¸ãã¢ã ãã§ãªããã¢ããªã±ã¼ã·ã§ã³ã¨ã³ã¸ãã¢ãæèããå¿ è¦ãããã
ã¨ãããããã¼ã¿ãã¼ã¹ã®æ¥ç¶ã¢ãã«ãä½ç³»çã«åå¼·ãããã¨è©¦ã¿ã¦ããªããªããã¾ããããªãã Webãµã¼ãã¢ã¼ããã¯ãã£ä»¥ä¸ã«ä½ç³»åãããããã¥ã¡ã³ããè¦ã¤ããããç¹å®ã®ãã¼ã¿ãã¼ã¹ããç¹å®ã®ã¯ã©ã¤ã¢ã³ãå®è£ ãç¹å®ã®ã¯ã¼ã¯ãã¼ãã«éå®ãã話ã«æ¯ãåãããã¡ã ã£ãã
ç¹ã«ãã³ãã¯ã·ã§ã³ãã¼ãªã³ã°ãé£ãããéå»ã«ã¯ãã³ãã¯ã·ã§ã³ãã¼ãªã³ã°é½å¸ä¼èª¬ã¨ãããã®ããã£ãããã ã 「コネクションプーリング都市伝説」はほんとに都市伝説?(その1) - 最速配信研究会(@yamaz) ããæ°å¹´ã ã¨ãRDBMSでコネクションプールが必要な理由、わからない。 - Togetter ã¨ããè°è«ããã£ãã æ£ç´ã«è¨ãã¨ããããã®è³æãç¹ã«å¾è ãèªãã§ãåè¦ã§ã¯ãããããããªãã¨æããTwitterã¾ã¨ããªã®ã§ã¾ã¨ã¾ã£ã¦ããªãã®ã¯å½ããåã ãã
ã³ãã¯ã·ã§ã³ãã¼ãªã³ã°ããµã¤ã¨ã³ã¹ã«ãªãã»ã©ã®çè«ã¯ãªããªããªããã©å®çªã®ãã¦ãã¦ã¯ãã£ã¦æç§æ¸ã«ã¯ãªãã®ã§é£ããã¯ãªããã©ãã©ãã
— Kota Uenishi (à¹â¢Ìã â¢Ì)Ù⧠(@kuenishi) 2013å¹´9æ4æ¥
naoyaããã®è¨äº (コネクションプーリングの話 - naoyaのはてなダイアリー) ãLLè¨èªåºèº«ããããã¨æãããããããã¨æãããã ããããç¨åº¦ãäºæ ãããã£ã¦ãã人åãã§ã¯ããæ°ãããã
èªåã®ä¸ã§è ã«è½ã¡ãªãç¶æ ãç¶ãã¦ãããããããPerlã¨MySQLãScala(JVM)ã¨PostgreSQLã®çµã¿åãããããããéç¨ããã¦ããä¸ã§ããã¼ã¿ãã¼ã¹æ¥ç¶ã¢ãã«ã«ã¤ãã¦ãå¤å°ãªãã¨ãææ¡ã§ãã¦ããããã«æãã
æ°¸ç¶åãã³ãã¯ã·ã§ã³ãã¼ãªã³ã°ãå¿ è¦ãã©ããã¯ãã¯ã©ã¤ã¢ã³ãã¨ãã¼ã¿ãã¼ã¹ãµã¼ãã®å®è£ ã¨ãã¼ã¿ãã¼ã¹ã«å¯¾ããã¯ã¼ã¯ãã¼ã次第ã ã¨èãã¦ãããé ã«æãæãã·ã¹ãã ã®ã¯ã¼ã¯ãã¼ãããã¼ã¿ãã¼ã¹è£½åãç°ãªã人ãã¡ãéã¾ãã°ãæè¦ãå¥ããã®ã¯å½ç¶ã ã PerlãJavaãMySQLãPostgreSQLãWebãã¨ã³ã¿ã¼ãã©ã¤ãºãã§è©±ãéã£ã¦ããã ã²ã¨ã¾ããä»åã¯æ¯è¼çå¤æ°ã®ã¦ã¼ã¶ããåæã«ã¢ã¯ã»ã¹ãããWebã·ã¹ãã ã«ããããã¼ã¿ãã¼ã¹æ¥ç¶äºæ ã«è©±ãéå®ãããã Perlã¨JVMã®ä¸çãPostgreSQLã¨MySQLã®ä¸çã®çµã¿åãããèããã¨ãã ãããã®ã±ã¼ã¹ã¯æããããã®ã§ã¯ãªããã¨æãã
ã¨ã¯ãããç´°ããéãã¯ããã©ãçµå±ã¯ãã¢ããªã±ã¼ã·ã§ã³ãµã¼ããããã¼ã¿ãã¼ã¹ãµã¼ãã«å¯¾ãã¦ãæ¥ç¶ãç¶æãããããã¨ãé½åº¦æ¥ç¶ããããæ¥ç¶ãç¶æãããªãã©ã®ããã«æ¥ç¶ãç¶æããã®ãã¨ããåé¡ã§ãããªããããã念é ã«ç½®ãã¤ã¤ãæ¬é¡ã«å ¥ããã
ãã¼ã¿ãã¼ã¹æ¥ç¶ã®æ°¸ç¶åã¨ã¯ãªã«ã
æ¥ç¶ãèããä¸ã§ãé½åº¦æ¥ç¶ããã¨ããã®ã¯èªç¶ãªçºæ³ã ã¨æãã ãã®ä¸æ¹ã§ããã¼ã¿ãã¼ã¹æ¥ç¶ã®æ°¸ç¶åã¨ã¯ãªã«ãããªããã¼ã¿ãã¼ã¹æ¥ç¶ãæ°¸ç¶åããã®ãã¨ãããã¨ãæ¹ãã¦èãã¦ã¿ãã
ãã¼ã¿ãã¼ã¹æ¥ç¶ã®ãªã¼ãããã
ãã¼ã¿ãã¼ã¹æ¥ç¶å¦çã«ã¯ä¸å®ã®ãªã¼ãããããããã ãã¼ã¿ãã¼ã¹ãç¹ã«RDBMSã®æ¥ç¶ãªã¼ããããã¨ãã¦ãTCPã³ãã¯ã·ã§ã³ã確ç«ããï¼TCP 3-way handshakeï¼ããã®ãªã¼ããããããã¼ã¿ãã¼ã¹å±¤ã®ãã³ãã·ã§ã¤ã¯ãªã¼ããããããã¼ã¿ãã¼ã¹å±¤ã®èªè¨¼ãªã¼ããããããã¼ã¿ãã¼ã¹ããã»ã¹å´ã®æ¥ç¶ç¨ããã»ã¹/ã¹ã¬ããçæãªã¼ãããããªã©ããããæ¥ç¶ãç ´æ£ãããªã¼ãããããå½ç¶ããã ããã§ãããªã¼ããããã¨ã¯ãæ¥ç¶ã«è¦ããã¬ã¤ãã³ã·ã¨ãæ¥ç¶ãåãä»ãããã¼ã¿ãã¼ã¹ãµã¼ãã®ä¸»ã«CPUã¨ã¡ã¢ãªæ¶è²»ãæãã
ãã¡ãããã¼ã¿ãã¼ã¹è£½åã«ãã詳細ã¯ç°ãªãã¨æããä¾ãã°ãRedisã¯ã¤ãã³ãé§åã¢ãã«ã®ã¢ã¼ããã¯ãã£ãªã®ã§ãæ¥ç¶ç¨ã®ããã»ã¹ãã¹ã¬ãããçæãããã¯ããªãã
ãªã¼ããããã«ã¤ãã¦è£è¶³ãããTCPã¯3-way handshakeãçµã¦ã³ãã¯ã·ã§ã³ã確ç«ããã¨ã¿ãªãã3-way handshakeã«ã¯æä½ï¼å¾å¾©ã®ãã±ããã®ããã¨ããå¿ è¦ã ã ããã«å ãã¦ãMySQLãPostgreSQLã¯ãã¼ã¿ãã¼ã¹å±¤ã«ããã¦ããæ¥ç¶ç¢ºç«ã®ããã«ã¡ãã»ã¼ã¸ã®ããã¨ããããã å ·ä½çãªãã³ãã·ã§ã¤ã¯ãèªè¨¼ã®å 容ã«ã¤ãã¦ã¯ãMySQLã®å ´å㯠MySQL :: MySQL Internals Manual :: 14.2 Connection PhaseãPostgreSQLã®å ´å㯠PostgreSQL: Documentation: 9.4: Message Flow ãåç §ãã¦ã»ããã ãããã®ãã³ãã·ã§ã¼ã¯ãçµã¦ãSQLãªã©ãæ¬ä½ã¨ãªãã¡ãã»ã¼ã¸ãéä¿¡ããã
æ¥ç¶ç¢ºç«ãã®ãã®ã¨ã¯é¢ä¿ãªãããTCPã®ããã¼å¶å¾¡ã¯ããã±ãããã¹ããªãéãã¯åæã«éä¿¡ãããã±ããæ°ï¼ã¦ã£ã³ãã¦ãµã¤ãºï¼ãå¾ã ã«å¢ããã¦ãããããé½åº¦æ¥ç¶ãã常ææ¥ç¶ã®ã»ãããããã¯ã¼ã¯ã¹ã«ã¼ãããã大ãããªãããããé½åº¦æ¥ç¶ãã¦ããã¨ãã¦ã£ã³ãã¦ãµã¤ãºãåæãµã¤ãºããã®ã¹ã¿ã¼ãã«ãªã£ã¦ãã¾ãã
ã¡ãªã¿ã«ãHTTPã«ã¯åè ã®TCPã®æ¥ç¶ãªã¼ããããã¯å½ç¶ããããHTTPèªä½ã«ã¯æ¥ç¶ç¢ºç«ã®ããã®ãããã³ã«ã¯ãªãã ãã¾ãRDBMSã®ãããã³ã«ã«æããããã§ã¯ãªããããã®è¾ºããããRDBMSã®ãããã³ã«ã¯ãã¨ãã¨å¤§éã®ã¯ã©ã¤ã¢ã³ãããã®æ¥ç¶ãæ³å®ãã¦ã¯ããªãã£ãã®ã§ã¯ãªããã¨ãããã¨ã伺ããã æ¥ç¶ãã¨ã«ããã»ã¹ãã¹ã¬ãããçæãã¦ããã¨ãããã大éæ¥ç¶ãæèãã¦Preforkãã¹ã¬ãããã¼ã«ãã¤ãã³ãé§åã¢ãã«ãæ¡ç¨ãã¦ãããã¨ãå¤ãWebãµã¼ãã¢ã¼ããã¯ãã£ã®ä¸çã¨ã¯ç°ãªãã
C/Såã®RDBMSã¯ãå ã å°æ°ã®ã¯ã©ã¤ã¢ã³ãã¨ã¹ãã¼ããã«ãªéä¿¡ãè¡ãããã«è¨è¨ããã¦ããï¼ãã¨ãå¤ãï¼ã®ã§ãHTTPã®ããã«å¤æ°ã®ã¯ã©ã¤ã¢ã³ãã¨æ¥ç¶åæãç¹°ãè¿ããªããããæ¹å¼ã¨ã¯ã¤ã³ãã¼ãã³ã¹ãã¹ãããããããã ããã¼
— Kazuho Oku (@kazuho) 2013å¹´9æ4æ¥
ãã¼ã¿ãã¼ã¹æ¥ç¶ã®æ°¸ç¶åææ³
ãããã®æ¥ç¶ãªã¼ãããããç¯ç´ããææ³ããæ¥ç¶ã®æ°¸ç¶åã ãæ¥ç¶ã®ä½¿ãåããæ¥ç¶ã®ãã£ãã·ã¥ã¨ãã£ã¦ãããã æ¥ç¶ã使ãã¾ãããã¨ã«ãããåå以å¤ã®æ¥ç¶ç¢ºç«ã®ãªã¼ãããããåæ¸ã§ããã
æ¥ç¶ã®æ°¸ç¶åã¨ä¸å£ã«è¨ã£ã¦ãã大ããï¼ã¤ã®ç¨®é¡ãããã¨èãã¦ããã
ï¼ã¤ç®ã¯ãWebã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã®ãªã¯ã¨ã¹ãå¦çä¸ã®éã ãããã¼ã¿ãã¼ã¹ã¨ã®æ¥ç¶ãæ°¸ç¶åããã¨ãããã®ã ã ããã§ã¯ãããããªã¯ã¨ã¹ãé½åº¦æ¥ç¶ã¢ãã«ã¨å¼ã¶ãã¨ã«ããã ãªã¯ã¨ã¹ãé½åº¦æ¥ç¶ã¢ãã«ã¯ãWebã¢ããªã±ã¼ã·ã§ã³ãµã¼ãããªã¯ã¨ã¹ãå¦çãéå§ãã¦ãããæåã®ãã¼ã¿ãã¼ã¹æ¥ç¶å¾ã«DBãªãã¸ã§ã¯ãã®ãããªãã®ãã¡ã¢ãªä¸ã«ä¿æãã¦ããããªã¯ã¨ã¹ãå¦ççµäºåã«DBãªãã¸ã§ã¯ããç ´æ£ãã¦ãæ¥ç¶ãã¯ãã¼ãºããã ãã¡ããããªã¯ã¨ã¹ãå¦çä¸ã®éã ãæ¥ç¶ãæ°¸ç¶åã§ããã°ããã®ã§ãå®è£ ãã¿ã¼ã³ã¯ããã¤ãããå¾ãã¨æããè¨èªã«ããäºæ ãç°ãªãã¨ãããã¨ãããã ããã
ã¢ãã³Perlã®å ´åã¯ããªã¯ã¨ã¹ãã®éå§ã¨çµäºã®ç ´æ£ã«ãPlack::Middlewareã¨ããä»çµã¿ã§ããã¯ãä»è¾¼ããã Scope::Container::DBIを書いた - blog.nomadscafe.jp ã®ããã«ãã¦ããªã¯ã¨ã¹ãå¦çã®çµäºæã«ãDBæ¥ç¶ãç ´æ£ãããã¨ãã§ããã Rubyã®RackãPythonã®WSGIã§ããã¡ããåããããªãã¨ãã§ããã¨æãã
ï¼ã¤ç®ã¯ãWebã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã®ãªã¯ã¨ã¹ãå¦çã«é¢ãããã常ææ¥ç¶ãæ°¸ç¶åããã¢ãã«ã ã ããã常ææ¥ç¶ã¢ãã«ã¨å¼ã¶ãã¨ã«ããã 常ææ¥ç¶ã¢ãã«ã¯ãã¢ããªã±ã¼ã·ã§ã³ã®ã°ãã¼ãã«ç©ºéã«ããã¼ã¿ãã¼ã¹ã¨ã®æ¥ç¶ããã¾ã¾ã®ãã¼ã¿ãã¼ã¹ãã³ãã©ãªãã¸ã§ã¯ããä¿æãã¦ãããç ´æ£ããã«ä½¿ãã¾ããã¦ããã¨ããã®ãåºæ¬ã ã Preforkã¢ãã«ã®Webãµã¼ãã§ããã°ãåã¯ã¼ã«ã¼ããã»ã¹ãããããã®ããã»ã¹å ã«ãã¼ã¿ãã¼ã¹ãã³ãã©ãä¿æãã¦ãããå¾ç¶ã®ãªã¯ã¨ã¹ãå¦çã«ããåå©ç¨ã§ããããã«ããã¨ããå®è£ ã«ãªãã
ããã§ãWebã¢ããªã±ã¼ã·ã§ã³ãæ¸ãã¦ããã¨ãã«ã大æµãããã®ããæ¥ç¶ããã£ãã·ã¥ãããã¨ãã¦ããã¬ã¼ã ã¯ã¼ã¯ã®ã³ã³ããã¹ããªãã¸ã§ã¯ããªã©ã«ãã¼ã¿ãã¼ã¹ãã³ãã©ãªãã¸ã§ã¯ããéã«ãã£ãã·ã¥ãã¦ãã¾ãã¨ãããã®ã ã
å°ãªãã¨ããPerlã®DBIã®å ´åãDBI->connect
ã®è¿ãå¤ã§ãããã¼ã¿ãã¼ã¹ãã³ãã©ãªãã¸ã§ã¯ãããã£ãã·ã¥ãã¦ãããã¾ããããªãã
ãã£ãã·ã¥ãã¦ããéã«ããã¼ã¿ãã¼ã¹ã¨ã®æ¥ç¶ãåããã¨ãåæ¥ç¶ããã«ã¨ã©ã¼ãåãã
ãã¼ã¿ãã¼ã¹æ¥ç¶ã¾ããã®ãªãã¸ã§ã¯ãããã£ãã·ã¥ããã¨ãã¯ããã£ãã·ã¥ãã¦æå³ã©ããã«åä½ããã®ãããã調æ»ããã»ããããã
Perlã§å¸¸ææ¥ç¶ãããªããDBIã®connect_cached ããScope::Conainer::DBIãç¨ãã¦ãåæ¥ç¶ãforkå®å ¨ãã©ãããèæ ®ãã¤ã¤ãã°ãã¼ãã«ç©ºéã«æ¥ç¶ãã³ãã©ãªãã¸ã§ã¯ãããã£ãã·ã¥ãã¦ãããããã使ãã¾ããã
Rubyã®ActiveRecordã§ããã°ãå¾è¿°ããã³ãã¯ã·ã§ã³ãã¼ãªã³ã°ã«ãããORMå´ã§ãããªã«æ°¸ç¶åãã¦ãããããã ã
ããã¾ã§ã¿ãã¨ãæ¥ç¶ã®ãªã¼ãããããåæ¸ã§ãã常ææ¥ç¶ã¢ãã«ã®ã¡ãªããã大ããããã«ã¿ããã ããããå½ç¶å¸¸ææ¥ç¶ã¢ãã«ã«ããã¡ãªããã¯ããã
ã¾ãã常ææ¥ç¶ã¢ãã«ã¯ã¯ã©ã¤ã¢ã³ãå´ã®ãªã½ã¼ã¹ãªã¼ã¯ãªã©ã®ãã°ãä½ããããã¨æããæ¥ç¶ãç¶æããã¨ãããã¨ã¯ãè¤æ°ã®æ¥ç¶ãªãã¸ã§ã¯ããã¹ã¬ãããªã©ãã°ãã¼ãã«ã¡ã¢ãªä¸ã«ä¿æãããã¨ã«ãªããã¡ã¢ãªãªã¼ã¯ã®æ¸©åºã«ãªããæ¥ç¶ãåããã¨ãã«ãåæãæ¤åºãã¦åæ¥ç¶ãããã¨ãå¿ è¦ã ã ä¸æ¹ã§ãé½åº¦æ¥ç¶ã¢ãã«ã¯ããªã¯ã¨ã¹ããã¨ã«æ¥ç¶ãªãã¸ã§ã¯ããä½æã»ç ´æ£ããããããªãã¸ã§ã¯ãã®ç®¡çã¯æ¯è¼ç容æã«ãªãã ãã ããPerlã®å ´åã大æµãPreforkåã®Webãµã¼ãã§ãããMaxRequestsPerChildã«ãããå®æçã«ã¯ã¼ã«ã¼ããã»ã¹ãæ»ã¬ããããã£ã¦ã常ææ¥ç¶ã¨ã¯ãã£ã¦ããé·æéæ¥ç¶ãç¶ããã¨ãããã¨ããªãããããªã½ã¼ã¹ã®ãªã¼ã¯ã«ã¤ãã¦ã¯ãã»ã©åé¡ã«ãªããªããã¨ãå¤ãã Railsçéã§ã¯ãIntroduce max_requests parameter to clear connections per some requests. by ryotarai · Pull Request #1 · sonots/activerecord-refresh_connection · GitHub ã®ããã«ãActiveRecordã§Nãªã¯ã¨ã¹ãå¾ã«æ¥ç¶ãåãã¨ãããªãã·ã§ã³ãä»ãã¦ãããããã
次ã«ãæ¥ç¶ãæ°¸ç¶åããã¨ãLVS/HAProxyãªã©ã®L4ãã¼ããã©ã³ãµãçµç±ããå ´åãåçã«ãã©ã³ã¹ãããªãã¨ããåé¡ãããã ä¸æ¦ãã¼ããã©ã³ãµã«ããæ¯ãåããããã¨ãæ¥ç¶ãåããªããããæ¯ãåãå ã®ãµã¼ãã¯åºå®ãããã¾ã¾ã ã åæ§ã«ããã¼ããã©ã³ãµé ä¸ã®ãµã¼ãã®ã¡ã³ããã³ã¹ãé¢åã«ãªãã ä¾ãã°ãLVSãç¨ããå ´åãã³ãã¯ã·ã§ã³æ¯ãåãã®éã¿ã0ã«ãã¦ãã³ãã¯ã·ã§ã³ãåããã®ãå¾ ã¡ãã¡ã³ããã³ã¹ãéå§ããã
ããã«ãæ¥ç¶ã®æ°¸ç¶åã«ããããã¼ã¿ãã¼ã¹ããã§ã¤ã«ãªã¼ãããã¨ãã¢ããªã±ã¼ã·ã§ã³ãµã¼ãããã§ã¤ã«ãªã¼ãå ã«åæ¥ç¶ããã¾ã§ãæéãããããã¨ãããã ããã¯æ¥ç¶åæã®æ¤åºãªã©ã®åæ¥ç¶ã¾ããã®å®è£ 次第ã§ã¯ãããTCPã®æ¥ç¶ãåããã¾ã§å¾ ããããå¯è½æ§ãããã 大éã®ãªã¯ã¨ã¹ãããã°ãã¦ããç°å¢ã ã¨ãä¸ç¬è©°ã¾ãã¨ãã·ã¹ãã å ¨ä½ãè©°ã¾ã£ã¦ãã¾ããã¨ãããå¾ãã ã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã®åèµ·åãå¿ è¦ãªå ´åãããã ããã
ã³ãã¯ã·ã§ã³ãã¼ãªã³ã°ã¨ã¯ãªã«ã
ã³ãã¯ã·ã§ã³ãã¼ãªã³ã°ã¯å¸¸ææ¥ç¶ã¢ãã«ã®å®è£ ã®ä¸ç¨®ã ã æ¥ç¶ãæ°¸ç¶åããã ãã§ãªããæ¥ç¶ã®åæ°ãå³å¯ã«ç®¡çããããã 主ã«JVMã®ã¨ã³ã·ã¹ãã ã§ä½¿ç¨ããã¦ããå°è±¡ãããã
æ¥ç¶æ°ã管çã§ãã¦ä½ãããããã®ãã ãã¼ã¿ãã¼ã¹ãµã¼ãå´ã®åæã«æ¥ç¶ã§ããã³ãã¯ã·ã§ã³æ°ã«ã¯æ§ã ãªå¶éãããããããã®å¶éãè¶ ãã¦ãã¾ãã¨æ¥ç¶ãåãä»ããªããªãã ã¯ã©ã¤ã¢ã³ãå´ã§æ¥ç¶æ°ã管çã§ããã°ããã¼ã¿ãã¼ã¹å´ã®å¶éã«å¼ã£ãããªãã¦ããã¨ããããã ã
ãã¼ã¿ãã¼ã¹ã®æ¥ç¶å¶éã«ã¯ï¼ç¨®é¡ããã¨èãã¦ããã
ã¾ããLinuxã«ã¼ãã«ã§ã¯ããã¼ãæ°ã®ä¸éãããã¡ã¤ã«ãã£ã¹ã¯ãªãã¿æ°ãªã©OSã管çãããªã½ã¼ã¹ã®ä¸éãããã
ããã¯ãã«ã¼ãã«ãªãã·ã§ã³ã®ip_local_port_range
ããã¼ã¿ãã¼ã¹å´ã®open_files_limit
ã®ãããªãªãã·ã§ã³ã§ä¸éã調æ´ã§ãããã¢ããªã±ã¼ã·ã§ã³ãµã¼ãå´ã®tcp_tw_reuse
ã®èª¿æ´ã§TIME_WAIT
ç¶æ
ã®ãã¼ããæ©ãã«åå©ç¨ãããã¨ãã§ããã(注: ãã©ã¡ã¼ã¿åã®éããtcp_fin_timeout
ã¨TIME_WAIT
ã¯é¢ä¿ãªããã®ã§ããã@namikawa ãããææãããã¨ããããã¾ãã)
次ã«ããã¼ã¿ãã¼ã¹å±¤ã§ã¯ãã¡ã¢ãªã®ã¹ã¯ãããªã©ãé¿ããããã«ãæ¥ç¶æ°ã®ä¸éãã¦ã¼ã¶è¨å®å¤ã«ããå®ãã¦ããã
PostgreSQLã®å ´åãmax_connectionsãããã«ç¸å½ããã
ã«ã¼ãã«ã«ããããã¼ã¿ãã¼ã¹å±¤ã«ãããçµå±ã¯ã¡ã¢ãªãªã©ã®ãã¼ãã¦ã§ã¢ãªã½ã¼ã¹ãããããã«æ¶è²»ããªãããã®å¶éã§ããã ã¡ã¢ãªã溢ãã¦ãã£ã¹ã¯ã¸ã®ã¹ã¯ãããçºçãããã¼ã¿ãã¼ã¹ãµã¼ããåæ¢ããã¨ãã·ã¹ãã å ¨ä½ã«å½±é¿ããã ã·ã¹ãã å ¨ä½ã«å½±é¿ãä¸ããããããªããã¯ã©ã¤ã¢ã³ãå´ã§ä¸éãè¨ãã¦ããã¦ãå¤å°ã®æ¥ç¶å¾ ã¡ãèµ·ãã¦ããããã¨ã«ããã ã¤ã¾ããé常ã®å¸¸ææ¥ç¶ã§ã¯ãåã«ã³ãã¯ã·ã§ã³æ°ãç¯ç´ã§ããã¨ããã¡ãªããããããããã«å¯¾ãã¦ãã¯ã©ã¤ã¢ã³ãå´ã§ã³ãã¯ã·ã§ã³ãã¼ãªã³ã°ãç¨ãã¦ããã¨ãä¸ç·ãè¶ ããªãããã«ãã¼ã¿ãã¼ã¹ãµã¼ãã®è² è·ãã³ã³ããã¼ã«ã§ããã¨ãããã¨ã ã¨èãã¦ããã
ã³ãã¯ã·ã§ã³ãã¼ãªã³ã°ã®å®è£ ã¯å¤§ããï¼ç¨®é¡ããããããã®ï¼ç¨®é¡ã¯ãã©ãã§æ¥ç¶ããã¼ãªã³ã°ããã®ããç°ãªãã
ã³ãã¯ã·ã§ã³ãã¼ãªã³ã°: ãã©ã¤ãå
ï¼ã¤ç®ã¯ãJVMã®ä¸çã®JDBCã®ãããªã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã®ãã¼ã¿ãã¼ã¹æ¥ç¶ã¯ã©ã¤ã¢ã³ããæ¥ç¶ãªãã¸ã§ã¯ãããã¼ãªã³ã°ããã¨ãããã®ã ã ããããã©ã¤ãåã¨å¼ã¶ãã¨ã«ãããã JDBCã®ã³ãã¯ã·ã§ã³ãã¼ãªã³ã°ï¼BoneCPãHikariCP ãªã©ï¼ã¯ã大éæã«ã¯ããªã¯ã¨ã¹ãå¦çç¨ã®ã¹ã¬ãããã¼ã«ä»¥å¤ã«ããã¼ã¿ãã¼ã¹æ¥ç¶ç¨ã®ã¹ã¬ãããã¼ã«ãä½æãã¦ãåã¹ã¬ããã®ãã¼ã«ã«å¤æ°ã«æ¥ç¶ãªãã¸ã§ã¯ããæããããããªå½¢ã«ãªã£ã¦ãããBoneCPãHikariCPã®å®è£ ãçºããç¨åº¦ã§ãJDBCå ¨ä½ã«ã¤ãã¦æããããã§ã¯ãªããããç°ãªãã¢ã¼ããã¯ãã£ã®å®è£ ããããããããªãã scala-redisã®å ´åã¯ãã¹ã¬ãããã¼ã«ã§ã¯ãªããRedisã®ã¯ã©ã¤ã¢ã³ããªãã¸ã§ã¯ããã°ãã¼ãã«ç©ºéã«ä¿æããå®è£ ã«ãªã£ã¦ããã ãã¼ã«ã®ãã¼ã¿æ§é ã«ã¯ãã¹ã¿ãã¯ããã¥ã¼ãé£çµãªã¹ããªã©æ§ã ãªæ§é ãç¨ãããã¦ããããã ã
ã³ãã¯ã·ã§ã³ãã¼ãªã³ã°: ãããã·å
ï¼ã¤ç®ã¯ãã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã¨ãã¼ã¿ãã¼ã¹ãµã¼ãã®éã«PgpoolãPgBouncerãªã©ã®æ¥ç¶ç®¡çã®ããã®ãããã·ãæãã§ããããã·ã«ãã¼ãªã³ã°ãããã¨ãããã®ã ã ãã¡ãã¯ããããã·åã¨å¼ã¶ãã¨ã«ããã ãããã·åã§ã¯ãã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã¨ãããã·ã®éã¯é½åº¦æ¥ç¶ã§ãããã ãããã£ã¦ãPerlã®ããã«ãã©ã¤ãåã®ã³ãã¯ã·ã§ã³ãã¼ãªã³ã°ã®å®è£ ãã»ã¨ãã©ãªããããªè¨èªã§ããã³ãã¯ã·ã§ã³ãã¼ãªã³ã°ã使ããã¨ããã¡ãªãããããã
ãããããPerlã§ã¯ã¾ã¨ããªã¹ã¬ããããªããããã»ã¨ãã©ã®Webãµã¼ããPreforkã¢ãã«ã§ãããPreforkã¢ãã«ã§ã³ãã¯ã·ã§ã³ãã¼ãªã³ã°ãããã¨ããã¨ãåã¯ã¼ã«ã¼ããã»ã¹éã§ãã¼ã«ãå ±æããããã«ããã¼ã«ãä¿æããå ´æã¨ãã¦ã®ããã»ã¹ãå¿ è¦ã¨ãªããç¡çããã³ãã¯ã·ã§ã³ãã¼ãªã³ã°ãå®è£ ã§ããªããã¨ã¯ãªãã¨æããããããï¼ããã»ã¹ã®ä¸ã§å®çµããJVMè¨èªã¨ã¯äºæ ãç°ãªãã ã©ã®ã¿ã¡ãå°ç¨ããã»ã¹ãå¿ è¦ãªãããããã·åã®ã»ããæ±ç¨çã«ä½¿ãã¦ããã¨ãããã¨ããããããããªãã åã¯ã¼ã«ã¼ããã»ã¹ãåå¥ã«ã³ãã¯ã·ã§ã³ãã¼ã«ãä¿æããã¨ããã®ããã¡ããããããããªã¯ã¨ã¹ãå¦çä¸ã«AnyEventãªã©ã®ã¤ãã³ãé§åã§ä¸¦åã«ãã¼ã¿ãã¼ã¹ã«å¯¾ãã¦æ¥ç¶ããã¨ããã±ã¼ã¹ã§ã¯ãã³ãã¯ã·ã§ã³æ°ã®ççºãæããããã«æå¹ãããããªãã
ãããã·åã®ã¡ãªããã¯ä»ã«ããããæ¥ç¶æ°ã管çã§ããã¨ã¯ãã£ã¦ãããã©ã¤ãåã®å ´åãã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã®å°æ°ãå¢ããã¨ãæ¥ç¶æ°ãã¢ããªã±ã¼ã·ã§ã³ãµã¼ãæ°ã«æ¯ä¾ãã¦å¢ããããããã£ã¦ããããã·åã¯å ¨ã¦ã®ã¢ããªã±ã¼ã·ã§ã³ãµã¼ãããã®æ¥ç¶æ°ãä¸å®ã«ä¿ã¡ãããã ãã¡ãããã¢ããªã±ã¼ã·ã§ã³ãµã¼ãåæ§ã«ããããã·ãã¹ã±ã¼ã«ã¢ã¦ããã¨ããã¡ããããã ããããæ¥ç¶ãä¸ç¶ããã ãã®ãããã·ã®ã¹ã«ã¼ããããããç¶ç¶çã«æ©è½éçºãããã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã®ã¹ã«ã¼ãããã®ã»ããä½ä¸ãããããããã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã®å°æ°ãå¢ããæ©ä¼ã®ã»ããå¤ãã¯ãã ã
ä¸æ¹ã§ããããã·åã®ãã¡ãªããã¯ããªãã¼ã¹ãããã·ã»ã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã»ãã¼ã¿ãã¼ã¹ã¨ãã代表çãªï¼å±¤æ§æã«å ãã¦ãï¼ã¤å±¤ãå¢ãããã¨ã«ããã管çã®æéãå¢ãããã¨ã ãä¸è¬ã«ã層ãå¢ããã¨ã·ã¹ãã å ¨ä½ã®å¯ç¨æ§ãä½ä¸ããã ãã ãããããã·ãç¬ç«ãããµã¼ãã«é ç½®ããã®ã§ã¯ãªããã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã«åå± ããæ§æãã¨ãã°ããµã¼ãã®æ°ãå¢ãããã«æ¸ãã ããããå ã«è¿°ã¹ãæ¥ç¶æ°ã®ç®¡çã®ããããã¨ããã¡ãªããã¯å¤±ããã¨ã«ãªãã
è£è¶³ã ããè² è·ã®ãã¼ã¯ã¿ã¤ã ãåå¨ããã·ã¹ãã ã®å ´åããã¼ã¯ã¿ã¤ã ã«åããã¦ãã¼ã«æ°ãè¨å®ãã¦ããã¨ããã¼ã¯ã¿ã¤ã 以å¤ã«ã¯ä½åãªæ¥ç¶ãéããã¾ã¾ãªããããã¼ã¿ãã¼ã¹å´ã®æ¥ç¶ç¶æã®ããã®ã¡ã¢ãªãç¡é§ã«ãªãã¨ãã話ãããã BoneCPãªã©ã®ä¸é¨ã®ã³ãã¯ã·ã§ã³ãã¼ã«ã®å®è£ ã¯ãæå°æ¥ç¶æ°ã¨æ大æ¥ç¶æ°ãè¨å®ãã¦ãããæå°ã¨æ大ã®å®ç¾©åã®ç¯å²å ã§ãæ¥ç¶æ°ãè² è·ã«åããã¦åçã«å¤æ´ãã¦ãã¡ã¢ãªå¹çãè¯ããã¦ããã
ã³ãã¯ã·ã§ã³ãã¼ãªã³ã°å ¨ä½ã«ã¤ãã¦
ãã©ã¤ãåã«ãããããã·åã«ãããæ大/æå°ãã¼ã«æ°ãæ¥ç¶ã®ã¿ã¤ã ã¢ã¦ãæéãåæ¥ç¶ã¾ã§ã®æéãæ¥ç¶ãç¶æãç¶ããæéããªã©ã®å¤ãã®ãã©ã¡ã¼ã¿ããã¥ã¼ãã³ã°ããªããã°ãªããªããã¨ãããã ãã¡ãããã³ãã¯ã·ã§ã³ãã¼ãªã³ã°ã®å®è£ 次第ã§ç®¡çãããã©ã¡ã¼ã¿ã¯ç°ãªãã
ä¾ãã°ãæ大/æå°ãã¼ã«æ°ãçããããçµæãæ¥ç¶ç¶ææéãè¶ ããç¬éãä¸æã«åæ¥ç¶ãçºçããä¸é¨ã®ã¢ããªã±ã¼ã·ã§ã³ã¹ã¬ããããã¼ã«ããã³ãã¯ã·ã§ã³ãåãåºããã«ã¨ã©ã¼ãåãã¨ãããã¨ããã£ãã
ã³ãã¯ã·ã§ã³ãã¼ãªã³ã°ã®å®è£ ã«ç¿çããæããªããªãããã¼ã¿ãã¼ã¹ã®ã¹ã±ã¼ã«ã¢ãããã¹ã±ã¼ã«ã¢ã¦ãã§è§£æ±ºãããªããããã§ããã¨æã£ã¦ããã ç¡çã«é£ãããã¨ããå§ãã¦ããã©ãã«ã·ã¥ã¼ãã£ã³ã°ã«æéã浪費ãã¦ãã¾ãã¨ãããã¨ãããã MySQLã®ãã¹ã¿ã®ã¹ã±ã¼ã«ã¢ãããéçã«ãã¦ãã¦ãã³ãã¯ã·ã§ã³æ°ã®ä¸éã«ããããããªå ´åãã2~3æ¡ã®MySQLã®ã¹ã¬ã¼ãæ°ã®ãã¡ä½å²ãå°æ°ãæ¸ãããè¦è¾¼ã¿ããããªããã³ãã¯ã·ã§ã³ãã¼ãªã³ã°ãæ¤è¨ãã¦ãããã¨æãã
PostgreSQLã¨MySQL
PostgreSQLã¨MySQLã«ã¤ãã¦ãæ¥ç¶ã®æ°¸ç¶åäºæ ãç´¹ä»ããã PostgreSQLã¨MySQLã§ã¯ãæ¥ç¶åãä»ãã®ã¢ã¼ããã¯ãã£ãã¦ã¼ã¶ã³ãã¥ããã£ãç°ãªãã®ã§ããã®ãã¨æ°¸ç¶åã«å¯¾ãã温度æãç°ãªãã
PostgreSQLã¯ï¼ã¤ã®æ¥ç¶ã«å¯¾ãã¦ãï¼ã¤ã®ããã»ã¹ãçæããã ã¤ã¾ãããã«ãããã»ã¹ã¢ãã«ã§ãããããå¾è¿°ã®MySQLã¨æ¯è¼ãã¦ãã¡ã¢ãªæ¶è²»éã¯å¤ãã¨ãããã ãã¡ãããCopy On Writeï¼CoWï¼ãå¹ãã¯ããªã®ã§ãã¡ã¢ãªæ¶è²»éã¯å¤å°ã¯æé©åãããã ããããæ¥ç¶ãæ°¸ç¶åãã¦ããã°ãå¾ã ã«forkå ããã»ã¹ã¨ã®ä¹é¢ãæ¿ãããªããããã»ã¹ãããã®ã¡ã¢ãªæ¶è²»éã¯å¢å ãã¦ããã PostgreSQLã¯ãæ¥ç¶ãåãä»ãã度ã«forkãããããæ¥ç¶ã®ãªã¼ããããã¯ãããªãã«å¤§ããã 大éæ¥ç¶ãåæã«åãä»ããã¨ãè² è·ãè·³ãä¸ãããã¨ãããã
ãã®ããã«PostgreSQLã¯ãæ¥ç¶ãªã¼ããããã大ãããã¨ãç¥ããã¦ãããããåè¿°ããPgpoolãPgbouncerãªã©ã®ãããã·åã®ã³ãã¯ã·ã§ã³ãã¼ãªã³ã°ã¨ä½µç¨ããããã¨ãå¤ããPgpoolã¯é«æ©è½ã ããã³ãã¯ã·ã§ã³ãã¼ãªã³ã°ã®å®è£ ã¯ããã¼ã«ã®æ°ã ãããã»ã¹ãPreforkãããä¸æ¹ãPgbouncerã¯ã³ãã¯ã·ã§ã³ãã¼ãªã³ã°ã®æ©è½ãããªãããã¤ãã³ãé§åã¢ãã«ã使ç¨ãã¦ãã¦ãå¹çãããã¨ããéãããããWhat Powers Instagram: Hundreds of Instances, Dozens of Technologies - Instagram Engineering ã«ããã¨ãInstagramã¯Pgbouncerã使ã£ã¦ããããã ã
ä¸æ¹ãMySQLã¯ï¼ã¤ã®æ¥ç¶ã«å¯¾ãã¦ãï¼ã¤ã®ã¹ã¬ãããçæããã ãã«ãã¹ã¬ããã¢ãã«ã§ãããããPostgreSQLã¨æ¯ã¹ã¦ãã¡ã¢ãªæ¶è²»éã¯æããããã¯ãã ã ã¨ã¯ãããã¹ã¬ããçæ/ç ´æ£ã«ã¯ãããªãã®ãªã¼ãããããããã MySQLã«ã¯Thread Cacheã®ä»çµã¿ããããæ¥ç¶ã«ä½¿ç¨ããã¹ã¬ããã使ãåããã¨ã«ããããªã¼ãããããæãã¦ããã
MySQLã§ã¯ãæ¥ç¶ãªã¼ãããããå°ãããã¨ãç¥ããã¦ãããããMobage を支える Ruby の技術 ~ 複数DB編 ~ - sonots:blog ã«æ¸ããã¦ããããã«ãé½åº¦æ¥ç¶ãç¨ãããã¦ãããã¨ãå¤ãããã ãã¯ã¦ãªã§ãåºæ¬ã¯é½åº¦æ¥ç¶ãã¦ããã
åèè³æ
- コネクションプーリングの話 - naoyaのはてなダイアリー
- RDBMSでコネクションプールが必要な理由、わからない。 - Togetter
- Scope::Container::DBIを書いた - blog.nomadscafe.jp
- RDBMSのコネクションプーリングとかその辺の話 - wyukawa's diary
- Mobage を支える Ruby の技術 ~ 複数DB編 ~ - sonots:blog
- [infra][ruby]Rails(ActiveRecord)でデータベースへのコネ|... | Facebook
- Number Of Database Connections - PostgreSQL wiki
- ActiveRecordのDBコネクションの接続切れと再接続について。reconnectオプションは危険だなーとかも - odeの開発メモ日記
- 2004-12-17
ã¾ã¨ã
Webã¢ããªã±ã¼ã·ã§ã³ã«ãããé½åº¦æ¥ç¶ã常ææ¥ç¶ãã³ãã¯ã·ã§ã³ãã¼ãªã³ã°ãªã©ã®ãã¼ã¿ãã¼ã¹æ¥ç¶ã¢ãã«ã¨ãPerlã¨JavaãMySQLã¨PostgreSQLãDevã¨Opsã¨ãã£ãåè¦ç¹ããã¿ããã¼ã¿ãã¼ã¹æ¥ç¶äºæ ã«ã¤ãã¦æ¸ãã¾ããã
ãã¼ã¿ãã¼ã¹æ¥ç¶ç®¡çã¢ã¼ããã¯ãã£ã¯ãWebãµã¼ãã¢ã¼ããã¯ãã£ã¨ç°ãªãããUNIXãããã¯ã¼ã¯ããã°ã©ãã³ã°ãã«ç¸å½ãããããªãè°è«ã®ãã¼ã¹ã¨ãªãæç®ããªããããä½ç³»çãªè°è«ãçµã¿ç«ã¦ãã®ãé£ããã¨æãã¾ããã ã©ããã¦ããç¹å®ã®å®è£ ã«éå®ãã話ã«ãªããã¡ã§ãã ããæç®ãããã°æãã¦ãã ããã
é·å¹´ãPerlã§éç¨ãã¦ããå®ç¸¾ãããããããã®äººã®ãã®ã¢ã¸ã¥ã¼ã«ã使ã£ã¦ããã°ã大è¦æ¨¡ç°å¢ã®éç¨ãèæ ®ããã¦ãã¦å®å¿ãã¦ä½¿ããã¨ãããããªç¥è¦ã®åãæ¹ãããã£ã¦ãã¾ããã ä¸æ¹ãæ¡ç¨è¨èªã®å¤åã«ãããããã¾ã§ã®è¡¨é¢çãªå¸¸èãéç¨ããªããªãã¨ãããã¨ãããã¾ãã ä¾ãã°ãã¢ãã³Perlã®å ´åã¯ãWebãµã¼ãã¯Starletã使ã£ã¦ãORMã¯DBIx::HandlerãContainer::Scope::DBIãç¨ãã¦èªä½ããã¨ãã£ããã¨ããã£ã¦ãã¾ããã
ããããPlay2ã®ããã«Webãµã¼ãã¨ãã¬ã¼ã ã¯ã¼ã¯ãããã«ORMã¾ã§å¯çµåãã¦ãããã«ã¹ã¿ãã¯ã®ãã¬ã¼ã ã¯ã¼ã¯ãæ¡ç¨ããã¨ãåæãå¤ãã£ã¦ãã¾ãã ããã¾ã§ãªã¯ã¨ã¹ãé½åº¦æ¥ç¶ã ã£ããã®ãããã©ã«ãã§å¸¸ææ¥ç¶ã«ãªã£ã¦ãããã¨ãããã¾ãã
æ¥ç¶ãæ°¸ç¶åããã¨ãã®ãã¼ããã©ã³ãµã«ããæ¥ç¶ç®¡çã®é£ãããªã©ã®ã·ã¹ãã éç¨äºæ ã¯ããªããªãã¢ããªã±ã¼ã·ã§ã³ã¨ã³ã¸ãã¢ã«ã¯é¦´æã¿ããªããæ°ã¥ãã«ãããã¨ã ã¨æãã¾ããä¸æ¹ãWebã¢ããªã±ã¼ã·ã§ã³å´ã®ãã¼ã¿ãã¼ã¹æ¥ç¶ã¾ããã®ã³ã¼ããã©ã®ããã«ãªã£ã¦ãããããªãã¬ã¼ã·ã§ã³ã¨ã³ã¸ãã¢ã«ã¨ã£ã¦ã¯ææ¡ãã¥ããã¨ããããããã¾ããã
ãã®ãããªã·ã¹ãã ã®ã¢ã¼ããã¯ãã£ã«å¯¾ããå ±éç解ãããããDevOpsã®ä¸ç°ã ã¨æã£ã¦ãã¾ãããã¾ãDevOpsã®æèã§èªããããã¨ã¯ãªãããããã¾ãããã
å®è·µãã¤ããã©ã¼ãã³ã¹MySQL 第3ç
- ä½è : Baron Schwartz,Peter Zaitsev,Vadim Tkachenko,èæ± ç èª,æ ªå¼ä¼ç¤¾ã¯ã¤ã¼ã
- åºç社/ã¡ã¼ã«ã¼: ãªã©ã¤ãªã¼ã¸ã£ãã³
- çºå£²æ¥: 2013/11/25
- ã¡ãã£ã¢: 大åæ¬
- ãã®ååãå«ãããã° (7件) ãè¦ã