Redis's configuration parameters for jedisPool parameters depend heavily on actual application requirements and hardware and software capabilities. Most of the configuration parameters for JedisPool are assigned values by the corresponding items of JedisPoolConfig. MaxActive: controls how many jedis instances can be allocated to a pool, which can be obtained through pool. getResource (). If the value is
Redis's configuration parameters for jedisPool parameters depend heavily on actual application requirements and hardware and software capabilities. Most of the configuration parameters for JedisPool are assigned values by the corresponding items of JedisPoolConfig. MaxActive: controls how many jedis instances can be allocated to a pool, which can be obtained through pool. getResource (). If the value is
How to configure jedisPool parameters for redis
The configuration parameters of JedisPool depend heavily on actual application requirements and hardware and software capabilities. Most of the configuration parameters of JedisPool are assigned values by the corresponding items of JedisPoolConfig.
MaxActive: controls how many jedis instances can be allocated to a pool. getResource () is obtained. If the value is-1, there is no limit. If maxActive jedis instances have been allocated to the pool, the pool status is exhausted.
MaxIdle: controls the maximum number of idle jedis instances in a pool;
WhenExhaustedAction: indicates the action to be taken by the pool when all jedis instances in the pool are completed by allocated. Three default actions are available: WHEN_EXHAUSTED_FAIL (indicating that NoSuchElementException is thrown directly when no jedis instance is), WHEN_EXHAUSTED_BLOCK (it indicates blocking, or throw JedisConnectionException when it reaches maxWait), WHEN_EXHAUSTED_GROW (it indicates creating a jedis instance, that is, setting maxActive is useless );
MaxWait: indicates the maximum waiting time when a jedis instance is borrow. If the waiting time is exceeded, A JedisConnectionException is thrown;
TestOnBorrow: Indicates whether to perform the alidate operation in advance when a jedis instance is located in borrow. If it is set to true, the jedis instance is available;
TestOnReturn: whether to perform the validate operation in advance when returning to the pool;
TestWhileIdle: true indicates that an idle object evitor thread scans idle objects. If validate fails, this object will be dropped from the pool; this item is valid only when timeBetweenEvictionRunsMillis is greater than 0;
TimeBetweenEvictionRunsMillis: the number of milliseconds to sleep between two idle object evitor scans;
NumTestsPerEvictionRun: Maximum number of objects scanned by idle object evitor;
MinEvictableIdleTimeMillis: indicates the shortest time that an object stays in the idle State at least before it can be scanned and evicted by the idle object evitor. this parameter is valid only when timeBetweenEvictionRunsMillis is greater than 0;
SoftMinEvictableIdleTimeMillis: Based on minEvictableIdleTimeMillis, at least minIdle objects are added to the pool. If it is-1, evicted will not evicted any object based on idle time. If minEvictableIdleTimeMillis> 0, this setting is meaningless and makes sense only when timeBetweenEvictionRunsMillis is greater than 0;
Lifo: When borrowObject returns an object, it uses DEFAULT_LIFO (last in first out, which is similar to the most frequently used queue of cache). If it is False, it indicates a FIFO queue;
JedisPoolConfig has the following default settings for some parameters:
TestWhileIdle = true
MinEvictableIdleTimeMills = 60000
TimeBetweenEvictionRunsMillis = 30000
NumTestsPerEvictionRun =-1