Spring tomcat JDBC Connection pool mysql jdbc option
[tomcat7] tomcat JDBC Connection pool
Çϱ⠳»¿ëÀº ±¸±Û¸µ°ú ±âÁ¸¿¡ ¾Ë°í ÀÖ´ø ºÎºÐÀ» Åä´ë·Î tomcat JDBC connection pool ¼Ó¼º¿¡ ´ëÇØ Á¤¸®ÇÑ ±ÛÀÔ´Ï´Ù.
Tomcat JDBC Connection Pool ¼³Á¤
<Resource name="jdbc/testDatasource"
auth="Container"
driverClassName="oracle.jdbc.OracleDriver"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
initialSize="20"
maxActive="20"
maxIdle="20"
minIdle="20"
testWhileIdle="true"
testOnReturn="false"
timeBetweenEvictionRunsMillis="5000"
minEvictableIdleTimeMillis="30000"
validationQuery="SELECT 1 FROM DUAL"
validationInterval="30000"
testOnBorrow="true"
type="javax.sql.DataSource"
removeAbandoned="false"
removeAbandonedTimeout="60"
logAbandoned="false"
url="jdbc:oracle:thin:@192.168.10.11:1532:testDB"
username="oracle"
password="oracle"/>
¾Æ·¡ Ç¥´Â tomcat7 ±âÁØ tomcat JDBC Connection pool ¼Ó¼º¿¡ ´ëÇÑ ¼³¸íÀÔ´Ï´Ù. ¹öÀü¿¡ µû¶ó default °ªÀÌ »óÀÌÇÒ ¼ö ÀÖ½À´Ï´Ù.
¼Ó¼º À̸§ | ¼³¸í |
---|---|
factory | tomcat JDBC¸¦ »ç¿ëÇÒ °æ¿ì, org.apache.tomcat.jdbc.pool.DataSourceFactory·Î ¼³Á¤(³»ºÎÀûÀ¸·Î »ó¼Ó tomcat JDBC¸¦ »ó¼Ó ¹ÞÀº customÀ» ¼³Á¤ÇÒ ¼öµµ ÀÖÀ½) |
initialSize | BasicDataSource Ŭ·¡½º »ý¼º ÈÄ ÃÖÃÊ·Î getConnection() ¸Þ¼Òµå¸¦ È£ÃâÇÒ ¶§ connection pool¿¡ ä¿ö ³ÖÀ» connection ¼ö |
maxActive | µ¿½Ã¿¡ »ç¿ëÇÒ ¼ö ÀÖ´Â ÃÖ´ë connection °³¼ö |
maxIdle | connection pool¿¡ ¹Ý³³ÇÒ ¶§ ÃÖ´ë·Î À¯ÁöµÉ ¼ö ÀÖ´Â connection °³¼ö |
minIdle | ÃÖ¼ÒÇÑÀ¸·Î À¯ÁöÇÒ connection °³¼ö |
maxWait | connection pool ³»ÀÇ connectionÀÌ °í°¥µÇ¾úÀ» ¶§ connection ¹Ý³³À» ´ë±âÇÏ´Â ½Ã°£(ms) (tomcat DBCP »ç¿ë ½Ã, default 30000ms(30s)) |
testWhileIdle | evictor ½º·¹µå°¡ ½ÇÇàµÉ ¶§ connection pool ¾È¿¡ ÀÖ´Â À¯ÈÞ »óÅÂÀÇ connectionÀ» ´ë»óÀ¸·Î Å×½ºÆ® ½ÇÇà(default: false) |
testOnReturn | connectionÀ» ¹ÝȯÇÒ ¶§ Å×½ºÆ®(°ËÁõ) ½ÇÇà(default: false) |
timeBetweenEvictionRunsMillis | Evictor ½º·¹µå°¡ µ¿ÀÛÇÏ´Â °£°ÝÀ̸ç, 1000msº¸´Ù ÀÛÀº °ªÀ» ¼³Á¤ÇÒ ¼ö ¾øÀ½(default: 5000ms) |
minEvictableIdleTimeMillis | Evictor ½º·¹µå µ¿ÀÛ ½Ã connectionÀÇ À¯ÈÞ ½Ã°£À» È®ÀÎÇØ ¼³Á¤°ª ÀÌ»óÀÏ °æ¿ì connection Á¦°Å(default: 60000ms) |
validationQuery | À¯È¿¼º °Ë»ç Äõ¸®·Î, DBMS Á¾·ù¿¡ µû¶ó ÁÖ·Î ¾Æ·¡¿Í °°ÀÌ »ç¿ë [ Oracle ] select 1 from dual [ Microsoft SQL Server ] select 1 [ MySQL ] select 1 |
validationInterval | connection °ËÁõ ½Ã, ¼³Á¤°ª À̳»·Î ±âÁ¸¿¡ Å×½ºÆ®ÇÑ ÀÌ·ÂÀÌ ÀÖÀ¸¸é ´Ù½Ã °ËÁõÇÏÁö ¾ÊÀ½(default: 3000ms) |
testOnBorrow | connection pool¿¡¼ connectionÀ» ¾ò¾î¿Ã ¶§ Å×½ºÆ®(°ËÁõ) ½ÇÇà(default: false) |
type | javax.sql.DataSource |
removeAbandoned | abandoned connectionÀ» Á¦°ÅÇÒÁö ¿©ºÎÀ̸ç false ±ÇÀå(default: false) connection ÀÚ¿øÀÌ Á¦´ë·Î ¹ÝȯµÇÁö ¾Ê´Â´Ù°í Tomcat JDBC¿¡¼ Á¦°ÅÇϱ⺸´Ù´Â ½ÇÁ¦ ¿øÀÎÀ» ã¾Æ ¾îÇø®ÄÉÀ̼Ǵܿ¡¼ ¹ÝȯÇÒ ¼ö ÀÖµµ·Ï ÇÏ´Â °ÍÀÌ ÁÁÀ½(±Ùº»Àû ¼öÁ¤ ÇÊ¿ä) |
removeAbandonedTimeout | abandoned connectionÀÌ »èÁ¦µÇ±â±îÁö timeout°ª(default: 60s) |
logAbandoned | abandoned connection¿¡ °üÇÑ trace logÀ» ¾îÇø®ÄÉÀ̼ǿ¡ ÂïÀ»Áö ¿©ºÎ(default: false) |
connection °³¼ö °ü·Ã ¼Ó¼º
¼Ó¼º À̸§ | ¼³¸í |
---|---|
factory | org.apache.tomcat.jdbc.pool.DataSourceFactory |
initialSize | BasicDataSource Ŭ·¡½º »ý¼º ÈÄ ÃÖÃÊ·Î getConnection() ¸Þ¼Òµå¸¦ È£ÃâÇÒ ¶§ connection pool¿¡ ä¿ö ³ÖÀ» connection ¼ö |
maxActive | µ¿½Ã¿¡ »ç¿ëÇÒ ¼ö ÀÖ´Â ÃÖ´ë connection °³¼ö |
maxIdle | connection pool¿¡ ¹Ý³³ÇÒ ¶§ ÃÖ´ë·Î À¯ÁöµÉ ¼ö ÀÖ´Â connection °³¼ö |
minIdle | ÃÖ¼ÒÇÑÀ¸·Î À¯ÁöÇÒ connection °³¼ö |
maxWait | connection pool ³»ÀÇ connectionÀÌ °í°¥µÇ¾úÀ» ¶§ connection ¹Ý³³À» ´ë±âÇÏ´Â ½Ã°£(ms) (tomcat DBCP »ç¿ë ½Ã, default 30000ms(30s)) |
connection °³¼ö¿Í °ü·ÃµÈ ¼Ó¼ºÀº ¾Æ·¡¿Í °°Àº Á¶°ÇÀ» ¸¸Á·½ÃÄÑ¾ß ÇÕ´Ï´Ù.
maxActive
>=initialSize
maxActive
º¸´ÙinitialSize
°¡ Å©¸é ÃÖÃÊ connection »ý¼º ½Ã ÃÖ´ë connection °³¼öº¸´Ù Å©°Ô »ý¼ºÇØ¾ß Çϱ⠶§¹®¿¡ ³í¸®ÀûÀ¸·Î ¿À·ù°¡ ÀÖ½À´Ï´Ù.
maxIdle
>=minIdle
maxIdle
<minIdle
·Î ¼³Á¤Àº °¡´ÉÇϳª ³í¸®ÀûÀ¸·Î ¿À·ù°¡ ÀÖ½À´Ï´Ù.
maxActive
=maxIdle
maxActive
°ª°úmaxIdle
°ªÀÌ °°Àº °ÍÀÌ ¹Ù¶÷Á÷ÇÕ´Ï´Ù.maxActive = 10
ÀÌ°ímaxIdle = 5
ÀÎ »óȲÀÏ ¶§, Ç×»ó connectionÀ» 5°³ »ç¿ëÇÏ°í ÀÖÀ» ¶§ 1°³ÀÇ connectionÀ» Ãß°¡·Î ¿äûÇÑ´Ù¸é 1°³ÀÇ Ãß°¡ connectionÀ» µ¥ÀÌÅͺ£À̽º¿Í ¿¬°áÇÑ ÈÄ poolÀº ºñÁî´Ï½º ·ÎÁ÷À¸·Î connectionÀ» Àü´ÞÇÕ´Ï´Ù. ÀÌÈÄ ºñÁî´Ï½º ·ÎÁ÷ÀÌ connectionÀ» »ç¿ëÇÑ ÈÄ pool¿¡ ¹Ý³³ÇÒ °æ¿ì, maxIdle = 5ÀÇ ¿µÇâÀ» ¹Þ¾Æ connectionÀ» ½ÇÁ¦·Î ´Ý¾Æ¹ö¸®±â ¶§¹®¿¡ ÀϺΠconnectionÀ» ¸Å¹ø »ý¼º ¹× ´Ý´Â ºñ¿ëÀÌ ¹ß»ýÇÒ ¼ö ÀÖ½À´Ï´Ù.
»ç½Ç»ó initialSize
, maxActive
, maxIdle
, minIdle
Ç׸ñÀº µ¿ÀÏÇÑ °ªÀ¸·Î ÅëÀÏÇصµ ¹«¹æÇÕ´Ï´Ù. connection °³¼ö¿Í °ü·ÃµÈ °¡Àå Áß¿äÇÑ ¼º´É ¿ä¼Ò´Â ÀϹÝÀûÀ¸·Î connection ÃÖ´ë °³¼öÀÔ´Ï´Ù. 4°¡Áö Ç׸ñÀÇ °ª Â÷ÀÌ´Â ¼º´ÉÀ» Á¿ìÇÏ´Â Áß¿ä º¯¼ö´Â ¾Æ´Õ´Ï´Ù.
maxActive
°ªÀº DBMSÀÇ ¼³Á¤°ú ¾îÇø®ÄÉÀÌ¼Ç ¼¹öÀÇ °³¼ö ¹× tomcat¿¡¼ µ¿½Ã¿¡ ó¸®ÇÒ ¼ö ÀÖ´Â »ç¿ëÀÚ ¼ö µîÀ» °í·ÁÇؼ ¼³Á¤ÇØ¾ß ÇÕ´Ï´Ù. DBMS°¡ ¼ö¿ëÇÒ ¼ö ÀÖ´Â connection °³¼ö¸¦ È®ÀÎÇÑ ÈÄ¿¡ ¾îÇø®ÄÉÀÌ¼Ç ¼¹ö ÀνºÅϽº 1°³°¡ »ç¿ëÇϱâ ÀûÀýÇÑ °³¼ö¸¦ ¼³Á¤ÇÕ´Ï´Ù.
connectionÀ» ¾ò±â Àü ´ë±â ½Ã°£
maxWait
¼Ó¼ºÀº connection pool ¾ÈÀÇ connectionÀÌ °í°¥µÇ¾úÀ» ¶§ connection ¹Ý³³À» ´ë±âÇÏ´Â ½Ã°£(¹Ð¸®ÃÊ)ÀÔ´Ï´Ù. ÇØ´ç ¼Ó¼ºÀº Æò¼Ò¿¡´Â ¾î¶² °ªÀ» ¼³Á¤ÇÏ´ø »ó°ü¾øÁö¸¸, »ç¿ëÀÚ°¡ °©Àڱ⠱ÞÁõÇϰųª DBMS¿¡ Àå¾Ö°¡ ¹ß»ýÇßÀ» ¶§ Àå¾Ö¸¦ ´õ¿í Å©°Ô È®»ê½Ãų ¼ö ÀÖ¾î ÁÖÀÇÇØ¾ß ÇÕ´Ï´Ù.
ÀûÀýÇÑ maxWait
°ªÀ» ¼³Á¤ÇÏ·Á¸é TPS(Transaction Per Seconds)
¿Í tomcat¿¡¼ ó¸® °¡´ÉÇÑ thread °³¼ö µîÀ» ÀÌÇØÇØ¾ß ÇÕ´Ï´Ù.
TPS(Transaction Per Seconds)
¾Æ·¡¿Í °°Àº »óȲÀ» °¡Á¤ÇÑ´Ù¸é, A ¿äû¿¡ ´ëÇÑ ÃÖÁ¾ ÀÀ´ä ½Ã°£Àº 500ms(¿äû ÀÀ´ä¿¡ ÇÊ¿äÇÑ ´Ù¸¥ ÄÄÆ÷³ÍÆ® ½Ã°£ ¹«½Ã)ÀÔ´Ï´Ù.
- ¿äû Çϳª¿¡ Äõ¸® 10°³¸¦ ½ÇÇàÇÕ´Ï´Ù. °¢ Äõ¸®ÀÇ Æò±Õ ½ÇÇà ½Ã°£Àº 50msÀÔ´Ï´Ù.
À§¿Í °°Àº ¿äûÀÌ ¿©·¯°³ µé¾î¿À´Â ½Ã½ºÅÛ ÀüüÀÇ TPS¸¦ ´ë·«ÀûÀ¸·Î º¸¸é ¾Æ·¡¿Í °°½À´Ï´Ù. ¿äû ÇϳªÀÇ ÀÀ´ä½Ã°£ÀÌ 500msÀÌ°í, maxActive
°¡ 5À̱⠶§¹®¿¡ 1Ãʵ¿¾È 10°³ÀÇ ¿äûÀ» ó¸®ÇÒ ¼ö ÀÖ°í ¼º´É Áö¼ö´Â 10TPS
¶ó°í º¼ ¼ö ÀÖ½À´Ï´Ù.
connectionÀÇ °³¼ö¿Í TPS°¡ ¹ÐÁ¢ÇÏ°Ô ¿¬°üµÈ ÀÌÀ¯´Â, ó¸®ÇØ¾ß ÇÏ´Â ¿äû ¼ö°¡ Áõ°¡Çصµ connection poolÀÇ connection °³¼ö°¡ 5°³À̸é 10TPS ÀÌ»óÀÇ ¼º´ÉÀ» ³¾ ¼ö ¾ø±â ¶§¹®ÀÔ´Ï´Ù. ¾Æ·¡ ±×¸²°ú °°ÀÌ 10°³ÀÇ ¿äûÀÌ µé¾î¿À¸é, connection pool 5°³°¡ ÀÌ¹Ì »ç¿ëÁßÀ̱⠶§¹®¿¡ 5°³ÀÇ ¿äûÀº connection pool¿¡ ¿©ºÐ connectionÀÌ »ý±æ ¶§±îÁö ´ë±â »óÅ°¡ µÇ¾î maxWait
°ª¸¸Å ±â´Ù¸³´Ï´Ù.
- ÀÌ ¶§, Thread Dump¸¦ ¶ß¸é
TIMED_WAITING
°É¸° thread°¡ Á¸ÀçÇÏ´Â °ÍÀ» È®ÀÎÇÒ ¼ö ÀÖ½À´Ï´Ù.
ÀÌ·¯ÇÑ ´ë±âÇÏ´Â ¿äû ¼ö¸¦ ÁÙÀÌ´Â °¡Àå ½¬¿î ¹æ¹ýÀº maxActive
°ªÀ» ³ôÀÌ´Â °ÍÀÌÁö¸¸, ÀϹÝÀûÀ¸·Î DBMS ¸®¼Ò½º¸¦ ÇϳªÀÇ ¾îÇø®ÄÉÀ̼ǿ¡¼¸¸ »ç¿ëÇÏ´Â °ÍÀÌ ¾Æ´Ï±â ¶§¹®¿¡ ¹«ÀÛÁ¤ connection °³¼ö¸¦ Å©°Ô ¼³Á¤ÇÒ ¼ö ¾ø½À´Ï´Ù. µû¶ó¼, ¿¹»ó Á¢¼ÓÀÚ ¼ö¿Í ¼ºñ½ºÀÇ ½ÇÁ¦ ºÎÇϸ¦ ÃøÁ¤ÇØ ÃÖÀû°ªÀ» ¼³Á¤ÇÏ´Â °ÍÀÌ Áß¿äÇÕ´Ï´Ù.
maxWait
°ª Á¶ÀýÀ» ÅëÇØ ¹«ÇÑÈ÷ connection °³¼ö¸¦ ´Ã¸®Áö ¾Ê°í ÃÖÀûÀÇ ½Ã½ºÅÛ È¯°æÀ» ±¸ÃàÇϴµ¥ µµ¿òÀ» ÁÙ ¼ö ÀÖ½À´Ï´Ù.
ÀûÀýÇÑ maxWait °ªÀ̶õ?
TomcatÀº thread ±â¹ÝÀ¸·Î µ¿ÀÛÇØ »ç¿ëÀÚÀÇ ¿äûÀ» ó¸®ÇÕ´Ï. Tomcat DBCP°¡ connection poolÀ» °¡Áö°í ÀÖ´Â °Íó·³ tomcatµµ ³»ºÎ¿¡ thread poolÀ» °¡Áö°í ÀÖ¾î ¾Æ·¡¿Í °°ÀÌ »ç¿ëÀÚÀÇ ¿äûÀÌ µé¾î¿Ã ¶§¸¶´Ù tomcatÀÇ thread pool¿¡¼ thread¸¦ Çϳª¾¿ ²¨³» ¿äûÀ» ó¸®ÇÕ´Ï´Ù.
À§ ±×¸²°ú °°ÀÌ Tomcat DBCPÀÇ connection poolÀ» ¸ðµÎ »ç¿ëÇÏ°í ÀÖÀ¸¸é, ±× ¿ÜÀÇ ¿äûÀº maxWait
½Ã°£¸¸Å ±â´Ù¸®°Ô µÇ¸ç ±â´Ù¸®´Â ÁÖü´Â tomcatÀÇ threadÀÔ´Ï´Ù. tomcatÀÌ »ç¿ëÀÚ ¿¬°áÀ» ó¸®ÇÏ´Â ÃÖ´ë thread °³¼ö´Â server.xml ³» maxThread
¼Ó¼ºÀ¸·Î ÁöÁ¤ÇÕ´Ï´Ù.
¸¸¾à, maxWait
À» 10,000ms·Î ¼³Á¤ÇÑ´Ù¸é DBCP connection poolÀ» ¾òÁö ¸øÇÑ ¿äûÀÇ thread´Â 10Ãʵ¿¾È ´ë±âÇÏ°Ô µË´Ï´Ù. ÀÌ·¯ÇÑ ¿äûÀÌ °è¼Ó Áõ°¡ÇÑ´Ù¸é °á±¹ tomcatÀÇ thread°¡ ¸ðµÎ DBCP connectionÀ» ¾ò±â À§ÇØ ´ë±âÇÏ°Ô µÉ ¼ö ÀÖ½À´Ï´Ù. ÀÌ·² ¶§´Â ¾Æ·¡¿Í °°Àº ¿À·ù¸¦ ¸¶ÁÖÇÏ°Ô µË´Ï´Ù.
½É°¢: All threads (80) are currently busy, waiting. Increase maxThreads (80) or check the servlet status
ÀÌ ¿À·ù ÀÌÈÄ, ´ë±âÇÏ´ø thread°¡ DBCP connectionÀ» ¾ò¾î »ç¿ëÀÚ ¿äûÀ» ó¸®ÇÏ°í ÀÀ´äÀ» º¸³½´Ù°í ÇÒÁö¶óµµ ÀÌ¹Ì »ç¿ëÀÚ´Â ¶°³µÀ» ¼ö ÀÖ½À´Ï´Ù. ÀϹÝÀûÀ¸·Î, ¼±Âø¼ø À̺¥Æ® Ŭ¸¯ÀÌ ¾Æ´Ñ ÀÌ»ó Ŭ¸¯ ÈÄ ¾ó¸¶ ±â´Ù¸®Áö ¾Ê°í »ç¿ëÀÚ´Â ÆäÀÌÁö »õ·Î °íħÀ» ÁøÇàÇϰųª ´Ù¸¥ ÆäÀÌÁö·Î À̵¿ÇÕ´Ï´Ù. Áï, ±â´Ù¸®´Â »ç¶÷µµ ¾ø´Â ¿äû¿¡ ÀÀ´äÇϱâ À§ÇØ ¸®¼Ò½º¸¦ ³¶ºñÇÑ °ÍÀÌ µË´Ï´Ù.
- »ç¿ëÀÚ°¡ Àγ»ÇÒ ¼ö ÀÖ´Â ½Ã°£À» ³Ñ¾î¼´Â
maxWait
°ªÀº Àǹ̰¡ ¾ø½À´Ï´Ù.
±×·¸´Ù°í maxWait
°ªÀ» ³Ê¹« ÀÛ°Ô ¼³Á¤Çϸé TimeOutÀÌ ³Ê¹« ¸¹ÀÌ ¹ß»ýÇÏ°Ô µÇ¾î »ç¿ëÀÚ¿¡°Ô ¿À·ù ¸Þ½ÃÁö¸¦ ÀÚÁÖ º¸ÀÌ°Ô µË´Ï´Ù. µû¶ó¼ maxWait °ªÀº »ç¿ëÀÚÀÇ ´ë±â °¡´ÉÇÑ ½Ã°£°ú °°Àº ¾îÇø®ÄÉÀ̼ÇÀÇ Æ¯¼º°ú ´Ù¸¥ ÁÖº¯ÀÇ ¼³Á¤, ÀÚ¿øÀÇ »óȲ µîÀ» °í·ÁÇØ ÆÇ´ÜÇØ¾ß ÇÕ´Ï´Ù.
¸¸¾à °©ÀÛ½º·´°Ô »ç¿ëÀÚ°¡ Áõ°¡ÇØ maxWait
°ª ¾È¿¡ connectionÀ» ¾òÁö ¸øÇÏ´Â ºóµµ°¡ ´Ã¾î³´Ù¸é maxWait
°ªÀ» ÁÙ¿© tomcat thread Çѵµ¿¡ µµ´ÞÇÏÁö ¾Êµµ·Ï ¹æ¾îÇÒ ¼ö ÀÖ½À´Ï´Ù. ÀÌ·¸°Ô µÇ¸é Àüü ½Ã½ºÅÛ Àå¾Ö´Â ÇÇÇÏ°í °£ÇæÀû ¿À·ù°¡ ¹ß»ýÇÏ´Â Á¤µµ·Î Àå¾Ö ¿µÇâµµ¸¦ ÁÙÀÏ ¼ö ÀÖ½À´Ï´Ù. ´Ù¸¸, ÀÌ·¯ÇÑ »óȲÀÌ ÀÚÁÖ ¹ß»ýÇÑ´Ù¸é DBCPÀÇ maxActive
¿Í TomcatÀÇ maxThread
°ªÀ» µ¿½Ã¿¡ ´Ã¸®´Â °ÍÀ» °í·ÁÇØ¾ß ÇÕ´Ï´Ù. ÇÏÁö¸¸, ½Ã½ºÅÛ ÀÚ¿øÀÇ Çѵµ¸¦ ³Ñ´Â ¿äûÀ̶ó¸é ¼³Á¤À» ¾î¶»°Ô ÇÏ´ø Àå¾Ö¸¦ ÇÇÇÒ ¼ö ¾ø½À´Ï´Ù. ÀÌ ¶§¿¡´Â ½Ã½ºÅÛÀ» ´Ã¸®´Â ¹æÇâÀ¸·Î ÁøÇàÇØ¾ß ÇÕ´Ï´Ù.
connectionÀÇ °Ë»ç(validate)¿Í Á¤¸®(evictor)
validationQuery
¼³Á¤°ú Evictor ½º·¹µå
°ü·Ã ¼³Á¤À» ÅëÇØ ¾îÇø®ÄÉÀ̼ÇÀÇ ¾ÈÁ¤¼ºÀ» ³ôÀÏ ¼ö ÀÖ½À´Ï´Ù.
¼Ó¼º À̸§ | ¼³¸í |
---|---|
testWhileIdle | evictor ½º·¹µå°¡ ½ÇÇàµÉ ¶§ connection pool ¾È¿¡ ÀÖ´Â À¯ÈÞ »óÅÂÀÇ connectionÀ» ´ë»óÀ¸·Î Å×½ºÆ® ½ÇÇà(default: false) |
testOnReturn | connectionÀ» ¹ÝȯÇÒ ¶§ Å×½ºÆ®(°ËÁõ) ½ÇÇà(default: false) |
timeBetweenEvictionRunsMillis | Evictor ½º·¹µå°¡ µ¿ÀÛÇÏ´Â °£°ÝÀ̸ç, 1000msº¸´Ù ÀÛÀº °ªÀ» ¼³Á¤ÇÒ ¼ö ¾øÀ½(default: 5000ms) |
minEvictableIdleTimeMillis | Evictor ½º·¹µå µ¿ÀÛ ½Ã connectionÀÇ À¯ÈÞ ½Ã°£À» È®ÀÎÇØ ¼³Á¤°ª ÀÌ»óÀÏ °æ¿ì connection Á¦°Å(default: 60000ms) |
validationQuery | À¯È¿¼º °Ë»ç Äõ¸®·Î, DBMS Á¾·ù¿¡ µû¶ó ÁÖ·Î ¾Æ·¡¿Í °°ÀÌ »ç¿ë [ Oracle ] select 1 from dual [ Microsoft SQL Server ] select 1 [ MySQL ] select 1 |
validationInterval | connection °ËÁõ ½Ã, ¼³Á¤°ª À̳»·Î ±âÁ¸¿¡ Å×½ºÆ®ÇÑ ÀÌ·ÂÀÌ ÀÖÀ¸¸é ´Ù½Ã °ËÁõÇÏÁö ¾ÊÀ½(default: 3000ms) |
testOnBorrow | connection pool¿¡¼ connectionÀ» ¾ò¾î¿Ã ¶§ Å×½ºÆ®(°ËÁõ) ½ÇÇà(default: false) |
°ËÁõ¿¡ Áö³ªÄ¡°Ô ÀÚ¿øÀ» ¼Ò¸ðÇÏÁö ¾Êµµ·Ï ¸ðµç °ËÁõ ¼Ó¼ºÀ» true
·Î ÇÏ´Â °ÍÀº ±ÇÀåÇÏÁö ¾Ê½À´Ï´Ù. ´Ù¸¸ testWhileIdle
¿É¼ÇÀº true
·Î ¼³Á¤ÇÏ¿© ¿À·§µ¿¾È ´ë±â »óÅÂ(À¯ÈÞ »óÅÂ)¿´´ø connectionÀÌ ²÷±â´Â °ÍÀ» ¸·´Â °ÍÀÌ ÁÁ½À´Ï´Ù.
Evictor ½º·¹µå
´Â DBCP ³»ºÎ¿¡¼ connection ÀÚ¿øÀ» Á¤¸®ÇÏ´Â ±¸¼º ¿ä¼Ò·Î º°µµÀÇ thread·Î ½ÇÇàµË´Ï´Ù. Evictor ½º·¹µåÀÇ ¿ªÇÒÀº ´ÙÀ½°ú °°½À´Ï´Ù.
- connection pool ³»ÀÇ À¯ÈÞ »óÅÂÀÇ connection Áß ¿À·§µ¿¾È »ç¿ëµÇÁö ¾ÊÀº connection Á¦°Å
testWhileIdle
¼Ó¼ºÀÌ true·Î µÇ¾î ÀÖÀ» °æ¿ì, connection¿¡ ´ëÇØ Ãß°¡·Î À¯È¿¼º °Ë»ç¸¦ ¼öÇàÇÏ¸ç ¹®Á¦°¡ ÀÖ´Ù¸é ÇØ´ç connection Á¦°Å- ¾Õ 2°¡Áö °úÁ¤ ÁøÇà ÈÄ connection ¼ö°¡
minIdle
º¸´Ù Àû´Ù¸éminIdle
Å©±â¸¸Å connectionÀ» »ý¼ºÇØ À¯Áö
Evictor ½º·¹µå
´Â µ¿ÀÛ ½Ã connection pool¿¡ lock
À» °É°í µ¿ÀÛÇϱ⠶§¹®¿¡ ³Ê¹« ÀÚÁÖ µ¿ÀÛÇÏ°Ô µÇ¸é ¼ºñ½º¿¡ ºÎ´ãµÉ ¼ö ÀÖ½À´Ï´Ù. µû¶ó¼ connection À¯È¿¼º °Ë»ç¸¦ À§ÇÑ Å×½ºÆ® ¿É¼Ç(testOnBorrow
, testOnReturn
, testWhileIdle
)°ú Evictor ½º·¹µå
°ü·Ã ¿É¼ÇÀº DBA¿Í »óÀÇÇÏ¿© ÃÖÀû鵃 ¼ö ÀÖ´Â ¿É¼ÇÀ» ¼³Á¤ÇØ¾ß ÇÕ´Ï´Ù.
Âü°í ÀÚ·á
'OPEN SOURCE > TOMCAT' Ä«Å×°í¸®ÀÇ ´Ù¸¥ ±Û
[TOMCAT] mySQL ¿¬µ¿ ¿¡·¯(WARNING: Unexpected exception resolving reference) (0) | 2021.02.01 |
---|---|
[TOMCAT] MySQL datasourceÀÇ url ³» property ¿©·¯°³ ¼³Á¤ (0) | 2021.02.01 |