-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-17019][Core] Expose on-heap and off-heap memory usage in various places #14617
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
2794daa
5f1fb3c
572cba6
f02b5ff
854116b
95574d5
a747089
80ed55f
60383b9
b30e7d0
643552c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -276,7 +276,8 @@ class BlockManagerMasterEndpoint( | |
|
|
||
| private def storageStatus: Array[StorageStatus] = { | ||
| blockManagerInfo.map { case (blockManagerId, info) => | ||
| new StorageStatus(blockManagerId, info.maxOnHeapMem, info.maxOffHeapMem, info.blocks.asScala) | ||
| new StorageStatus(blockManagerId, info.maxMem, Some(info.maxOnHeapMem), | ||
| Some(info.maxOffHeapMem), info.blocks.asScala) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add one more field |
||
| }.toArray | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,8 +37,11 @@ import org.apache.spark.internal.Logging | |
| @DeveloperApi | ||
| class StorageStatus( | ||
| val blockManagerId: BlockManagerId, | ||
| val maxOnHeapMem: Long, | ||
| val maxOffHeapMem: Long) { | ||
| // Explicitly adding this maxMemory field to handle maxOnHeapMem and maxOffHeapMem not | ||
| // existing issue, this happened when trying to replay old event log. | ||
| val maxMemory: Long, | ||
| val maxOnHeapMem: Option[Long], | ||
| val maxOffHeapMem: Option[Long]) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I find the comment you have here a little confusing. I'd get rid of it and put in something more like what you have where you create the The onHeap and offHeap memory are always defined for new applications, but they can be missing if we are replaying old event logs. |
||
|
|
||
| /** | ||
| * Internal representation of the blocks stored in this block manager. | ||
|
|
@@ -59,10 +62,11 @@ class StorageStatus( | |
| /** Create a storage status with an initial set of blocks, leaving the source unmodified. */ | ||
| def this( | ||
| bmid: BlockManagerId, | ||
| maxOnHeapMem: Long, | ||
| maxOffHeapMem: Long, | ||
| maxMemory: Long, | ||
| maxOnHeapMem: Option[Long], | ||
| maxOffHeapMem: Option[Long], | ||
| initialBlocks: Map[BlockId, BlockStatus]) { | ||
| this(bmid, maxOnHeapMem, maxOffHeapMem) | ||
| this(bmid, maxMemory, maxOnHeapMem, maxOffHeapMem) | ||
| initialBlocks.foreach { case (bid, bstatus) => addBlock(bid, bstatus) } | ||
| } | ||
|
|
||
|
|
@@ -175,10 +179,10 @@ class StorageStatus( | |
| def numRddBlocksById(rddId: Int): Int = _rddBlocks.get(rddId).map(_.size).getOrElse(0) | ||
|
|
||
| /** Return the max memory can be used by this block manager. */ | ||
| def maxMem: Long = maxOnHeapMem + maxOffHeapMem | ||
| def maxMem: Long = maxMemory | ||
|
|
||
| /** Return the memory remaining in this block manager. */ | ||
| def memRemaining: Long = onHeapMemRemaining + offHeapMemRemaining | ||
| def memRemaining: Long = maxMem - memUsed | ||
|
|
||
| /** Return the memory used by caching RDDs */ | ||
| def cacheSize: Long = onHeapCacheSize + offHeapCacheSize | ||
|
|
@@ -187,10 +191,10 @@ class StorageStatus( | |
| def memUsed: Long = onHeapMemUsed + offHeapMemUsed | ||
|
|
||
| /** Return the on-heap memory remaining in this block manager. */ | ||
| def onHeapMemRemaining: Long = maxOnHeapMem - onHeapMemUsed | ||
| def onHeapMemRemaining: Option[Long] = maxOnHeapMem.map(_ - onHeapMemUsed) | ||
|
|
||
| /** Return the off-heap memory remaining in this block manager. */ | ||
| def offHeapMemRemaining: Long = maxOffHeapMem - offHeapMemUsed | ||
| def offHeapMemRemaining: Option[Long] = maxOffHeapMem.map(_ - offHeapMemUsed) | ||
|
|
||
| /** Return the on-heap memory used by this block manager. */ | ||
| def onHeapMemUsed: Long = _nonRddStorageInfo.onHeapUsage + onHeapCacheSize | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -115,8 +115,9 @@ private[spark] object ExecutorsPage { | |
| val rddBlocks = status.numBlocks | ||
| val memUsed = status.memUsed | ||
| val maxMem = status.maxMem | ||
| val onHeapMemUsed = status.onHeapMemUsed | ||
| val offHeapMemUsed = status.offHeapMemUsed | ||
| // Only maxOnHeapMem and maxOffHeapMem are defined these two fields are not None. | ||
|
||
| val onHeapMemUsed = status.maxOnHeapMem.map(_ => status.onHeapMemUsed) | ||
| val offHeapMemUsed = status.maxOffHeapMem.map(_ => status.offHeapMemUsed) | ||
| val maxOnHeapMem = status.maxOnHeapMem | ||
| val maxOffHeapMem = status.maxOffHeapMem | ||
| val diskUsed = status.diskUsed | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These fields now change to Option, it will not be printed out for old event log.