Definition of jedis configuration

  • 2020-11-03 22:39:24
  • OfStack

jedis is an redis client based on java language, which integrates redis command operation and provides connection pool management.

jedis connection pool

A batch of jedis connection objects is generated in advance and placed in the connection pool. jedis objects are borrowed from the connection pool when redis needs to be operated on, and returned after the operation is completed. In this way, jedis objects can be reused, avoiding frequent creation of socket connections and saving connection overhead.

Jedis configuration optimization

For enterprise development, the rational use of connection pool is very important, if not set up will cause a lot of unnecessary trouble, easy to cause on-line failure.
In fact, configuration is a difficult or not certain answer, here can only give some ideas and solutions to 1 exception.

Connection pooling important configuration

For ease of use, Jedis provides JedisPoolConfig, which itself inherits GenericObjectPoolConfig Settings with 1 idle monitoring Settings

[

# Maximum number of active objects
redis.pool.maxTotal=1000
# Maximum number of objects that can maintain idel state
redis.pool.maxIdle=100
Minimum number of objects that can maintain idel state
redis.pool.minIdle=50
Maximum wait time when no objects are returned from the pool
redis.pool.maxWaitMillis=10000
# Whether validity checks are performed when the borrow Object method is called
redis.pool.testOnBorrow=true
# Whether validity checks are performed when the return Object method is called
redis.pool.testOnReturn=true
# "Free link" detects thread, period of detection, number of milliseconds. If it is negative, it means that the detection thread is not running. The default is 1.
redis.pool.timeBetweenEvictionRunsMillis=30000
Whether to detect the idle timeout of the "linked" object when it outputs it to the caller;
redis.pool.testWhileIdle=true
# The number of linked resources per check for a free link detection thread. The default is 3.
redis.pool.numTestsPerEvictionRun=50
#redis server IP
redis.ip=xxxxxx
# Port for redis server
redis1.port=6379

]

The above is a detailed explanation of the meaning of jedis configuration. For more information on the meaning of jedis configuration, please pay attention to other related articles on this site!


Related articles: