Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose method to warm connection pool from JedisPool #1828 #2064

Closed

Conversation

tmack8001
Copy link

I decided to expose a public method on the AbstractJedisPool to allow users to then explicitly warm their JedisPool after creation instead of adding yet another parameter to the already overwritten set of constructors for the JedisPool. This method wraps the call to the internal pool catching exceptions and logging the underlying error that occurred.

Example usage would be the following:

JedisPool jedisPool = new JedisPool(new URI("localhost:6380"));
jedisPool.preparePool(); // explicit warming of the internal connection pool for Jedis

The logic within preparePool is standard within the GenericObjectPool implementation to make sure that there is always a minimum of minIdle connections available within the pool. This helps in high throughput applications as then the cost of creating connections are done before hand vs upon demand/use.

@tmack8001 tmack8001 force-pushed the tmack/gh-1828-warm-internal-pool branch from 34109fd to 5899863 Compare September 18, 2019 16:12
@tmack8001 tmack8001 changed the title Expose method to warm connection pool from JedisPool gh-1828 Expose method to warm connection pool from JedisPool #1828 Sep 18, 2019
@tmack8001
Copy link
Author

Not sure of the failure, but will try to investigate why the following test failed.

Failed tests: 
  JedisSentinelPoolTest.ensureSafeTwiceFailover:95->forceFailover:190 expected:<[foobared]> but was:<[1b58ee375b42e41f0e48ef2ff27d10a5b1f6924a9acdcdba7cae868e7adce6bf]>

@sazzad16 sazzad16 added this to the 3.2.0 milestone Oct 27, 2019
@gkorland gkorland modified the milestones: 3.2.0, 3.3.0 Nov 25, 2019
@tmack8001 tmack8001 force-pushed the tmack/gh-1828-warm-internal-pool branch from 8cf4ab6 to 7640c3b Compare February 19, 2020 16:16
@sazzad16 sazzad16 requested review from sazzad16 and removed request for sazzad16 February 19, 2020 17:04
@sazzad16 sazzad16 requested a review from gkorland March 14, 2020 08:17
sazzad16
sazzad16 previously approved these changes Mar 15, 2020
@sazzad16 sazzad16 requested a review from gkorland March 16, 2020 05:59
@sazzad16 sazzad16 modified the milestones: 3.3.0, 3.4.0 Apr 26, 2020
public void prepareInternalPool() {
try {
this.internalPool.preparePool();
} catch (Exception e) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we hiding the exception and not throwing it back to the client?

@sazzad16 sazzad16 modified the milestones: 3.4.0, 3.5.0 Dec 7, 2020
@sazzad16 sazzad16 modified the milestones: 3.5.0, 3.6.0 Jan 19, 2021
@sazzad16 sazzad16 modified the milestones: 3.6.0, 3.7.0 Mar 18, 2021
@sazzad16 sazzad16 removed this from the 3.7.0 milestone Aug 25, 2021
@sazzad16 sazzad16 added this to the 4.0.0 milestone Dec 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants