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

Add throttle for DurableLog based on max outstanding bytes. #7030

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

sachin-j-joshi
Copy link
Contributor

Change log description
(2-3 concise points about the changes in this PR. When committing this PR, the committer is expected to copy the content of this section to the merge description box)

Purpose of the change
(e.g., Fixes #666, Closes #1234)

What the code does
(Detailed description of the code changes)

How to verify it
(Optional: steps to verify that the changes are effective)

if (isThrottlingRequired()) {
QueueStats stats = this.getQueueStats.get();
val excess = stats.getTotalLength() - this.maxOutstandingBytes;
return Math.min(this.baseDelay, (int) Math.ceil(1.0 * excess * this.baseDelay / this.maxOutstandingBytes));
Copy link
Member

Choose a reason for hiding this comment

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

Common has minimax

if (isThrottlingRequired()) {
QueueStats stats = this.getQueueStats.get();
val excess = stats.getTotalLength() - this.maxOutstandingBytes;
return Math.min(this.baseDelay, (int) Math.ceil(1.0 * excess * this.baseDelay / this.maxOutstandingBytes));
Copy link
Member

Choose a reason for hiding this comment

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

1.0 is not needed. Also have parentheses around (excess / max) for clarity and to preserve precision.

@Override
boolean isThrottlingRequired() {
QueueStats stats = this.getQueueStats.get();
return stats.getTotalLength() > this.maxOutstandingBytes;
Copy link
Member

Choose a reason for hiding this comment

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

This is different from some of the other throttlers. It won't throttle until it's already over the max and then will reach the max throttle when 2x the max. ThrottlerPolicy.CACHE_TARGET_UTILIZATION for example provides a Target percentage to be used, which is taken as a fraction of the max. I think we can quite recently use this same value

@codecov
Copy link

codecov bot commented Mar 27, 2023

Codecov Report

Patch coverage: 94.11% and project coverage change: +0.01 🎉

Comparison is base (798d8a2) 86.35% compared to head (0cb9f07) 86.36%.

❗ Current head 0cb9f07 differs from pull request most recent head d431c42. Consider uploading reports for the commit d431c42 to get more accurate results

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #7030      +/-   ##
============================================
+ Coverage     86.35%   86.36%   +0.01%     
- Complexity    16047    16051       +4     
============================================
  Files          1031     1031              
  Lines         59815    59831      +16     
  Branches       6071     6074       +3     
============================================
+ Hits          51653    51675      +22     
+ Misses         4988     4983       -5     
+ Partials       3174     3173       -1     
Impacted Files Coverage Δ
.../segmentstore/server/logs/ThrottlerCalculator.java 95.60% <93.75%> (-0.45%) ⬇️
...a/segmentstore/server/logs/OperationProcessor.java 91.95% <100.00%> (+1.43%) ⬆️

... and 10 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add unit tests for RocksDBCache
2 participants