Apache Hadoop YARN
Vavilapalli, et al
Sami Rollins
Introduction
https://www.confluent.io/wp-content/uploads/data-flow-ugly-1-768x427.png
Introduction
Common Problems
Common Problems
YARN
General framework for performing distributed computation on a cluster
MapReduce
https://static.googleusercontent.com/media/research.google.com/en//archive/mapreduce-osdi04.pdf
MapReduce
YARN
YARN
YARN
https://hadoop.apache.org/docs/r2.8.0/hadoop-yarn/hadoop-yarn-site/YARN.html
Architecture
Architecture
Architecture
https://hadoop.apache.org/docs/r2.8.0/hadoop-yarn/hadoop-yarn-site/ResourceManagerHA.html
Architecture
Architecture
https://github.com/hortonworks/simple-yarn-app
Writing a YARN Application - Client
// Create yarnClient
YarnConfiguration conf = new YarnConfiguration();
YarnClient yarnClient = YarnClient.createYarnClient();
yarnClient.init(conf);
yarnClient.start();
Writing a YARN Application - Client
// Set up the container launch context for the application master
ContainerLaunchContext amContainer =
Records.newRecord(ContainerLaunchContext.class);
amContainer.setCommands(
Collections.singletonList(
"$JAVA_HOME/bin/java" +
" -Xmx256M" +
" cs682.yarn.ApplicationMasterAsync" +
" " + command +
" " + String.valueOf(n) +
" 1>" + ApplicationConstants.LOG_DIR_EXPANSION_VAR + "/stdout" +
" 2>" + ApplicationConstants.LOG_DIR_EXPANSION_VAR + "/stderr"
)
);
Writing a YARN Application - AM
// Resource requirements for worker containers
Resource capability = Records.newRecord(Resource.class);
capability.setMemory(128);
capability.setVirtualCores(1);
// Make container requests to ResourceManager
for (int i = 0; i < n; ++i) {
ContainerRequest containerAsk = new ContainerRequest(capability, null, null, priority);
System.out.println("Making res-req " + i);
rmClient.addContainerRequest(containerAsk);
}
Writing a YARN Application - AM
// Launch container by create ContainerLaunchContext
ContainerLaunchContext ctx =
Records.newRecord(ContainerLaunchContext.class);
ctx.setCommands(
Collections.singletonList(
command +
" 1>" + ApplicationConstants.LOG_DIR_EXPANSION_VAR + "/stdout" +
" 2>" + ApplicationConstants.LOG_DIR_EXPANSION_VAR + "/stderr"
));
Observations
Other Distributed Systems/Applications
Kafka
https://www.confluent.io/blog/stream-data-platform-1/
BitTorrent
https://en.wikipedia.org/wiki/BitTorrent
BOINC