Technical Debt: Cyclic dependency between LoadBalanceStats and ServerStats#470
Open
jbpextra wants to merge 1 commit intoNetflix:masterfrom
Open
Technical Debt: Cyclic dependency between LoadBalanceStats and ServerStats#470jbpextra wants to merge 1 commit intoNetflix:masterfrom
jbpextra wants to merge 1 commit intoNetflix:masterfrom
Conversation
TECHNICAL DEBT: a cyclic dependency between LoadBalancerStats and ServerStats has created a persistent negative impact on developers when working in these classes. Specifically, these classes are very tightly coupled by their shared dynamic configuration attributes. **Changes** REFACTORING: Introduce a new ConfigStats class that encapsulates the configuration attributes shared by LoadBalancerStats and its ServerStats as well as its associated methods. ConfigStats implements the IConfigAware interface. No breaking changes.
Author
|
Hi @carl-mastrangelo , could you have a look at the pull request? Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As explained in #465 , a cyclic dependency between LoadBalancerStats and ServerStats has created a persistent negative impact on developers when working in these classes. We have computed this negative impact to be as high as 12% in some commits, with a persistent effect of an average 4.5%
Specifically, these classes are very tightly coupled by their shared dynamic configuration attributes. The UnboxedIntProperty attributes of both this classes are reference to the same objects. This makes the source code more difficult to maintain and therefore these needs to be encapsulated in its own abstraction.

Changes:
We introduce a new class called ConfigStats that encapsulate these attributes. Its associated methods others have been moved from LoadBalancer to this new class. Instances of both LoadBalancer and ServerStats own a ConfigStats object which they use to access the now encapsulated UnboxedIntProperty using primitive getter/setters. Thus, the underlying dynamic configuration logic is effectively abstracted away and the cyclic dependency is dissolved.
