当前位置:网站首页>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博客
边栏推荐
- Wave animation color five pointed star loader loading JS special effects
- 有没有大佬 遇到过flink监控postgresql数据库, 检查点无法使用的问题
- 1553B environment construction
- A Fletter version of Notepad
- 彩色五角星SVG动态网页背景js特效
- CV顶会最佳论文得主分享:好论文是怎么炼成的?
- Google Earth engine (GEE) - Global Human Settlements grid data 1975-1990-2000-2014 (p2016)
- 1553B环境搭建
- There are still many things to be done in the second half of the year
- I spent tens of thousands of dollars to learn and bring goods: I earned 3 yuan in three days, and the transaction depends on the bill
猜你喜欢
![[development of large e-commerce projects] performance pressure test - basic concept of pressure test & jmeter-38](/img/50/819b9c2f69534afc6dc391c9de5f05.png)
[development of large e-commerce projects] performance pressure test - basic concept of pressure test & jmeter-38

Operator-1 first acquaintance with operator

JS变色的乐高积木

硬件开发笔记(九): 硬件开发基本流程,制作一个USB转RS232的模块(八):创建asm1117-3.3V封装库并关联原理图元器件

Flow management technology

【大型电商项目开发】性能压测-压力测试基本概念&JMeter-38

一款Flutter版的记事本

Huawei HMS core joins hands with hypergraph to inject new momentum into 3D GIS

Based on the open source stream batch integrated data synchronization engine Chunjun data restore DDL parsing module actual combat sharing

JS discolored Lego building blocks
随机推荐
ZABBIX 6.0 source code installation and ha configuration
Apache-atlas-2.2.0 independent compilation and deployment
Some summary of pyqt5 learning (overview of the general meaning of some signals and methods)
Asp. NETCORE uses dynamic to simplify database access
Ustime wrote a bug
Update a piece of data from the database. Will CDC get two pieces of data with OP fields D and C at the same time? I remember before, only OP was U
Global and Chinese silicone defoamer production and marketing demand and investment forecast analysis report Ⓨ 2022 ~ 2027
5. Use of ly tab plug-in of header component
波浪动画彩色五角星loader加载js特效
硬件开发笔记(九): 硬件开发基本流程,制作一个USB转RS232的模块(八):创建asm1117-3.3V封装库并关联原理图元器件
Global and Chinese n-butanol acetic acid market development trend and prospect forecast report Ⓧ 2022 ~ 2028
Topic 2612: the real topic of the 12th provincial competition of the Blue Bridge Cup in 2021 - the least weight (enumerating and finding rules + recursion)
MHA high availability cluster deployment and failover of database
Jenkins+webhooks-多分支参数化构建-
Based on the open source stream batch integrated data synchronization engine Chunjun data restore DDL parsing module actual combat sharing
oracle cdc 数据传输时,clob类型字段,在update时值会丢失,update前有值,但
String input function
Three questions about scientific entrepreneurship: timing, pain points and important decisions
The stack size specified is too small, specify at least 328k
彩色五角星SVG动态网页背景js特效