当前位置:网站首页>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博客
边栏推荐
- The popular major I chose became "Tiankeng" four years later
- Apache-Atlas-2.2.0 独立编译部署
- leetcode 322. Coin Change 零钱兑换(中等)
- Jenkins+webhooks- multi branch parametric construction-
- 启动solr报错The stack size specified is too small,Specify at least 328k
- Example code of second kill based on MySQL optimistic lock
- 北斗通信模块 北斗gps模块 北斗通信终端DTU
- CV顶会最佳论文得主分享:好论文是怎么炼成的?
- Report on the "14th five year plan" and investment strategy recommendations for China's industrial robot industry 2022 ~ 2028
- Global and Chinese silicone defoamer production and marketing demand and investment forecast analysis report Ⓨ 2022 ~ 2027
猜你喜欢

我选的热门专业,四年后成了“天坑”

Function test process in software testing

Simple two ball loading

Redis explores cache consistency

Flow management technology

数据库之MHA高可用集群部署及故障切换

Operator-1初识Operator

Google Earth engine (GEE) - Global Human Settlements grid data 1975-1990-2000-2014 (p2016)

Hardware development notes (9): basic process of hardware development, making a USB to RS232 module (8): create asm1117-3.3v package library and associate principle graphic devices

Terminal identification technology and management technology
随机推荐
Vs code setting Click to open a new file window without overwriting the previous window
我选的热门专业,四年后成了“天坑”
How can genetic testing help patients fight disease?
简单的两个圆球loading加载
Shell script imports stored procedures into the database
CV顶会最佳论文得主分享:好论文是怎么炼成的?
Simple two ball loading
China NdYAG crystal market research conclusion and development strategy proposal report Ⓥ 2022 ~ 2028
Report on the current situation and development trend of bidirectional polypropylene composite film industry in the world and China Ⓟ 2022 ~ 2028
minimum spanning tree
Class initialization and instantiation
Look at the sky at dawn and the clouds at dusk, and enjoy the beautiful pictures
Function test process in software testing
基于mysql乐观锁实现秒杀的示例代码
华为HMS Core携手超图为三维GIS注入新动能
Quickly understand what the compressed list in redis is
Apache-atlas-2.2.0 independent compilation and deployment
Operator-1初识Operator
MySQL gap lock
Report on the 14th five year plan and future development trend of China's integrated circuit packaging industry Ⓓ 2022 ~ 2028