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