-
Notifications
You must be signed in to change notification settings - Fork 9.1k
YARN-11028. Add metrics for container allocation latency #3754
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
base: trunk
Are you sure you want to change the base?
Changes from all commits
138b7fc
6421ca4
15e1303
a2408fa
3ec05b7
5956c47
5cc0337
549ab55
8a659d7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,9 +24,11 @@ | |
| import java.util.ArrayList; | ||
| import java.util.Collections; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
| import java.util.concurrent.ConcurrentHashMap; | ||
| import java.util.concurrent.ConcurrentMap; | ||
|
|
||
| import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptMetrics; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
| import org.apache.hadoop.classification.InterfaceAudience.Private; | ||
|
|
@@ -395,7 +397,23 @@ public AllocateResponse allocate(AllocateRequest request) | |
|
|
||
| ApplicationAttemptId appAttemptId = | ||
| amrmTokenIdentifier.getApplicationAttemptId(); | ||
| RMAppAttemptMetrics rmMetrics = getAppAttemptMetrics(appAttemptId); | ||
| // we do this here to prevent the internal lock in allocate() | ||
| if (rmMetrics != null) { | ||
| rmMetrics.setAllocateLatenciesTimestamps(request.getAskList()); | ||
| } | ||
| AllocateResponse response = allocate(request, amrmTokenIdentifier); | ||
|
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. We may want to put the two 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. Not really, second time we are updating latencies based on AllocateResponse, so allocate call is required in between. |
||
| if (rmMetrics != null) { | ||
| rmMetrics.updateAllocateLatencies(response.getAllocatedContainers()); | ||
| } | ||
| return response; | ||
| } | ||
|
|
||
| protected AllocateResponse allocate(AllocateRequest request, | ||
| AMRMTokenIdentifier amrmTokenIdentifier) | ||
| throws YarnException, IOException { | ||
| ApplicationAttemptId appAttemptId = | ||
| amrmTokenIdentifier.getApplicationAttemptId(); | ||
| this.amLivelinessMonitor.receivedPing(appAttemptId); | ||
|
|
||
| /* check if its in cache */ | ||
|
|
@@ -472,6 +490,33 @@ public AllocateResponse allocate(AllocateRequest request) | |
| } | ||
| } | ||
|
|
||
| protected RMAppAttemptMetrics getAppAttemptMetrics( | ||
| ApplicationAttemptId appAttemptId) { | ||
| if (appAttemptId == null) { | ||
| return null; | ||
| } | ||
| ConcurrentMap<ApplicationId, RMApp> apps = this.rmContext.getRMApps(); | ||
| ApplicationId appId = appAttemptId.getApplicationId(); | ||
| if (appId == null) { | ||
| return null; | ||
| } | ||
| RMApp app = apps.get(appId); | ||
| if (app == null) { | ||
| return null; | ||
| } | ||
|
|
||
| Map<ApplicationAttemptId, RMAppAttempt> attempts = app.getAppAttempts(); | ||
| if (attempts == null) { | ||
| return null; | ||
| } else { | ||
| RMAppAttempt attempt = attempts.get(appAttemptId); | ||
| if (attempt == null) { | ||
| return null; | ||
| } | ||
| return attempt.getRMAppAttemptMetrics(); | ||
| } | ||
| } | ||
|
|
||
| public void registerAppAttempt(ApplicationAttemptId attemptId) { | ||
| AllocateResponse response = | ||
| recordFactory.newRecordInstance(AllocateResponse.class); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.