Definition of jedis configuration
- 2020-11-03 22:39:24
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
# Maximum number of objects that can maintain idel state
Minimum number of objects that can maintain idel state
Maximum wait time when no objects are returned from the pool
# Whether validity checks are performed when the borrow Object method is called
# Whether validity checks are performed when the return Object method is called
# "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.
Whether to detect the idle timeout of the "linked" object when it outputs it to the caller;
# The number of linked resources per check for a free link detection thread. The default is 3.
#redis server IP
# Port for redis server
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!