-
Notifications
You must be signed in to change notification settings - Fork 591
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
fix(redis): mitigate JedisPool depletion #419
Conversation
Fixes redis interactions in RedisPermissionRepository that can result in depleting the redis pool. Specifically: * converts smembers calls to sscan calls, and gets/returns an object from the pool to do so. * removes nested calls to redisClientDelegate that were holding on to pool objects * partitions lookup of users into smaller batches * partitions role lookup Additionally, uses InstrumentedJedisPool to enable metrics collection on redis interactions.
return new InstrumentedJedisPool( | ||
registry, | ||
new JedisPool(redisPoolConfig, host, port, timeout, password, database, null), | ||
"fiat"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made this generic (I should deprecate InstrumentedJedisPool
): https://github.com/spinnaker/kork/blob/master/kork-telemetry/src/main/java/com/netflix/spinnaker/kork/telemetry/InstrumentedProxy.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pending spinnaker/kork#313
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually scratch that, InstrumentedProxy doesn't work here (it would just instrument the pool methods not the pooled object itself)
}); | ||
} catch (Exception e) { | ||
log.error("Storage exception reading " + id + " entry.", e); | ||
} | ||
} | ||
|
||
private Set<String> scanSet(String key) { | ||
final Set<String> results = new HashSet<>(); | ||
final AtomicReference<String> cursor = new AtomicReference<>(ScanParams.SCAN_POINTER_START); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
* chore(dependencies): gradle 5.4.1 * fix(redis): mitigate JedisPool depletion Fixes redis interactions in RedisPermissionRepository that can result in depleting the redis pool. Specifically: * converts smembers calls to sscan calls, and gets/returns an object from the pool to do so. * removes nested calls to redisClientDelegate that were holding on to pool objects * partitions lookup of users into smaller batches * partitions role lookup Additionally, uses InstrumentedJedisPool to enable metrics collection on redis interactions.
Fixes redis interactions in RedisPermissionRepository that can result in
depleting the redis pool.
Specifically:
from the pool to do so.
to pool objects
Additionally, uses InstrumentedJedisPool to enable metrics collection
on redis interactions.