druidÅþÁ¬³Ø²ÎÊýÔõôÉèÖÃ
druid ÅþÁ¬³Ø²ÎÊýÉèÖÃÈçÏ£ºÅþÁ¬³Ø´óС£ºmaxidle=8£¬minidle=0ÅþÁ¬³¬Ê±ºÍÖØÊÔ£ºconnectiontimeout=30000£¬connectionretryattempts=3¸ºÔØƽºâ£ºloadbalancingpolicy=roundrobin£¨Ä¬ÈÏ£©¼à¿Ø£ºusestats=false£¬statsperiod=300000¸ß¼¶²ÎÊý£ºvalidationquery=select 1£¬testwhileidle=false£¬checkconnectionwhileidletim
Druid ÅþÁ¬³Ø²ÎÊýÉèÖÃ
Druid ÅþÁ¬³ØÊÇÒ»¸ö¸ßÐÔÄܵÄÅþÁ¬³Ø£¬ÓÃÓÚÖÎÀíÓëÊý¾Ý¿âµÄÅþÁ¬¡£ÉèÖÃÆä²ÎÊý¹ØÓÚÓÅ»¯Êý¾Ý¿âÐÔÄܺÜÊÇÖ÷Òª¡£ÒÔÏÂÊÇÔõÑùÉèÖà Druid ÅþÁ¬³Ø²ÎÊý£º
1. ÅþÁ¬³Ø¾Þϸ
- maxIdle£º³ØÖÐÔÊÐíµÄ×î´óÏÐÖÃÅþÁ¬Êý¡£Ä¬ÈÏֵΪ 8¡£
- minIdle£º³ØÖÐÔÊÐíµÄ×îСÏÐÖÃÅþÁ¬Êý¡£Ä¬ÈÏֵΪ 0¡£
2. ÅþÁ¬³¬Ê±ºÍÖØÊÔ
- connectionTimeout£ºÅþÁ¬Êý¾Ý¿âµÄ³¬Ê±Ê±¼ä£¨ÒÔºÁÃëΪµ¥Î»£©¡£Ä¬ÈÏֵΪ 30000¡£
- connectionRetryAttempts£ºÔÚ½¨ÉèÅþÁ¬Ê§°ÜºóÖØÊԵĴÎÊý¡£Ä¬ÈÏֵΪ 3¡£
3. ¸ºÔØƽºâ
- loadBalancingPolicy£ºÓÃÓÚÔÚ¿ÉÓÃÅþÁ¬Ö®¼ä·ÖÅÉÅÌÎʵĸºÔØƽºâÕ½ÂÔ¡£Ä¬ÈÏֵΪ “RoundRobin”¡£ÆäËûÑ¡Ïî°üÀ¨ “Random”¡¢”Weighted” ºÍ “LeastActive”¡£
4. ¼à¿Ø
- useStats£ºÊÇ·ñÍøÂçÓйØÅþÁ¬³ØʹÓÃÇéÐεÄͳ¼ÆÐÅÏ¢¡£Ä¬ÈÏֵΪ false¡£
- statsPeriod£ºÍøÂçͳ¼ÆÐÅÏ¢µÄƵÂÊ£¨ÒÔºÁÃëΪµ¥Î»£©¡£Ä¬ÈÏֵΪ 300000¡£
5. ÆäËû¸ß¼¶²ÎÊý
- validationQuery£ºÓÃÓÚÑéÖ¤ÅþÁ¬ÊÇ·ñÓÐÓÃµÄ SQL ÅÌÎÊ¡£Ä¬ÈÏֵΪ “SELECT 1″¡£
- testWhileIdle£ºÊÇ·ñÔÚÅþÁ¬¿ÕÏÐʱ¶ÔÆä¾ÙÐÐÑéÖ¤¡£Ä¬ÈÏֵΪ false¡£
- checkConnectionWhileIdleTimeout£º²âÊÔ¿ÕÏÐÅþÁ¬³¬Ê±Ê±¼ä£¨ÒÔºÁÃëΪµ¥Î»£©¡£Ä¬ÈÏֵΪ 1800000¡£
ʾÀýÉèÖÃ
Ò»¸öʾÀýµÄ Druid ÅþÁ¬³ØÉèÖÃÈçÏ£º
<property><name>druid.connection-pool.max-idle</name><value>10</value></property><property><name>druid.connection-pool.min-idle</name><value>2</value></property><property><name>druid.connection-pool.connection-timeout</name><value>15000</value></property><property><name>druid.connection-pool.connection-retry-attempts</name><value>2</value></property><property><name>druid.connection-pool.load-balancing-policy</name><value>Weighted</value></property><property><name>druid.connection-pool.use-stats</name><value>true</value></property>
µÇ¼ºó¸´ÖÆ
ÒÔÉϾÍÊÇdruidÅþÁ¬³Ø²ÎÊýÔõôÉèÖõÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡
ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í尊龙凯时人生就是博ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ尊龙凯时人生就是博ʵʱÐÞÕý»òɾ³ý¡£