当前位置:网站首页>spark源码阅读总纲
spark源码阅读总纲
2022-07-01 13:00:00 【Interest1_wyt】
spark使用了这么长时间,对于driver、master、worker、BlockManage、RDD、DAGScheduler、TaskScheduler这些概念或多或少都了解一些,但是对于其任务的提交,driver、application的调度与注册,资源的分配,executor的创建,job到stage再到task的切分过程,hdfs文件数据的读写操作,RDD本身的map reduce操作,持久化、check point的高可靠性容错性的实现等都没有一个系统和深入的了解,所以准备写个系列的文章,从源码角度探查下这些问题,以此加深对于spark的理解。这里只是列出了我目前感兴趣的点,后期如果有其它想研究的源码点,也会陆续加入该总纲和后面的系列文章中。
我虚拟机中安装的是spark3.0.1版本,所以源码我下载的也是这个。另外因为spark源码过多,为了更有效率的阅读,避免出现读懵的情况,所以我先列出了自己感兴趣的问题点,在源码阅读中也主要是以解决这些问题为主线。问题列表如下:
1、spark-submit如何将jar以及配置参数提交给spark服务器
2、spark如何启动driver、application注册、executor构建命令拼装
3、spark 如何进行driver、executor(application)任务的调度,以及executor向driver的注册
4、executor在worker上的创建过程,其本质是什么,是线程池吗?
5、DAGScheduler TaskScheduler如何配合提交任务,application、job、stage、taskset、task对应关系是什么?
6、spark如何通过BlockManager控制数据的读写(待整理)
7、持久化、缓存、checkpoint功能区别和原理(待整理)
源码阅读中会有各种各样的名词术语,这里统一放到总纲中介绍:
Master:spark集群的主节点,管理spark其它节点的资源调度。
Worker:spark集群的工作节点,根据master主节点的管理,其创建并分配一定资源给executor。
Executor:spark最底层的工作线程池,由worker创建和分配资源。其要执行的工作由driver分发。
Driver:用户提交的应用程序代码在spark中运行起来就是一个driver,他是一个特殊的excutor进程,这个进程除了一般excutor都具有的运行环境外,还运行着DAGscheduler Tasksheduler Schedulerbackedn等组件。
Application:用户提交任务执行的总称。
Job:由Action算子触发生成的由一个或者多个stage组成的计算作业
DAGScheduler:根据job构建基于stage的DAG,其切分stage的依据是是否有shuffle操作发生。该对象会将各个stage提交给TaskScheduler进行进一步的任务切分。
stage:job下一级的任务操作粒度,由DAGScheduler依据是否有shuffle操作进行切分
TaskScheduler:接收DAGScheduler传过来的stage,将其转换成taskset任务集(taskset的内容和stage内容相同),最后将Taskset下发给executor进行处理
TaskSet:stage的下一级任务操作粒度,由TaskScheduler生成,其内容和stage内容相同,生成依据是数据的分区数,有几个分区,taskset里面就有几个task。stage转换成taskset的主要目的就是提高数据处理的并行度。
Task:TaskSet集合中的元素,也是最小的可执行任务粒度,由executor调度执行。
RDD:弹性分布式数据集,可以简单的理解为一个数据集合
BlockManager:spark中的文件管理器,管理spark中数据的读写io操作
CheckPoint:将数据持久化到hdfs类似的分布式文件系统上,这样即使本地的持久化数据丢失了,仍然可以从hdfs中获取,增加了系统的高可用和容错特性
另外我们这一系列的源码追踪过程,都是基于一个WordCount程序的远程debug,该wordCount的具体信息和远程debug方式可以参考这篇文章:IDEA远程调试spark-submit提交的jar_Interest1_wyt的博客-CSDN博客
边栏推荐
- Terminal identification technology and management technology
- SVG钻石样式代码
- 【开发大杀器】之Idea
- 有没有大佬 遇到过flink监控postgresql数据库, 检查点无法使用的问题
- Operator-1初识Operator
- Detailed explanation of OSPF LSA of routing Foundation
- Nexus builds NPM dependent private database
- Run PowerShell script prompt "because running script is prohibited on this system" solution
- Jenkins+webhooks-多分支参数化构建-
- Shell script imports stored procedures into the database
猜你喜欢
随机推荐
终端识别技术和管理技术
VM virtual machine configuration dynamic IP and static IP access
Report on the current situation and development trend of bidirectional polypropylene composite film industry in the world and China Ⓟ 2022 ~ 2028
Sharing with the best paper winner of CV Summit: how is a good paper refined?
Report on the "14th five year plan" and investment strategy recommendations for China's industrial robot industry 2022 ~ 2028
What is the future development direction of people with ordinary education, appearance and family background? The career planning after 00 has been made clear
Beidou communication module Beidou GPS module Beidou communication terminal DTU
Jenkins+webhooks- multi branch parametric construction-
华为HMS Core携手超图为三维GIS注入新动能
Fiori 应用通过 Adaptation Project 的增强方式分享
1553B环境搭建
MySQL报错1040Too many connections的原因以及解决方案
5G工业网关的科技治超应用 超限超重超速非现场联合执法
leetcode 322. Coin Change 零钱兑换(中等)
Fiori applications are shared through the enhancement of adaptation project
数字化转型再下一城,数字孪生厂商优锘科技宣布完成超3亿元融资
Apache-atlas-2.2.0 independent compilation and deployment
Redis exploration: cache breakdown, cache avalanche, cache penetration
Declare an abstract class vehicle, which contains the private variable numofwheel and the public functions vehicle (int), horn (), setnumofwheel (int) and getnumofwheel (). Subclass mot
shell脚本导入存储过程到数据库







