Yarn 에서 제공하는 스케줄러는 3가지가 있다.

  • FIFO (First In First Out) : 큐에 하나씩 넣고 제출된 순서에 따라 순차적으로 실행
  • Capacity (가용량) : 분리된 큐에 처리 , 해당 job을 미리 예약 해둠으로써 효율성이 떨어짐
  • Fair : 실행중인 모든 잡의 자원을 동적으로 분배
    • 공정 스케줄러는 모든 애플리케이션엥 최대한 (평균적으로) 공평한 지분의 리소스를 할당한다. 기본 설정을 유지하면 메모리에 기반해 리소스 분배를 결정하지만, 메모리와 CPU를 모두 고려하도록 설정 할수도있다.
    • 공정 스케줄러는 용량 스케줄러와 마찬가지로 큐를 사용해 애플리케이션 관리.
      각 큐에는 애플리케이션 우선순위(일부 애플리케이션에 더 많은 리소스를 할당하는 기능)와 최소 필요 용량을 설정 할 수 있다.
    • 공정 스케줄러는 또한 선점 스케줄링을 지원
      선점 스케줄링은 애플리케이션이 리소스를 요청하면 클러스터에서 실행중인 다른 애플리케이션의 일부 리소스를 가져올 수 있는 기능

균등 공유는 큐 사이에만 적용된다. 사용자 큐는 사용자가 처음 application을 제출할때 동적으로 생성된다.

사이에만 균등하게 공유된다고 할수있다.

Cluster utilization over time when running a large job and a small job under the FIFO Scheduler (i), Capacity Scheduler (ii), and Fair Scheduler (iii)

Fair 스케줄러가 동적으로 잡을 사용할꺼기 때문에 Fair 스케줄러에 대해서 설명

기본 설정 및 테스트

yarn-site.xml 에 속성값 추가하기 ( default는 FIFO )

fair-scheduler 를 활성화 하기 위해서는

<property>
    <name>yarn.resourcemanager.scheduler.class</name>
        <value>
             org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler
        </value>
</property>

처음에는 각 노드들은

첫 번째로 제출한 1번의 어플리케이션 의 잡이 실행되는 것을 알수 있다.

ContainerId ContainerState logs
container_1542764685109_0001_01_000001 RUNNING logs
container_1542764685109_0001_01_000360 DONE logs
container_1542764685109_0001_01_000364 RUNNING logs
container_1542764685109_0001_01_000368 RUNNING logs
container_1542764685109_0001_01_000370 RUNNING logs
container_1542764685109_0001_01_000373 RUNNING logs
container_1542764685109_0001_01_000177 RUNNING logs
container_1542764685109_0001_01_000179 RUNNING logs
container_1542764685109_0001_01_000183 RUNNING logs

두번째로 어플리케이션을 제출하니 각노드당 메모리를 재할당? 하여 공평하기 1번과 2번의 잡이 돌고있는것을 알수 있었다.

node1

ContainerId ContainerState logs
container_1542764685109_0001_01_000001 RUNNING logs
container_1542764685109_0001_01_000360 DONE logs
container_1542764685109_0001_01_000364 RUNNING logs
container_1542764685109_0001_01_000368 RUNNING logs
container_1542764685109_0001_01_000370 RUNNING logs
container_1542764685109_0001_01_000373 RUNNING logs
container_1542764685109_0002_01_000177 RUNNING logs
container_1542764685109_0002_01_000179 RUNNING logs
container_1542764685109_0002_01_000183 RUNNING logs

node2

ContainerId ContainerState logs
container_1542764685109_0001_01_000365 DONE logs
container_1542764685109_0001_01_000367 KILLING logs
container_1542764685109_0001_01_000369 RUNNING logs
container_1542764685109_0001_01_000371 RUNNING logs
container_1542764685109_0001_01_000374 RUNNING logs
container_1542764685109_0002_01_000104 RUNNING logs
container_1542764685109_0002_01_000182 RUNNING logs
container_1542764685109_0002_01_000184 RUNNING logs
container_1542764685109_0002_01_000185 RUNNING logs

node3

ContainerId ContainerState logs
container_1542764685109_0001_01_000079 RUNNING logs
container_1542764685109_0001_01_000372 RUNNING logs
container_1542764685109_0001_01_000376 RUNNING logs
container_1542764685109_0002_01_000001 RUNNING logs
container_1542764685109_0002_01_000186 RUNNING logs
container_1542764685109_0002_01_000187 RUNNING logs
container_1542764685109_0002_01_000188 RUNNING logs
container_1542764685109_0002_01_000190 RUNNING logs

http://blog.cloudera.com/blog/2018/06/yarn-fairscheduler-preemption-deep-dive/

https://dzone.com/articles/untangling-apache-hadoop-yarn-part-4-fair-schedule

+ Recent posts