YARN-2868. FairScheduler: Metric for latency to allocate first container for an application. (Ray Chiang via kasha)
This commit is contained in:
parent
2bc097cd14
commit
972f1f1ab9
|
@ -73,6 +73,9 @@ Release 2.8.0 - UNRELEASED
|
||||||
YARN-3350. YARN RackResolver spams logs with messages at info level.
|
YARN-3350. YARN RackResolver spams logs with messages at info level.
|
||||||
(Wilfred Spiegelenburg via junping_du)
|
(Wilfred Spiegelenburg via junping_du)
|
||||||
|
|
||||||
|
YARN-2868. FairScheduler: Metric for latency to allocate first container
|
||||||
|
for an application. (Ray Chiang via kasha)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
YARN-3339. TestDockerContainerExecutor should pull a single image and not
|
YARN-3339. TestDockerContainerExecutor should pull a single image and not
|
||||||
|
|
|
@ -38,6 +38,7 @@ import org.apache.hadoop.metrics2.lib.MetricsRegistry;
|
||||||
import org.apache.hadoop.metrics2.lib.MutableCounterInt;
|
import org.apache.hadoop.metrics2.lib.MutableCounterInt;
|
||||||
import org.apache.hadoop.metrics2.lib.MutableCounterLong;
|
import org.apache.hadoop.metrics2.lib.MutableCounterLong;
|
||||||
import org.apache.hadoop.metrics2.lib.MutableGaugeInt;
|
import org.apache.hadoop.metrics2.lib.MutableGaugeInt;
|
||||||
|
import org.apache.hadoop.metrics2.lib.MutableRate;
|
||||||
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
||||||
import org.apache.hadoop.yarn.api.records.Resource;
|
import org.apache.hadoop.yarn.api.records.Resource;
|
||||||
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
||||||
|
@ -74,6 +75,7 @@ public class QueueMetrics implements MetricsSource {
|
||||||
@Metric("# of reserved containers") MutableGaugeInt reservedContainers;
|
@Metric("# of reserved containers") MutableGaugeInt reservedContainers;
|
||||||
@Metric("# of active users") MutableGaugeInt activeUsers;
|
@Metric("# of active users") MutableGaugeInt activeUsers;
|
||||||
@Metric("# of active applications") MutableGaugeInt activeApplications;
|
@Metric("# of active applications") MutableGaugeInt activeApplications;
|
||||||
|
@Metric("App Attempt First Container Allocation Delay") MutableRate appAttemptFirstContainerAllocationDelay;
|
||||||
private final MutableGaugeInt[] runningTime;
|
private final MutableGaugeInt[] runningTime;
|
||||||
private TimeBucketMetrics<ApplicationId> runBuckets;
|
private TimeBucketMetrics<ApplicationId> runBuckets;
|
||||||
|
|
||||||
|
@ -463,6 +465,10 @@ public class QueueMetrics implements MetricsSource {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addAppAttemptFirstContainerAllocationDelay(long latency) {
|
||||||
|
appAttemptFirstContainerAllocationDelay.add(latency);
|
||||||
|
}
|
||||||
|
|
||||||
public int getAppsSubmitted() {
|
public int getAppsSubmitted() {
|
||||||
return appsSubmitted.value();
|
return appsSubmitted.value();
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
import org.apache.commons.lang.time.DateUtils;
|
import org.apache.commons.lang.time.DateUtils;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
@ -93,6 +94,8 @@ public class SchedulerApplicationAttempt {
|
||||||
private LogAggregationContext logAggregationContext;
|
private LogAggregationContext logAggregationContext;
|
||||||
|
|
||||||
protected ResourceUsage attemptResourceUsage = new ResourceUsage();
|
protected ResourceUsage attemptResourceUsage = new ResourceUsage();
|
||||||
|
private AtomicLong firstAllocationRequestSentTime = new AtomicLong(0);
|
||||||
|
private AtomicLong firstContainerAllocatedTime = new AtomicLong(0);
|
||||||
|
|
||||||
protected List<RMContainer> newlyAllocatedContainers =
|
protected List<RMContainer> newlyAllocatedContainers =
|
||||||
new ArrayList<RMContainer>();
|
new ArrayList<RMContainer>();
|
||||||
|
@ -648,4 +651,18 @@ public class SchedulerApplicationAttempt {
|
||||||
Resources.clone(headroom));
|
Resources.clone(headroom));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void recordContainerRequestTime(long value) {
|
||||||
|
firstAllocationRequestSentTime.compareAndSet(0, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void recordContainerAllocationTime(long value) {
|
||||||
|
if (firstContainerAllocatedTime.compareAndSet(0, value)) {
|
||||||
|
long timediff = firstContainerAllocatedTime.longValue() -
|
||||||
|
firstAllocationRequestSentTime.longValue();
|
||||||
|
if (timediff > 0) {
|
||||||
|
queue.getMetrics().addAppAttemptFirstContainerAllocationDelay(timediff);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -898,6 +898,9 @@ public class FairScheduler extends
|
||||||
clusterResource, minimumAllocation, getMaximumResourceCapability(),
|
clusterResource, minimumAllocation, getMaximumResourceCapability(),
|
||||||
incrAllocation);
|
incrAllocation);
|
||||||
|
|
||||||
|
// Record container allocation start time
|
||||||
|
application.recordContainerRequestTime(getClock().getTime());
|
||||||
|
|
||||||
// Set amResource for this app
|
// Set amResource for this app
|
||||||
if (!application.getUnmanagedAM() && ask.size() == 1
|
if (!application.getUnmanagedAM() && ask.size() == 1
|
||||||
&& application.getLiveContainers().isEmpty()) {
|
&& application.getLiveContainers().isEmpty()) {
|
||||||
|
@ -940,6 +943,12 @@ public class FairScheduler extends
|
||||||
application.updateBlacklist(blacklistAdditions, blacklistRemovals);
|
application.updateBlacklist(blacklistAdditions, blacklistRemovals);
|
||||||
ContainersAndNMTokensAllocation allocation =
|
ContainersAndNMTokensAllocation allocation =
|
||||||
application.pullNewlyAllocatedContainersAndNMTokens();
|
application.pullNewlyAllocatedContainersAndNMTokens();
|
||||||
|
|
||||||
|
// Record container allocation time
|
||||||
|
if (!(allocation.getContainerList().isEmpty())) {
|
||||||
|
application.recordContainerAllocationTime(getClock().getTime());
|
||||||
|
}
|
||||||
|
|
||||||
Resource headroom = application.getHeadroom();
|
Resource headroom = application.getHeadroom();
|
||||||
application.setApplicationHeadroomForMetrics(headroom);
|
application.setApplicationHeadroomForMetrics(headroom);
|
||||||
return new Allocation(allocation.getContainerList(), headroom,
|
return new Allocation(allocation.getContainerList(), headroom,
|
||||||
|
|
Loading…
Reference in New Issue