关注 spark技术分享,
撸spark源码 玩spark最佳实践

BroadcastManager

BroadcastManager

Broadcast Manager (BroadcastManager) is a Spark service to manage broadcast variables in Spark. It is created for a Spark application when SparkContext is initialized and is a simple wrapper around BroadcastFactory.

BroadcastManager tracks the number of broadcast variables in a Spark application (using the internal field nextBroadcastId).

The idea is to transfer values used in transformations from a driver to executors in a most effective way so they are copied once and used many times by tasks (rather than being copied every time a task is launched).

When initialized, BroadcastManager creates an instance of TorrentBroadcastFactory.

stop Method

Caution
FIXME

Creating BroadcastManager Instance

Caution
FIXME

Initializing BroadcastManager — initialize Internal Method

Note
initialize is executed only once (when BroadcastManager is created) and controlled by the internal initialized flag.

newBroadcast Method

newBroadcast simply requests the current BroadcastFactory for a new broadcast variable.

Note
The BroadcastFactory is created when BroadcastManager is initialized.
Note
newBroadcast is executed for SparkContext.broadcast method and when MapOutputTracker serializes MapStatuses.

Settings

Table 1. Settings
Name Default value Description

spark.broadcast.blockSize

4m

The size of a block (in kB when unit not specified).

Used when TorrentBroadcast stores brodcast blocks to BlockManager.

spark.broadcast.compress

true

The flag to enable compression.

Refer to CompressionCodec.

Used when TorrentBroadcast is created and later when it stores broadcast blocks to BlockManager. Also in SerializerManager.

赞(0) 打赏
未经允许不得转载:spark技术分享 » BroadcastManager
分享到: 更多 (0)

关注公众号:spark技术分享

联系我们联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏