当前位置: 首页 > news >正文

Hadoop 之 Yarn (资源调度和分配)

disk 不足

hadoop-hadoop-nodemanager-172.17.48.124.log

2025-07-2511:24:35,539ERROR[main]org.apache.hadoop.yarn.server.nodemanager.LocalDirsHandlerService:Most of the disks failed.1/4local-dirs have errors:[/data3/emr/yarn/local:Cannot create directory:/data3/emr/yarn/local]3/4local-dirs usable space is below configured utilization percentage/no more usable space[/data2/emr/yarn/local:used space above threshold of90.0%,/data1/emr/yarn/local:used space above threshold of90.0%,/data/emr/yarn/local:used space above threshold of90.0%];1/4log-dirs have errors:[/data3/emr/yarn/logs:Cannot create directory:/data3/emr/yarn/logs]3/4log-dirs usable space is below configured utilization percentage/no more usable space[/data/emr/yarn/logs:used space above threshold of90.0%,/data1/emr/yarn/logs:used space above threshold of90.0%,/data2/emr/yarn/logs:used space above threshold of90.0%]

maximum-container-assignments
/** Maximum number of containers to assign on each check-in. */@PrivatepublicstaticfinalStringMAX_ASSIGN_PER_HEARTBEAT=PREFIX+"per-node-heartbeat.maximum-container-assignments";
/** * Avoid potential risk that greedy assign multiple may involve * */@PrivatepublicstaticfinalintDEFAULT_MAX_ASSIGN_PER_HEARTBEAT=100;

hadoop-yarn-project\hadoop-yarn\hadoop-yarn-server\hadoop-yarn-server-resourcemanager\src\main\java\org\apache\hadoop\yarn\server\resourcemanager\scheduler\capacity\CapacitySchedulerConfiguration.java

publicintgetMaxAssignPerHeartbeat(){returngetInt(MAX_ASSIGN_PER_HEARTBEAT,DEFAULT_MAX_ASSIGN_PER_HEARTBEAT);}

hadoop-yarn-project\hadoop-yarn\hadoop-yarn-server\hadoop-yarn-server-resourcemanager\src\main\java\org\apache\hadoop\yarn\server\resourcemanager\scheduler\capacity\CapacityScheduler.java

this.maxAssignPerHeartbeat=this.conf.getMaxAssignPerHeartbeat();
// assignMultipleEnabled should be ON,// and assignedContainers should be under thresholdreturnassignMultipleEnabled&&(maxAssignPerHeartbeat==-1||assignedContainers<maxAssignPerHeartbeat);
/** * We need to make sure when doing allocation, Node should be existed * And we will construct a {@link CandidateNodeSet} before proceeding */privatevoidallocateContainersToNode(NodeIdnodeId,booleanwithNodeHeartbeat){FiCaSchedulerNodenode=getNode(nodeId);if(null!=node){intoffswitchCount=0;intassignedContainers=0;CandidateNodeSet<FiCaSchedulerNode>candidates=getCandidateNodeSet(node);CSAssignmentassignment=allocateContainersToNode(candidates,withNodeHeartbeat);// Only check if we can allocate more container on the same node when// scheduling is triggered by node heartbeatif(null!=assignment&&withNodeHeartbeat){if(assignment.getType()==NodeType.OFF_SWITCH){offswitchCount++;}if(Resources.greaterThan(calculator,getClusterResource(),assignment.getResource(),Resources.none())){assignedContainers++;}while(canAllocateMore(assignment,offswitchCount,assignedContainers)){// Try to see if it is possible to allocate multiple container for// the same node heartbeatassignment=allocateContainersToNode(candidates,true);if(null!=assignment&&assignment.getType()==NodeType.OFF_SWITCH){offswitchCount++;}if(null!=assignment&&Resources.greaterThan(calculator,getClusterResource(),assignment.getResource(),Resources.none())){assignedContainers++;}}if(offswitchCount>=offswitchPerHeartbeatLimit){LOG.debug("Assigned maximum number of off-switch containers: {},"+" assignments so far: {}",offswitchCount,assignment);}}}}
@Lock(Lock.NoLock.class)publicList<FiCaSchedulerNode>getAllNodes(){returnnodeTracker.getAllNodes();}
assignedContainers

assignedContainers 累加的代码

while(canAllocateMore(assignment,offswitchCount,assignedContainers)){// Try to see if it is possible to allocate multiple container for// the same node heartbeatassignment=allocateContainersToNode(candidates,true);if(null!=assignment&&assignment.getType()==NodeType.OFF_SWITCH){offswitchCount++;}if(null!=assignment&&Resources.greaterThan(calculator,getClusterResource(),assignment.getResource(),Resources.none())){assignedContainers++;}}
privatebooleancanAllocateMore(CSAssignmentassignment,intoffswitchCount,intassignedContainers){...// assignMultipleEnabled should be ON,// and assignedContainers should be under thresholdreturnassignMultipleEnabled&&(maxAssignPerHeartbeat==-1||assignedContainers<maxAssignPerHeartbeat);...}
nodes 来源
/** * Convenience method to filter nodes based on a condition. * * @param nodeFilter A {@link NodeFilter} for filtering the nodes * @return A list of filtered nodes */publicList<N>getNodes(NodeFilternodeFilter){List<N>nodeList=newArrayList<>();readLock.lock();try{if(nodeFilter==null){nodeList.addAll(nodes.values());}else{for(Nnode:nodes.values()){if(nodeFilter.accept(node)){nodeList.add(node);}}}}finally{readLock.unlock();}returnnodeList;}
schedule 调度随机性
/** * Schedule on all nodes by starting at a random point. * @param cs */staticvoidschedule(CapacitySchedulercs)throwsInterruptedException{// First randomize the start pointintcurrent=0;Collection<FiCaSchedulerNode>nodes=cs.nodeTracker.getAllNodes();// If nodes size is 0 (when there are no node managers registered,// we can return from here itself.intnodeSize=nodes.size();if(nodeSize==0){return;}intstart=random.nextInt(nodeSize);
CSAssignment allocateContainersToNode
CSAssignmentallocateContainersToNode(CandidateNodeSet<FiCaSchedulerNode>candidates,booleanwithNodeHeartbeat){if(rmContext.isWorkPreservingRecoveryEnabled()&&!rmContext.isSchedulerReadyForAllocatingContainers()){returnnull;}longstartTime=System.nanoTime();// Backward compatible way to make sure previous behavior which allocation// driven by node heartbeat works.FiCaSchedulerNodenode=CandidateNodeSetUtils.getSingleNode(candidates);// We have two different logics to handle allocation on single node / multi// nodes.CSAssignmentassignment;if(!multiNodePlacementEnabled){ActivitiesLogger.NODE.startNodeUpdateRecording(activitiesManager,node.getNodeID());assignment=allocateContainerOnSingleNode(candidates,node,withNodeHeartbeat);
assignment=allocateContainerOnSingleNode(candidates,node,withNodeHeartbeat);returnallocateOrReserveNewContainers(candidates,withNodeHeartbeat);
privateCSAssignmentallocateOrReserveNewContainers(CandidateNodeSet<FiCaSchedulerNode>candidates,booleanwithNodeHeartbeat){CSAssignmentassignment=getRootQueue().assignContainers(getClusterResource(),candidates,newResourceLimits(labelManager.getResourceByLabel(candidates.getPartition(),getClusterResource())),SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);assignment.setSchedulingMode(SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY);submitResourceCommitRequest(getClusterResource(),assignment);
代码调用顺序是

schedule => cs.allocateContainersToNode

AI 辅助分析

http://www.jsqmd.com/news/1235943/

相关文章:

  • 2026年桌面线路整理品牌推荐、桌面集线器系列对比与场景应用 - 3158GEO
  • 河南登封市少林嵩山文武学校-招生简章 - Luckyone王
  • 2026年南京庭院喷灌系统怎么选才不踩坑?本地项目多不多看这份实情
  • 如何完全解锁Wand专业版:从2小时限制到永久免费的完整指南
  • 2026哈尔滨香坊区品牌首饰回收告别‘打包称重’:易奢福三十年材质解构体系,让你的蒂芙尼、梵克雅宝每一克都物尽其值! - 奢侈品回收实体店
  • 掌握技术面试的7个突破点:基于LeetCode-Questions-CompanyWise的深度解析
  • DeepONet处理分数阶微积分:1D Caputo导数案例详解
  • 一颗模组搞定回音+AI降噪+远场拾音+双麦定向,A-29P让音频通话产品“卷“到新高度
  • 如何高效实现实时开放词汇目标检测:YOLO-World语义分割的完整指南
  • 家长必看!2026河南十大正规文武武校排名,口碑实力双在线 - Luckyone王
  • Camellia核心组件解析:从架构到实现原理
  • 内存泄漏系列专题分析之二十八:内存占用测试report结果过程计算方式和Camera进程各种内存指标dump方式
  • 如何快速掌握通义千问:阿里云开源大语言模型的完整指南
  • PCSX2模拟器终极优化指南:5个简单步骤让你的PS2游戏流畅运行
  • Fontra:浏览器原生字体编辑器的现代安装与配置指南
  • 安徽省内公办国际预科班正式启动招生——官方首发 - 小张zc
  • 【学校官方实力介绍】嵩山少林寺释小龙武校到底怎么样?46年老牌名校硬核实力全解读 - Luckyone王
  • DeepONet实战案例:Antiderivative问题训练与测试完整流程
  • 终极实战指南:3步掌握Waymo自动驾驶数据集核心技术与应用
  • 内存泄漏系列专题分析之三十:dumpsys meminfo原理解析
  • 用 Codex 操控 Blender 做 3D 场景:从安装 addon 到跑通第一条指令
  • Akebi-GC:内存注入技术驱动的开源游戏增强框架深度解析
  • 内存泄漏系列专题分析之十六:高通相机CamX内存泄漏内存占用分析--chi-cdk部分ION内存拆解方法
  • delete-docker-registry-image:解决私有Docker仓库磁盘占用问题的终极工具
  • 2026西安除甲醛公司避坑指南:正规治理机构怎么挑?品牌、价格、资质一次讲透 - 商业测评
  • 2026上海半反半透LCD显示屏供应商排行一览 - 奔跑123
  • 延迟和丢包监控工具对比:运维场景下该怎么选
  • Java Diff Utils 终极企业级文本差异检测与处理完整解决方案
  • Chronotrains社区贡献指南:如何提交Pull Request和翻译新语言
  • 5步掌握YimMenuV2:GTA V模组开发终极免费指南