CPU scheduling and enforcement

33
CPU scheduling and enforcement (screenshots of live demo) Andrew Ferguson July 10, 2012

description

CPU scheduling and enforcement. (screenshots of live demo). Andrew Ferguson July 10, 2012. Cores in the web GUI. Cores in the web GUI. Cores in the web GUI. Unfair sharing. S tart four threads spinning. Unfair sharing. S tart four threads spinning. Then, a second 16 threads spinning. - PowerPoint PPT Presentation

Transcript of CPU scheduling and enforcement

Page 1: CPU scheduling and enforcement

CPU scheduling and enforcement

(screenshots of live demo)

Andrew FergusonJuly 10, 2012

Page 2: CPU scheduling and enforcement

Cores in the web GUI

Page 3: CPU scheduling and enforcement

Cores in the web GUI

Page 4: CPU scheduling and enforcement

Cores in the web GUI

Page 5: CPU scheduling and enforcement

Unfair sharing

Start four threads spinning

Page 6: CPU scheduling and enforcement

Unfair sharing

Start four threads spinning

Then, a second 16threads spinning

Page 7: CPU scheduling and enforcement

Unfair sharing

Start four threads spinning

Then, a second 16threads spinning

Second process gets more CPU

Page 8: CPU scheduling and enforcement

Let’s use Kitten!

Page 9: CPU scheduling and enforcement

Let’s use Kitten!

Same programs as before

Page 10: CPU scheduling and enforcement

Let’s use Kitten!

Same programs as before

Added: CPU cores request

Page 11: CPU scheduling and enforcement

Playing with YARN

Launch oneapplication in YARN

Page 12: CPU scheduling and enforcement

Playing with YARN

Launch oneapplication in YARN Gets all cores, even though

requested only one

Page 13: CPU scheduling and enforcement

Playing with YARN

Launch second application, again with more threads

Page 14: CPU scheduling and enforcement

Playing with YARN

Now CPU is shared equally!

Launch second application, again with more threads

Page 15: CPU scheduling and enforcement

Playing with YARN

Page 16: CPU scheduling and enforcement

Playing with YARN

Page 17: CPU scheduling and enforcement

Request all the cores

two cores per containerx two containers = 4 cores

Page 18: CPU scheduling and enforcement

Request all the cores

First applicationis running

Page 19: CPU scheduling and enforcement

Request all the cores

First applicationis running

Second applicationIs waiting

Page 20: CPU scheduling and enforcement

Request all the cores

First applicationis running

Second applicationIs waiting

First application has all the cores

Page 21: CPU scheduling and enforcement

Request all the cores

Page 22: CPU scheduling and enforcement

How does this work?

Page 23: CPU scheduling and enforcement

Pieces of YARN

ResourceManager

NodeManager

NodeManager

NodeManager

ApplicationMaster

Page 24: CPU scheduling and enforcement

Pieces of YARN

ResourceManager

NodeManager

NodeManager

NodeManager

ApplicationMaster

Page 25: CPU scheduling and enforcement

Pieces of YARN

ResourceManager

NodeManager

NodeManager

NodeManager

ApplicationMaster

Page 26: CPU scheduling and enforcement

Node Manager Internals

Launched byContainerExecutor

Node Manager

Page 27: CPU scheduling and enforcement

Node Manager Internals

Launched byContainerExecutor

Node ManagerContainersMonitor

1. Monitors memory usage, and kills tasks over limit

2. Reports killed or failed tasks back to ResourceManager

3. Deletes temporary files created by executor

Page 28: CPU scheduling and enforcement

Node Manager Internals

Launched byContainerExecutor

Node ManagerContainersMonitor

1. Monitors memory usage, and kills tasks over limit

2. Reports killed or failed tasks back to ResourceManager

3. Deletes temporary files created by executor

Made pluggable,like executor, in

MAPREDUCE-4351

Page 29: CPU scheduling and enforcement

Node Manager Internals

Launched byContainerExecutor

Node ManagerContainersMonitor

1. Creates Cgroup for container, places processes in it

2. Reports killed or failed tasks back to ResourceManager

3. Deletes temporary files created by executor

4. Deletes Cgroup when finished

CgroupsCMin MAPREDUCE-4334

Page 30: CPU scheduling and enforcement

Cgroups hierarchycpu memory

Controller(find by reading

mount table)

$ sudo mount -t cgroup -o memory none /cgroups/mem

Page 31: CPU scheduling and enforcement

Cgroups hierarchycpu memory

hadoop-yarn . . . hadoop-yarn . . .

Controller(find by reading

mount table)

Top ofHierarchy

yarn.nodemanager.cgroups.path

$ sudo cgcreate -a hadoop_user_name -g memory:hadoop-yarn

Page 32: CPU scheduling and enforcement

Cgroups hierarchycpu memory

hadoop-yarn . . .

container_..._001

container_..._002

container_..._003

. . .

hadoop-yarn . . . container_..._001

container_..._002

container_..._003

. . .

Controller(find by reading

mount table)

Top ofHierarchy

yarn.nodemanager.cgroups.path

Page 33: CPU scheduling and enforcement

Container Cgroup

CPU processfrom before

IsolatedCPU cgroup