当我 运行 内存不足以使用 mapWithState 维护状态时会发生什么
What happens when I run out of memory to maintain the state with mapWithState
我有很多键和有限的簇大小。
我正在使用 mapWithState
来更新我的状态。随着新数据的到来,键的数量也会增加。当我转到 spark 的存储选项卡时 UI MapWithStateRDD
始终存储在内存中。
源代码第109行MapWithStateDstream.Scala
当存储级别设置为 MEMORY_ONLY 时调用方法 persist。
这是否意味着如果我的键太多,我的应用程序就会崩溃?
when i went to the storage tab of the spark UI MapWithStateRDD is
always stored in memory
Spark 使用自己的 HashMap
实现(称为 OpenHashMapBasedStateMap
)来内部存储状态。这意味着值存储在 内存 中,而不是持久存储中。
Does this mean my application will crash if I have too many keys?
这意味着您的集群需要有足够的资源来同时存储所有密钥,因为状态是持久化的内存。如果你的能力有限,你需要优化你保存的状态以确保它们都适合。否则,考虑为你的状态使用外部持久存储。
我有很多键和有限的簇大小。
我正在使用 mapWithState
来更新我的状态。随着新数据的到来,键的数量也会增加。当我转到 spark 的存储选项卡时 UI MapWithStateRDD
始终存储在内存中。
源代码第109行MapWithStateDstream.Scala 当存储级别设置为 MEMORY_ONLY 时调用方法 persist。 这是否意味着如果我的键太多,我的应用程序就会崩溃?
when i went to the storage tab of the spark UI MapWithStateRDD is always stored in memory
Spark 使用自己的 HashMap
实现(称为 OpenHashMapBasedStateMap
)来内部存储状态。这意味着值存储在 内存 中,而不是持久存储中。
Does this mean my application will crash if I have too many keys?
这意味着您的集群需要有足够的资源来同时存储所有密钥,因为状态是持久化的内存。如果你的能力有限,你需要优化你保存的状态以确保它们都适合。否则,考虑为你的状态使用外部持久存储。