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

fix(redis): mitigate JedisPool depletion #419

Merged
merged 2 commits into from
Jun 6, 2019
Merged

Conversation

cfieber
Copy link
Contributor

@cfieber cfieber commented Jun 6, 2019

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:
* 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.
@cfieber cfieber requested review from asher and robzienert June 6, 2019 00:14
return new InstrumentedJedisPool(
registry,
new JedisPool(redisPoolConfig, host, port, timeout, password, database, null),
"fiat");
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

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);
Copy link
Member

Choose a reason for hiding this comment

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

💯

@cfieber cfieber merged commit 1d0ef72 into spinnaker:master Jun 6, 2019
@cfieber cfieber deleted the redis branch June 6, 2019 17:06
clanesf pushed a commit to clanesf/fiat that referenced this pull request Jul 12, 2019
* 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants