- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我提出了一个关于 Spark 的非常愚蠢的问题,因为我想消除我的困惑。我是 Spark 的新手,仍在尝试了解它的内部工作原理。
比如说,如果我有一个输入文件列表(假设 1000 个),我想在某处处理或写入,并且我想使用合并将我的分区数减少到 100。
现在我用 12 个执行器运行这个作业,每个执行器有 5 个核心,这意味着它运行时有 60 个任务。这是否意味着每项任务都将独立地在一个分区上工作?
Round: 1 12 executors each with 5 cores => 60 tasks process 60 partitions
Round: 2 8 executors each with 5 cores => 40 tasksprocess the rest of the 40 partitions and 4 executors never place a job for the 2nd time
或者来自同一个执行器的所有任务将在同一个分区上工作?
Round: 1: 12 executors => process 12 partitions
Round: 2: 12 executors => process 12 partitions
Round: 3: 12 executors => process 12 partitions
....
....
....
Round: 9 (96 partitions already processed): 4 executors => process the remaining 4 partitions
最佳答案
Say, if I have a list of input files(assume 1000) which I want to process or write somewhere and I want to use coalesce to reduce my partition number to 100.
在spark中默认number of partitions
= hdfs blocks
,因为指定了coalesce(100)
,Spark会将输入数据分成100分区。
Now I run this job with 12 executors with 5 cores per executor, that means 60 tasks when it runs. Does that mean, each of the tasks will work on one single partition independently?
当你通过时,可能也会通过。
--num-executors 12
:要在应用程序中启动的执行程序数。
--executor-cores 5
:每个执行器的内核数。 一次 1 个核心 = 1 个任务
所以分区的执行是这样的。
12 个分区 将由 12 个执行器处理,每个执行器有 5 个任务(线程)。
12 个分区 将由 12 个执行器处理,每个执行器有 5 个任务(线程)。
.
.
.
4 个分区 将由 4 个执行器处理,每个执行器有 5 个任务(线程)。
注意:通常,一些执行者可能会快速完成分配的工作(各种参数,如 data locality 、网络 I/O、CPU 等)。因此,它将通过等待配置的调度时间来选择下一个要处理的分区。
关于hadoop - Spark 合并与执行者和核心数量的关系,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38465692/
所以我有一个排行榜,我每天使用以下查询有效地获取每个用户的分数: SELECT DATE(a.time) as time, a.userid, SUM(activity_weight) as weig
假设我有一个 ExecutorService(它可以是一个线程池,因此涉及到并发性),它在不同的时间执行一个任务,或者周期性地或者响应一些其他条件。要执行的任务如下: 如果此任务已在进行中,则什么也不
我正在运行的服务器应用程序收到多个任务请求,我想使用任务系统处理这些请求。 每个任务都表示为一个 Runnable,它将从线程池中请求 n 个线程,其中 n 小于或等于线程池大小。为了不线程过多导致
我有一个 long_task 函数,它运行大量 cpu 绑定(bind)计算,我想通过使用新的 asyncio 框架使其异步。生成的 long_task_async 函数使用 ProcessPoolE
Java 文档说 CompletableFuture:supplyAsync(Supplier supplier)在 ForkJoinPool#commonPool() 中运行任务而 Completa
我想了解 Spark Streaming 中的一个基本知识。我有 50 个 Kafka 主题分区和 5 个执行程序,我使用的是 DirectAPI,所以没有。 RDD 分区的数量将为 50。如何在 5
我的问题与 this one here 密切相关.正如在那里发布的那样,我希望主线程等到工作队列为空并且所有任务都已完成。然而,我的情况的问题是,每个任务都可能递归地导致提交新任务进行处理。这使得收集
我是一名优秀的程序员,十分优秀!