-
Notifications
You must be signed in to change notification settings - Fork 587
HDDS-9988. SCM UI shows storage usage percentage #5882
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
Conversation
|
ci: https://github.com/jianghuazhu/ozone/actions/runs/7348062465 Can you help review this PR, @adoroszlai @hemantk-12 . |
|
Can you help review this PR, @aswinshakil @fapifta @szetszwo . |
xBis7
left a comment
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.
@jianghuazhu Thanks for the patch. I've left a comment.
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/SCMNodeManager.java
Outdated
Show resolved
Hide resolved
|
Can you help review this pr again, @xBis7 . |
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.
@jianghuazhu Thanks for updating the patch. I have some suggestions for optimizing the test.
hadoop-hdds/server-scm/src/main/resources/webapps/scm/scm-overview.html
Outdated
Show resolved
Hide resolved
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestSCMNodeManager.java
Show resolved
Hide resolved
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestSCMNodeManager.java
Outdated
Show resolved
Hide resolved
There is a sort function. I don't know if it works for every column though. That needs to be checked.
It can be useful to have such information in one place, but if it's out of scope then it should be done as part of another jira. Tickets with narrow scope are easier for people to review.
As long as the PR changes are within scope, I'm ok with them. |
xBis7
left a comment
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.
@jianghuazhu Thanks for making the changes. I went over the code once more.
I also tested it locally in docker. It looks good but Recon displays a different percentage than SCM UI. It could be due to the docker dev env and I don't have an available cluster at the moment, to load the patch. If you can verify that there is no issue.
Can you check the CI failure?
https://github.com/jianghuazhu/ozone/actions/runs/7461358714
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/SCMNodeManager.java
Outdated
Show resolved
Hide resolved
|
Thanks @xBis7 and @whbing . Newly added columns can be sorted. |
|
Can you help me take a look at this PR again, @xBis7 . |
xBis7
left a comment
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.
I also tested it locally in docker. It looks good but Recon displays a different percentage than SCM UI. It could be due to the docker dev env and I don't have an available cluster at the moment, to load the patch. If you can verify that there is no issue.
@jianghuazhu Can you also verify this? If it's an issue we will file a new jira.
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/SCMNodeManager.java
Outdated
Show resolved
Hide resolved
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestSCMNodeManager.java
Outdated
Show resolved
Hide resolved
|
I found some problems. Here's an explanation of some important data: In Recon UI, the calculation formula of percentage is used for storage: (1.7 + 1.6) / 130.9. However, the output result here does not retain decimal places, so the final result is 3%. In the SCM UI, the calculation formula for storage usage percentage is: 1.7 / 130.9. In the final output result, we retain 1 decimal place, so the final result is 1.3%. It should be pointed out that Non Ozone Used is not the actual storage capacity used by Ozone. |
Where does |
|
In our test cluster, each node is configured with 12 disks, and each disk stores Ozone data and HDFS data respectively. For example, one of the disk directories: I understand that Non Ozone Used here refers to the storage capacity used by HDFS and the data used by other programs. |
|
Thanks for testing it out. Capacity refers to the entire disk space, right? It's not just Ozone disk space. If there is a lot of space from the total capacity, occupied by non Ozone files, and the SCM UI doesn't report it, then the e.g.
In that scenario, you have
Is there an easy way to include that number in the SCM UI? |
|
As you can see now, the percentages shown in the Recon UI represent node disk usage, not just Ozone usage, which is an extension of Ozone. @xBis7 , what do you think? |
|
That's why I asked about capacity. Is it referring to the entire disk or just Ozone? |
|
I think the percentage of storage usage here is relative to the entire disk. |
|
I have an idea. Here’s an explanation of some key data: |
|
@jianghuazhu The latest approach looks good. Displaying |
|
@xBis7 , I've updated. |
|
@jianghuazhu Sorry for not been clear. With Otherwise, changes look good. After that change, I'll open up the PR Ci. |
|
Thanks @xBis7 . |
xBis7
left a comment
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.
@jianghuazhu Thanks for the changes, LGTM!
|
@xBis7 @adoroszlai , do you have any new suggestions for this PR? |
|
@jianghuazhu Let's wait to see if @adoroszlai has any comments. Otherwise, it can be merged. |
adoroszlai
left a comment
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.
Thanks @jianghuazhu for working on this.
| usedPercentage = Double.valueOf(decimalFormat.format(usedPerc)); | ||
| nonUsedPercentage = Double.valueOf(decimalFormat.format(nonUsedPerc)); |
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.
Here we format the value, then parse it as double. The caller then simply concatenates them into the final text being displayed. I think formatting may be lost this way.
I think calculateStoragePercentage() should return the formatted String instead.
If there are no reports, return "N/A", since we have no information.
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.
I will update soon.
| double scmUsedPerc = storagePercentage[0]; | ||
| double nonScmUsedPerc = storagePercentage[1]; | ||
| map.put(usedSpacePercent, | ||
| "scmUsed: " + scmUsedPerc + "%, nonScmUsed: " + nonScmUsedPerc + "%"); |
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.
I'm not sure "scmUsed" and "nonScmUsed" are clear enough for users. Also, the table header already says "Used Space Percent".
How about "Ozone: ... , other: ..."?
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.
Is there a definite way of expressing this?
Then we display 'Ozone: ... , other: ...'?
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.
Can you please clarify the question?
My suggestion is to change the value displayed in table cells:
-scmUsed: 12.34%, nonScmUsed: 1.23%
+Ozone: 12.34%, other: 1.23%(... are just placeholders in my previous comment)
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.
Okay, I will update it.
| private final String usedSpacePercent = "USEDSPACEPERCENT"; | ||
| private final String totalCapacity = "CAPACITY"; |
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 should be constants. (The existing ones, too, but those are being fixed in HDDS-10152.)
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.
@adoroszlai , do we need to wait for HDDS-10152 to be resolved?
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.
No, I don't think we need to wait.
(However, I'd like to get HDDS-10157 fixed before merging anything else, since CI is failing in native check.)
| String capacityResult = nodeManager.calculateStorageCapacity(dni); | ||
| assertEquals(capacityResult, totalCapacity); |
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.
Please follow assertEquals(expected, actual) argument order.
| * @param dni DataNode node that needs to be calculated. | ||
| * @return | ||
| */ | ||
| public String calculateStorageCapacity(DatanodeInfo dni) { |
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.
Both new calculate methods can be static and take List<StorageReportProto> as parameter instead of DatanodeInfo.
This allows the test to be much simpler (see other comment on the test for details).
| OzoneConfiguration conf = getConf(); | ||
| conf.setTimeDuration(OZONE_SCM_HEARTBEAT_PROCESS_INTERVAL, 1000, | ||
| MILLISECONDS); | ||
| try (SCMNodeManager nodeManager = createNodeManager(conf)) { | ||
| EventQueue eventQueue = (EventQueue) scm.getEventQueue(); | ||
| LayoutVersionManager versionManager = | ||
| nodeManager.getLayoutVersionManager(); | ||
| LayoutVersionProto layoutInfo = toLayoutVersionProto( | ||
| versionManager.getMetadataLayoutVersion(), | ||
| versionManager.getSoftwareLayoutVersion()); | ||
| DatanodeDetails dn = MockDatanodeDetails.randomDatanodeDetails(); | ||
| UUID dnId = dn.getUuid(); | ||
| List<StorageReportProto> reports = volumeCount > 0 ? | ||
| generateStorageReportProto(volumeCount, dnId, perCapacity, | ||
| used, remaining) : null; | ||
| nodeManager.register(dn, reports != null ? | ||
| HddsTestUtils.createNodeReport(reports, emptyList()) : null, null); | ||
| nodeManager.processHeartbeat(dn, layoutInfo); | ||
| eventQueue.processAll(8000L); | ||
| NodeStateManager nodeStateManager = nodeManager.getNodeStateManager(); | ||
| List<DatanodeInfo> dataNodeInfoList = nodeStateManager.getAllNodes(); | ||
| DatanodeInfo dni = dataNodeInfoList.get(0); |
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.
If calculate... methods are changed as suggested, all we need here is:
List<StorageReportProto> reports = volumeCount > 0 ?
generateStorageReportProto(volumeCount, dnId, perCapacity,
used, remaining) : null;
|
@adoroszlai , I've updated it. |
|
Thanks @jianghuazhu for improving the patch. |
|
@dombizita would you like to take a look, too? |
dombizita
left a comment
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.
Thanks for working on this @jianghuazhu, it looks good to me! I also tested it locally and it looks as expected.
|
Thanks @dombizita . |
|
Thanks @jianghuazhu for the patch, @dombizita, @xBis7 for the review. |










What changes were proposed in this pull request?
Now, the SCM web ui does not show how much storage percentage is used by each DataNode node, the purpose of this PR is to make up for it.

What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-9988
How was this patch tested?
The SCM web ui can display the storage percentage used by each DataNode node.