惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - MOBIN

播面--八股文利器:播客形式讲解八股文,文本题库永久免费! Docker部署Apollo配置中心 Actor模型原理 java并发编程--Runnable Callable及Future Spark Yarn-cluster与Yarn-client Hive集成HBase详解 Hive MapJoin Hive2.0函数大全(中文版) 深度剖析JDK动态代理机制 HBase二级索引的设计 通过BulkLoad的方式快速导入海量数据 Phoenix二级索引(Secondary Indexing)的使用 java并发编程--Executor框架 Spark常用函数讲解之Action操作 Java并发编程--Volatile详解 Spark常用函数讲解之键值RDD转换 图解堆排序 Spark函数详解系列之RDD基本转换 深入理解Scala的隐式转换
Spark Accumulators
MOBIN · 2016-12-05 · via 博客园 - MOBIN

概述

Accumulator即累加器,与Mapreduce counter的应用场景差不多,都能很好地观察task在运行期间的数据变化,Spark中的Accumulator各task可以对Accumulator值进行累加,但是最终的返回值只能在Driver端获取,同时原生支持Int和Double类型的Accumulator,也支持对Accumulator自定义类型及命名,以便我们更好的对程序进行调优

Accumulator能解决哪些问题?

1.能精确地统计数据的各种属性。例如可以统计出符合user ID的记录数,在一个时间段内产生了多少次购买,通常我们在ETL使用Accumulator去统计出各种属性的数据

2.轻量级的调试工具,能观测到每个task的信息。如通过Accumulator可以在Spark UI观测到每个task所处理的记录数,如下图 

3.从集群的资源利用率来精确的测量出Spark应用的资源利用率,如通过Accumulator可以很以知道有多少的数据是来自HDFS,shuffle所处理的数据量如何以及RDD的重新计算次数,这些都是我们Spark应用调优的有利信息

使用Accumulator的注意事项

在Action算子中更新Accumulator,Spark保证在每个task对Accumulator只进行一次累加,即便是task重启也是如此,但注意在如果Accumulator是在transformation算子进行累加的,那么一旦task失败或被重启,则Accumulator会被累加多次