Maxwait When the connection pool is exhausted, new request wait time, milliseconds
Timebetweenevictionrunsmillis Timebetweenevictionrunsmillis and Minevictableidletimemillis are used together, each
Timebetweenevictionrunsmillis milliseconds to check for idle connections in the connection pool, disconnecting connections that have been idle for more than minevictableidletimemillis milliseconds until the number of connections in the connection pool is Minidle
Minevictableidletimemillis connections in the connection pool can be idle time, milliseconds
Removeabandoned True,false, whether to clean up active connections that are not used by removeabandonedtimeout seconds, and not put back to the connection pool after cleanup
Removeabandonedtimeout maximum idle time for active connections
Logabandoned True,false, whether a message is printed when the connection pool reclaims an idle active connection
Minevictableidletimemillis,removeabandonedtimeout These two parameters are different for connection objects, Minevictableidletimemillis for connection objects in the connection pool. The removeabandonedtimeout is connected to an activity that is not close.
In the configuration, the main difficult to understand mainly are: removeabandoned, logabandoned, Removeabandonedtimeout, maxwait four parameters, set the rmoveabandoned= True Then when the Getnumactive () is near Getmaxactive (), the system will make an invalid connection recycle, connection is removeabandonedtimeout (default 300 seconds) Connection is not used after the number of seconds set in, the activation recycle mechanism appears to be getnumactive () =getmaxactive ()-2. :) Logabandoned=true, it will print out the error message in log after the event is recycled, including where to use the connection but forget to close it, which is useful when debugging.
Here private advice maxwait time do not set too long, maxwait if the setting is too long then the client will wait long to fire the recycling event
http://blog.csdn.net/feiyu8607/article/details/6551991
Validationquery
DBCP provides the Validationquery parameter for the pre-detection of connections, it will be in the process of interacting with the connection pool to add some hooks, fixed-point execution validationquery The specified SQL statement, if the SQL statement succeeds, indicating that the connection is valid, assigned to the application, If the execution fails, the connection is discarded, and this method can also address the problem of MySQL connection failure caused by problems such as network failure. Other methods, such as idle connection detection, optimistic access to connections, are not guaranteed to be completely transparent to the application, or the database operation can be perceived as failed.
Minevictableidletimemillis
Connection pool connection, idle for time period, time to be evicted from connection pool
Timebetweenevictionrunsmillis
When constructing Genericobjectpool [Basicdatasource also uses Genericobjectpool] in its CreateDataSource () method, an inline class evictor is generated, Implement the self-runnable interface. If Timebetweenevictionrunsmillis is greater than 0, every timebetweenevictionrunsmillis milliseconds Evictor calls the evict () method to check if the connection in the connection pool is idle longer than Minevictableidletimemillis milliseconds (_minevictableidletimemillis is less than or equal to 0 o'clock is ignored, default is 30 minutes), is the object is destroyed, Then call the Ensureminidle method to check to make sure that the number of objects in the pool is not less than _minidle. If the number of connections to the connection pool is less than the minimum number of idle connections, the database connection is created and the connection pool is checked for less than maxidle, so the connection that you just created is placed in the connection pool, otherwise the object is destroyed.
http://blog.csdn.net/qyy333/article/details/17920051
https://github.com/xetorthio/jedis/issues/937
How Redis configures the Jedispool parameter
jedispool configuration parameters depend heavily on the actual application requirements, hardware and software capabilities, Jedispool configuration parameters are mostly assigned by jedispoolconfig corresponding items. maxactive: Controls how many Jedis instances can be allocated by a pool, obtained through Pool.getresource (), or if the assignment is 1, which means no limit, or if the pool has already allocated maxactive Jedis instances, At this point the state of the pool becomes exhausted, in Jedispoolconfigmaxidle: control how many Jedis instances of a pool have a state of idle Whenexhaustedaction: Indicates what the pool is going to do when the Jedis instance in the pool is allocated, and there are three types of when_exhausted_fail by default, indicating that there are no Jedis instances. Throw nosuchelementexception directly), When_exhausted_block (either to block or to maxwait when Jedisconnectionexception is thrown), when_exhausted _grow (that is, a new Jedis instance is said to be set maxactive useless); Maxwait: Represents the maximum wait time when borrow a Jedis instance, if the wait time is exceeded, The Jedisconnectionexception;testonborrow is thrown directly: whether Alidate operations are performed in advance when a Jedis instance is borrow, and if true, the resulting Jedis instances are available Testonreturn: Whether validate operation is performed in advance when return to pool, Testwhileidle: If true, there is an idle object Evitor thread that scans the idle object. If the validate fails, the object is dropped from the pool, which makes sense only if the Timebetweenevictionrunsmillis is greater than 0 ; Timebetweenevictionrunsmillis: Indicates the number of milliseconds to sleep between idle object Evitor two scans; Numtestsperevictionrun: Represents the Idle object Evitor the maximum number of objects per scan; Minevictableidletimemillis: Represents aThe minimum time that an object stays in the idle state before it can be scanned and evicted by the Idle object evitor. This is only meaningful if the Timebetweenevictionrunsmillis is greater than 0 Softminevictableidletimemillis: On the basis of minevictableidletimemillis, at least minidle objects have been added to the pool. If the -1,evicted does not expel any objects according to the idle time. If minevictableidletimemillis>0, this setting is meaningless and only makes sense if Timebetweenevictionrunsmillis is greater than 0; When Lifo:borrowobject returns an object, Is the Default_lifo (last on first out, the most frequently used queue similar to cache), or false to indicate a FIFO queue; Where Jedispoolconfig the default settings for some parameters are as follows: testwhileidle=trueminevictableidletimemills=60000timebetweenevictionrunsmillis= 30000numtestsperevictionrun=-1
Http://www.2cto.com/database/201311/254449.html
How Redis configures the Jedispool parameter