-
Notifications
You must be signed in to change notification settings - Fork 119
concord-server: inject ProcessKeyCache interface instead of implementation to utilize singleton scope #1247
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
Conversation
|
This may be a just a piece of a larger oversight. Or I may be missing a point. Should all implementations of |
interesting.... with @singleton annotation: without: |
|
looks like problem here: Line 59 in bfcadfd
we should not inject implementation. so fix is: and there is also: ProcessKeyCacheGaugeModule :) |
|
Ahh, unfortunate class name collision. Also fixes the metric |
ibodrov
left a comment
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.
Minor comment, otherwise LGTM. Needs a better title?
| import com.walmartlabs.concord.server.process.logs.ProcessLogManager; | ||
| import com.walmartlabs.concord.server.sdk.PartialProcessKey; | ||
| import com.walmartlabs.concord.server.sdk.ProcessKey; | ||
| import com.walmartlabs.concord.server.sdk.ProcessKeyCache; |
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.
What for?
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.
The interface and implementation have the same class name ProcessKeyCache. And the implementation is in the server.queue package, so without importing either class, guice defaults to the implementation--which isn't configured as a singleton. The interface is explicitly bound in singleton scope.
A nosy heap dump reveals we end up with 145 instances of
ProcessKeyCacheand 70+ instances ofProcessQueueManager.Some are more used than others, but there's duplicate entries across the instances so there's duplicated lookups (unnecessary db traffic).
Annotating as
@Singletonbrings that down to 1 each, as one would expect. This should result in fewer calls to the DB and less memory usage by the cached data over all.