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
Support dynamic update cache config #13679
Support dynamic update cache config #13679
Conversation
@hangc0276 @michaeljmarshall @merlimat @shoothzj @eolivelli PTAL,thanks! |
/pulsarbot run-failure-checks |
1 similar comment
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
2 similar comments
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
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.
A general comment about this implementation.
Referring everything to the Service Configuration is a waste of resource and we should avoid this especially inside synchonized methods.
I suggest to not evaluate the values of the configuration parameters everything but to try to notify the components that the Configuration changed and to update the current local configuration when such notification happens
/pulsarbot run-failure-checks |
6 similar comments
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
OK I will fix |
The pr had no activity for 30 days, mark with Stale label. |
2a75405
to
a541c4c
Compare
Fixed. |
…Impl and add updateCacheEvictionTimeThreshold for cacheEvictionTimeThresholdNanos
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/ManagedLedgerFactory.java
Outdated
Show resolved
Hide resolved
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.
LGTM
Fixed. |
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.
we are on our way.
I left some minor feedback, last corners to be rounded
/** | ||
* @return time threshold for eviction. | ||
* */ | ||
long getCacheEvictionTimeThresholdNanos(); |
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.
please give a name consistent with updateCacheEvictionTimeThreshold (I would remove "nanos")
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.
Fixed.
PTAL,thanks! @eolivelli
admin.brokers().updateDynamicConfiguration("managedLedgerCacheEvictionTimeThresholdMillis", "2000"); | ||
|
||
// wait config to be updated | ||
for (int i = 0; i < 5; i++) { |
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.
why only "5" ?
please consider using Awaiatility
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.
Fixed.
PTAL,thanks! @eolivelli
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.
LGTM
awesome work
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.
@lordcheng10 - are you able to provide motivation for this PR?
private volatile long maxSize; | ||
private volatile long evictionTriggerThreshold; | ||
private volatile double cacheEvictionWatermark; |
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 am concerned about the cost of this change. These three variables are read each time that a message is written to the cache. While I see the generic benefit of increasing configurability, I don't think we should do so in a way that adds cost (even small costs) to the write path. @lordcheng10 - do you have a use case that shows why the benefits out way the costs here?
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.
@merlimat - do you have any thoughts here? I remember that you have raised concerns about volatile
in the metadatastore.
I know that we are talking about minor optimizations here, but since this is on the write path, I feel it makes sense to discuss now.
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.
do you have a use case that shows why the benefits out way the costs here?
If we need to adjust the cache parameters, we need to restart the online cluster in turn. Restarting the cluster will have a certain impact on online business.
For different business scenarios, we cannot give a more reasonable cache configuration at once. May need to adjust the cache configuration multiple times
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 am concerned about the cost of this change. These three variables are read each time that a message is written to the cache. While I see the generic benefit of increasing configurability, I don't think we should do so in a way that adds cost (even small costs) to the write path.
Do you have some good ideas? Regarding the need to provide a dynamic configuration cache, but also to solve the problems you mentioned.
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.
@lordcheng10 - thanks for the additional context. It would be interesting to see a flame graph for the write path of the broker to identify hot spots. The only reason this PR caught my attention is because of the general heuristic that I've seen @merlimat employ: avoid volatile
when possible. Without actual metrics about performance impact, I think we should leave this PR in place.
(cherry picked from commit b0213b2)
Squash merge branch 'cache_config' into '2.8.1' Fixes #<xyz> ### Motivation --story=872772869 支持cache动态配置(apache#13679) TAPD: --story=872772869
(cherry picked from commit b0213b2)
Squash merge branch 'cache_config' into '2.8.1' Fixes #<xyz> ### Motivation --story=872772869 支持cache动态配置(apache#13679) TAPD: --story=872772869
(cherry picked from commit b0213b2)
Motivation
Support dynamic update cache config :
managedLedgerCacheEvictionTimeThresholdMillis
managedLedgerCacheSizeMB
managedLedgerCacheEvictionWatermark
Documentation
Check the box below or label this PR directly (if you have committer privilege).
Need to update docs?
doc-required
(If you need help on updating docs, create a doc issue)
no-need-doc
(Please explain why)
doc
(If this PR contains doc changes)