-
Notifications
You must be signed in to change notification settings - Fork 423
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
TEZ-4580: Slow preemption of new containers when re-use is enabled #374
Changes from 1 commit
e3beaf1
358aa2f
1995c89
f53188a
3620070
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 |
---|---|---|
|
@@ -1275,7 +1275,7 @@ boolean preemptIfNeeded() { | |
+ numHighestPriRequests + " pending requests at pri: " | ||
+ highestPriRequest.getPriority()); | ||
} | ||
|
||
int newContainersReleased = 0; | ||
for (int i=0; i<numPendingRequestsToService; ++i) { | ||
// This request must have been considered for matching with all existing | ||
// containers when request was made. | ||
|
@@ -1311,7 +1311,7 @@ boolean preemptIfNeeded() { | |
" with priority: " + lowestPriNewContainer.getPriority() + | ||
" to free resource for request: " + highestPriRequest + | ||
" . Current free resources: " + freeResources); | ||
numPendingRequestsToService--; | ||
newContainersReleased++; | ||
releaseUnassignedContainers(Collections.singletonList(lowestPriNewContainer)); | ||
// We are returning an unused resource back the RM. The RM thinks it | ||
// has serviced our initial request and will not re-allocate this back | ||
|
@@ -1324,7 +1324,7 @@ boolean preemptIfNeeded() { | |
continue; | ||
} | ||
} | ||
|
||
numPendingRequestsToService -= newContainersReleased; | ||
if (numPendingRequestsToService < 1) { | ||
return true; | ||
} | ||
|
@@ -1573,6 +1573,9 @@ private void releaseContainer(ContainerId containerId) { | |
if (delayedContainer != null) { | ||
Resources.subtractFrom(allocatedResources, | ||
delayedContainer.getContainer().getResource()); | ||
if (shouldReuseContainers) { | ||
delayedContainerManager.removeDelayedContainer(delayedContainer); | ||
} | ||
} | ||
if (delayedContainer != null || !shouldReuseContainers) { | ||
amRmClient.releaseAssignedContainer(containerId); | ||
|
@@ -2163,6 +2166,17 @@ void addDelayedContainer(Container container, | |
} | ||
} | ||
|
||
void removeDelayedContainer(HeldContainer container) { | ||
if (container != null) { | ||
synchronized(this) { | ||
if (delayedContainers.remove(container)) { | ||
LOG.info("Removed {} from delayed containers", container.getContainer().getId()); | ||
} else { | ||
LOG.warn("Unknown container {} sent for removal. Ignoring.", container.getContainer().getId()); | ||
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. A valid case here is when a new container is allocated - added to delayedContainers, it is polled (removed) from queue but if there is no pending task request 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. nit: I think we should change the log level to debug and print the only if LOG.isDebugEnabled() is true, Rest of the code LGTM . 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 sure about the log levels, let's keep the simple remove path on debug, as looks like the happy preemption path:
isDebugEnabled is not necessary as long as we use the {} formatting (to prevent unnecessary string creation) 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. Agreed. |
||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
synchronized void determineMinHeldContainers() { | ||
|
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.
this null check is not needed, as it's called from a block