@@ -102,6 +102,7 @@ public enum ContainerMetric {
102
102
private ResourceUtilization containersUtilization ;
103
103
104
104
private ResourceThresholds overAllocationPreemptionThresholds ;
105
+ private int overAlloctionPreemptionCpuCount = -1 ;
105
106
106
107
private volatile boolean stopped = false ;
107
108
@@ -236,7 +237,7 @@ private void initializeOverAllocation(Configuration conf) {
236
237
YarnConfiguration .MAX_NM_OVERALLOCATION_THRESHOLD );
237
238
if (overAllocationMemoryUtilizationThreshold <= 0 ) {
238
239
LOG .info ("NodeManager oversubscription is disabled because the memory " +
239
- "utilization threshold is no larger than zero." );
240
+ "overallocation threshold is no larger than zero." );
240
241
return ;
241
242
}
242
243
@@ -248,36 +249,49 @@ private void initializeOverAllocation(Configuration conf) {
248
249
YarnConfiguration .MAX_NM_OVERALLOCATION_THRESHOLD );
249
250
if (overAllocationCpuUtilizationThreshold <= 0 ) {
250
251
LOG .info ("NodeManager oversubscription is disabled because the CPU " +
251
- "utilization threshold is no larger than zero." );
252
+ "overallocation threshold is no larger than zero." );
252
253
return ;
253
254
}
254
255
255
- float preemptionThreshold = conf .getFloat (
256
- YarnConfiguration .NM_OVERALLOCATION_PREEMPTION_THRESHOLD ,
257
- YarnConfiguration .DEFAULT_NM_OVERALLOCATION_PREEMPTION_THRESHOLD );
258
- if (preemptionThreshold <= overAllocationCpuUtilizationThreshold ) {
259
- LOG .info ("NodeManager oversubscription is disabled because preemption" +
260
- "threshold is no larger than the cpu utilization threshold." );
256
+ float cpuPreemptionThreshold = conf .getFloat (
257
+ YarnConfiguration .NM_OVERALLOCATION_CPU_PREEMPTION_THRESHOLD ,
258
+ YarnConfiguration .
259
+ DEFAULT_NM_OVERALLOCATION_CPU_PREEMPTION_THRESHOLD );
260
+ if (cpuPreemptionThreshold <= overAllocationCpuUtilizationThreshold ) {
261
+ LOG .info ("NodeManager oversubscription is disabled because the cpu " +
262
+ " preemption threshold is no larger than the cpu overallocation" +
263
+ " threshold." );
261
264
return ;
262
265
}
263
- if (preemptionThreshold <= overAllocationMemoryUtilizationThreshold ) {
264
- LOG .info ("NodeManager oversubscription is disabled because preemption" +
265
- "threshold is no larger than the memory utilization threshold." );
266
+
267
+ float memoryPreemptionThreshold = conf .getFloat (
268
+ YarnConfiguration .NM_OVERALLOCATION_MEMORY_PREEMPTION_THRESHOLD ,
269
+ YarnConfiguration .
270
+ DEFAULT_NM_OVERALLOCATION_MEMORY_PREEMPTION_THRESHOLD );
271
+ if (memoryPreemptionThreshold <= overAllocationMemoryUtilizationThreshold ) {
272
+ LOG .info ("NodeManager oversubscription is disabled because the memory" +
273
+ " preemption threshold is no larger than the memory overallocation" +
274
+ " threshold." );
266
275
return ;
267
276
}
268
277
278
+ this .overAlloctionPreemptionCpuCount = conf .getInt (
279
+ YarnConfiguration .NM_OVERALLOCATION_PREEMPTION_CPU_COUNT ,
280
+ YarnConfiguration .DEFAULT_NM_OVERALLOCATION_PREEMPTION_CPU_COUNT );
281
+
269
282
ResourceThresholds resourceThresholds = ResourceThresholds .newInstance (
270
283
overAllocationCpuUtilizationThreshold ,
271
284
overAllocationMemoryUtilizationThreshold );
272
285
((NodeManager .NMContext ) context ).setOverAllocationInfo (
273
286
OverAllocationInfo .newInstance (resourceThresholds ));
274
- this .overAllocationPreemptionThresholds =
275
- ResourceThresholds . newInstance ( preemptionThreshold );
287
+ this .overAllocationPreemptionThresholds = ResourceThresholds . newInstance (
288
+ cpuPreemptionThreshold , memoryPreemptionThreshold );
276
289
277
290
LOG .info ("NodeManager oversubscription enabled with overallocation " +
278
291
"thresholds (memory:" + overAllocationMemoryUtilizationThreshold +
279
292
", CPU:" + overAllocationCpuUtilizationThreshold + ") and preemption" +
280
- " threshold: " + preemptionThreshold );
293
+ " threshold (memory:" + memoryPreemptionThreshold + ", CPU:" +
294
+ cpuPreemptionThreshold + ")" );
281
295
}
282
296
283
297
private boolean isResourceCalculatorAvailable () {
0 commit comments