Tomcat Connection Pool Configuration detailed

Source: Internet
Author: User

<bean class= "Org.apache.tomcat.jdbc.pool.PoolProperties" >
<property name= "url" value= "${jdbcurl}"/>
<!--database-driven
<property name= "Driverclassname" value= "Com.mysql.jdbc.Driver"/>
<!--user name--
<property name= "username" value= "MySQL"/>
<!--password--
<property name= "Password" value= "123456"/>
<!--registration Pool JMX, default:true-->
<property name= "jmxenabled" value= "false"/>
<!--Check the time interval of the connection, in milliseconds--
<property name= "Validationinterval" value= "30000"/>
<!--Specifies whether the connection enters an idle state through the validation of the Idle object eviction process, and if the checksum fails, the connection is disconnected by the connection pool
A value of true, the Validationquery parameter must be a non-empty string---->
<property name= "Testwhileidle" value= "false"/>
<!--Specifies whether the connection is validated when it is returned to the pool
A value of true, the Validationquery parameter must be a non-empty string---->
<property name= "Testonreturn" value= "false"/>
<!--Specifies whether the connection is checked if it is called, if the checksum fails, the connection is disconnected by the connection pool and the connection pool attempts to invoke another connection
A value of true, the Validationquery parameter must be a non-empty string--
<property name= "Testonborrow" value= "true"/>
<!--an SQL statement used to verify that a connection is valid before it is returned to the caller, and if an SQL statement is specified, it must be a SELECT statement with at least one row of results--
<property name= "Validationquery" value= "Select 1"/>
<!--the maximum number of database connections that the connection pool is active, 0 means no limit, which means maximum concurrency--
<property name= "maxactive" value= "/>"
<!--initialize the number of connections--
<property name= "InitialSize" value= "ten"/>
<!--when the connection pool is exhausted, the new request waits (that is, waits for another connection to be idle), and the timeout returns an exception, in milliseconds--
<property name= "maxwait" value= "100000"/>
<!--a numeric value in milliseconds that the eviction process of the idle object goes into a running state by a dormant state, indicating that no idle objects are running when the eviction process
Run the time interval to determine the connection timeout task--
<property name= "Timebetweenevictionrunsmillis" value= "30000"/>
<!--the minimum time, in milliseconds, for a connection to remain idle in the pool before the eviction process is evicted by the idle object, the time-out of the connection, and the default is half an hour--
<property name= "Minevictableidletimemillis" value= "30000"/>
<!--connection Pool Check the number of objects for each free object eviction process
<property name= "Numtestperevictionrun" value= "3"/>
-
<!--the minimum number of database connections that the connection pool is idle, below this value will create the missing connection, set 0 unlimited--
<property name= "Minidle" value= "ten"/>
<!--the maximum number of database connections in which the connection pool is idle, and the non-positive integer representation is unrestricted, excess idle connections will be released when this value is exceeded
<property name= "Maxidle" value= "/>"
<!--whether to record clear information in the log when an invalid connection is cleared--
<property name= "logabandoned" value= "false"/>
<!--whether to clear an invalid connection that has exceeded the Removeabandonedtimeout setting and automatically reclaim the timeout connection
Startup mechanism: Getnumactive () > Getmaxactive ()-3 and Getnumidle () < 2
Assuming maxactive=20, while the current 18 active connections, 1 idle connections, the mechanism will start
But only if the active connection is not used longer than "Removeabandonedtimeout" (the default is 300 seconds), the connection will be cleared--
<property name= "removeabandoned" value= "true"/>
<!--seconds to clear invalid connections, self-interrupt time, per second--
<property name= "removeabandonedtimeout" value= "/>"
<!--set Interceptor, default is empty
ConnectionState: Track autocommit, read-only directory, and transaction isolation level
Statementfinalizer: Tracing open Statements and closing connections when returning to the pool
-
<property name= "jdbcinterceptors" value= "Org.apache.tomcat.jdbc.pool.interceptor.connectionstate;o Rg.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer "/>
</bean>

Tomcat Connection Pool Configuration detailed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.