This repository has been archived by the owner on Feb 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
Increase the usage of MetaSpace in computing #85
Merged
TomorJM
merged 9 commits into
sofastack:feature.arklet_v1
from
sususama:feature.arklet_v1
Sep 27, 2023
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
34e9cce
Increase the usage of MetaSpace in computing
sususama d5aaeea
Merge branch 'sofastack:feature.arklet_v1' into feature.arklet_v1
sususama cbae98d
Merge branch 'sofastack:feature.arklet_v1' into feature.arklet_v1
sususama 9dfd8a9
fix import
sususama d0a68a8
add test
sususama ccccf62
fix
sususama 31262fe
fix
sususama a3dccdb
fix
sususama 5039b8b
fix
sususama File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,10 +16,11 @@ | |
*/ | ||
package com.alipay.sofa.serverless.arklet.core.command.record; | ||
|
||
import com.alipay.sofa.serverless.arklet.core.command.meta.InputMeta; | ||
import com.alipay.sofa.serverless.arklet.core.command.meta.bizops.ArkBizMeta; | ||
import org.apache.commons.lang3.StringUtils; | ||
|
||
import java.lang.management.ManagementFactory; | ||
import java.lang.management.MemoryPoolMXBean; | ||
import java.util.ArrayList; | ||
import java.util.Date; | ||
import java.util.List; | ||
|
@@ -58,10 +59,17 @@ public static List<ProcessRecord> getProcessRecordsByStatus(String status) { | |
|
||
public static ProcessRecord createProcessRecord(String rid, ArkBizMeta arkBizMeta) { | ||
ProcessRecord pr = new ProcessRecord(); | ||
List<MemoryPoolMXBean> memoryPoolMXBeans = ManagementFactory.getMemoryPoolMXBeans(); | ||
MemoryPoolMXBean metaSpaceMXBean = null; | ||
for (MemoryPoolMXBean memoryPoolMXBean : memoryPoolMXBeans) | ||
if (memoryPoolMXBean.getName().equals("Metaspace")) | ||
metaSpaceMXBean = memoryPoolMXBean; | ||
pr.setRequestId(rid); | ||
pr.setArkBizMeta(arkBizMeta); | ||
pr.setStatus(INITIALIZED); | ||
Date date = new Date(); | ||
pr.setMetaSpaceMXBean(metaSpaceMXBean); | ||
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. 可以使用static缓存metaSpaceMXBean,不要放在成员变量里 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. 我在这里将metaSpaceMXBean放进成员变量里是因为后面在ProcessRecord里面需要再次用到metaSpaceMXBean,如果不放的话可以每次用的时候都在memoryPoolMXBeans里面重新遍历出来metaSpaceMXBean |
||
pr.setStartSpace(metaSpaceMXBean.getUsage().getUsed()); | ||
pr.setStartTime(date); | ||
pr.setStartTimestamp(date.getTime()); | ||
processRecords.put(rid, pr); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
ProcessRecord只有在async时才有