-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Tablet throttler: starvation fix and consolidation of logic. #15398
Merged
shlomi-noach
merged 19 commits into
vitessio:main
from
planetscale:throttler-starvation-fix
Mar 20, 2024
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
e9b3e7f
Tablet throttler: replica checks stimulate PRIMARY to request heartbeats
shlomi-noach 3a92d14
Use atomic.Int64
shlomi-noach 034c5cf
typo
shlomi-noach 3893657
Mark() and Diff()
shlomi-noach b78ab5b
do not mark last cehck time for 'vitess' app
shlomi-noach 430cc58
init lastDoValue to minimal val rather than increasing tickerValue
shlomi-noach cd102bb
DoEmpty
shlomi-noach 612ad1e
Throttler: consolidate lastCheckTimeNano, recentCheckValue; remove re…
shlomi-noach 1ec9c30
comment
shlomi-noach 65f2e52
pre-calculate logical diff value
shlomi-noach be90fc0
test replica throttler's stimulation of PRIMARY throttler
shlomi-noach c3cae9c
better comment
shlomi-noach 5f69eac
mroe debug output in endtoend test
shlomi-noach b58bac6
Always collect self metrcis, even if dormant.
shlomi-noach 87f95fe
remove flakiness
shlomi-noach 9a1200e
fix flakiness: renew heartbeats after waiting for lag
shlomi-noach 10bba83
adapt test
shlomi-noach feedb1a
fix to racy test
shlomi-noach 1f4f73f
set timeout for primary stimulation connection
shlomi-noach File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -148,20 +148,18 @@ func (check *ThrottlerCheck) Check(ctx context.Context, appName string, storeTyp | |
} | ||
|
||
checkResult = check.checkAppMetricResult(ctx, appName, storeType, storeName, metricResultFunc, flags) | ||
check.throttler.lastCheckTimeNano.Store(time.Now().UnixNano()) | ||
|
||
go func(statusCode int) { | ||
stats.GetOrNewCounter("ThrottlerCheckAnyTotal", "total number of checks").Add(1) | ||
stats.GetOrNewCounter(fmt.Sprintf("ThrottlerCheckAny%s%sTotal", textutil.SingleWordCamel(storeType), textutil.SingleWordCamel(storeName)), "").Add(1) | ||
|
||
if statusCode != http.StatusOK { | ||
stats.GetOrNewCounter("ThrottlerCheckAnyError", "total number of failed checks").Add(1) | ||
stats.GetOrNewCounter(fmt.Sprintf("ThrottlerCheckAny%s%sError", textutil.SingleWordCamel(storeType), textutil.SingleWordCamel(storeName)), "").Add(1) | ||
} | ||
|
||
check.throttler.markRecentApp(appName, remoteAddr) | ||
}(checkResult.StatusCode) | ||
|
||
check.throttler.markRecentApp(appName, remoteAddr) | ||
if !throttlerapp.VitessName.Equals(appName) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No metrics for |
||
go func(statusCode int) { | ||
stats.GetOrNewCounter("ThrottlerCheckAnyTotal", "total number of checks").Add(1) | ||
stats.GetOrNewCounter(fmt.Sprintf("ThrottlerCheckAny%s%sTotal", textutil.SingleWordCamel(storeType), textutil.SingleWordCamel(storeName)), "").Add(1) | ||
|
||
if statusCode != http.StatusOK { | ||
stats.GetOrNewCounter("ThrottlerCheckAnyError", "total number of failed checks").Add(1) | ||
stats.GetOrNewCounter(fmt.Sprintf("ThrottlerCheckAny%s%sError", textutil.SingleWordCamel(storeType), textutil.SingleWordCamel(storeName)), "").Add(1) | ||
} | ||
}(checkResult.StatusCode) | ||
} | ||
return checkResult | ||
} | ||
|
||
|
@@ -227,6 +225,7 @@ func (check *ThrottlerCheck) SelfChecks(ctx context.Context) { | |
for metricName, metricResult := range check.AggregatedMetrics(ctx) { | ||
metricName := metricName | ||
metricResult := metricResult | ||
|
||
go check.localCheck(ctx, metricName) | ||
go check.reportAggregated(metricName, metricResult) | ||
} | ||
|
Oops, something went wrong.
Oops, something went wrong.
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.
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.
Removed from
check.,go
. Delegated to, and consolidated incheckStore()
inthrottler.go
.