Update: This feature has been found to contain defects that make it unsuitable for use in a production cluster at this time.
Note | |
---|---|
This feature is a technical preview and considered under development. Do not use this feature in your production systems. If you have questions regarding this feature, contact Support by logging a case on our Hortonworks Support Portal at https://support.hortonworks.com. |
As mentioned previously, a scenario can occur in which a queue has a guaranteed level of cluster resources, but must wait to run applications because other queues are utilizing all of the available resources. If Preemption is enabled, higher-priority applications do not have to wait because lower priority applications have taken up the available capacity. With Preemption enabled, under-served queues can begin to claim their allocated cluster resources almost immediately, without having to wait for other queues' applications to finish running.
Preemption Workflow
Preemption is governed by a set of capacity monitor policies, which must be enabled by
setting the yarn.resourcemanager.scheduler.monitor.enable
property to
"true". These capacity monitor policies apply Preemption in configurable intervals based
on defined capacity allocations, and in as graceful a manner as possible. Containers are
only killed as a last resort. The following image demonstrates the Preemption
workflow:
Preemption Configuration
The following properties in the etc/hadoop/conf/yarn-site.xml
file on
the ResourceManager host are used to enable and configure Preemption.
Property:
yarn.resourcemanager.scheduler.monitor.enable
Value:
true
Description: Setting this property to "true" enables Preemption. It enables a set of periodic monitors that affect the Capacity Scheduler. This default value for this property is "false" (disabled).
Property:
yarn.resourcemanager.scheduler.monitor.policies
Value:
org.apache.hadoop.yarn.server.resourcemanager.monitor.capacity.ProportionalCapacityPreemptionPolicy
Description: The list of SchedulingEditPolicy classes that interact with the scheduler. The only policy currently available for preemption is the “ProportionalCapacityPreemptionPolicy”.
Property:
yarn.resourcemanager.monitor.capacity.preemption.monitoring_interval
Value:
3000
Description: The time in milliseconds between invocations of this policy. Setting this value to a longer time interval will cause the Capacity Monitor to run less frequently.
Property:
yarn.resourcemanager.monitor.capacity.preemption.max_wait_before_kill
Value:
15000
Description: The time in milliseconds between requesting a preemption from an application and killing the container. Setting this to a higher value will give applications more time to respond to preemption requests and gracefully release Containers.
Property:
yarn.resourcemanager.monitor.capacity.preemption.total_preemption_per_round
Value:
0.1
Description: The maximum percentage of resources preempted in a single round. You can use this value to restrict the pace at which Containers are reclaimed from the cluster. After computing the total desired preemption, the policy scales it back to this limit.