Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the jedis configuration?

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "what is the configuration of jedis". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Jedis is a redis client based on java language, which integrates the command operation of redis and provides connection pool management.

Jedis connection pool

Generate a batch of jedis connection objects in advance and put them in the connection pool, borrow jedis objects from the connection pool when you need to operate on redis, and return them 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 reasonable use of connection pool is very important, if it is not set up properly, it will cause a lot of unnecessary trouble and easily cause online failures.

In fact, about the configuration is a difficult or there is no definite answer to the part, here can only give some ideas and solutions to some exceptions.

Connection pool important configuration

For ease of use, Jedis provides JedisPoolConfig, which inherits some idle monitoring settings set by GenericObjectPoolConfig

# maximum number of active objects

Redis.pool.maxTotal=1000

# the maximum number of objects that can remain in idel state

Redis.pool.maxIdle=100

# the minimum number of objects that can maintain the idel state

Redis.pool.minIdle=50

# maximum waiting time when no object is returned in the pool

Redis.pool.maxWaitMillis=10000

# whether to check the validity when calling the borrow Object method

Redis.pool.testOnBorrow=true

# whether to check the validity when calling the return Object method

Redis.pool.testOnReturn=true

# "idle link" detection thread, detection period, milliseconds. If it is a negative value, the detect thread is not running. The default is-1.

Redis.pool.timeBetweenEvictionRunsMillis=30000

# whether to detect an idle timeout when outputting a "link" object to the caller

Redis.pool.testWhileIdle=true

# for the Idle Link detection thread, the number of link resources detected at a time. The default is 3.

Redis.pool.numTestsPerEvictionRun=50

# IP of redis server

Redis.ip=xxxxxx

# Port of redis server

Redis1.port=6379

This is the end of the content of "what is the jedis configuration?" Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report