Gargi-jais11 commented on code in PR #9858:
URL: https://github.com/apache/ozone/pull/9858#discussion_r2910788272
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/scm/node/TestDiskBalancerPolicyPerformance.java:
##########
@@ -181,90 +177,165 @@ private void testPolicyPerformance(String policyName,
ContainerChoosingPolicy po
for (int i = 0; i < NUM_THREADS; i++) {
executor.submit(() -> {
try {
- long threadStart = System.nanoTime();
- int containerChosen = 0;
- int containerNotChosen = 0;
+ int containerCandidateChosen = 0;
+ int containerCandidateNotChosen = 0;
int failures = 0;
- // Choose a random volume
- HddsVolume srcVolume = volumes.get(rand.nextInt(NUM_VOLUMES));
- HddsVolume destVolume;
-
- do {
- destVolume = volumes.get(rand.nextInt(NUM_VOLUMES));
- } while (srcVolume.equals(destVolume));
for (int j = 0; j < NUM_ITERATIONS; j++) {
+ // Block all volumes except the highest-util (source) - no
destination has space
+ if (rand.nextDouble() < 0.05 && volumes.size() >= 2) {
+ List<HddsVolume> sorted = new ArrayList<>(volumes);
+ sorted.sort(Comparator.comparingDouble(v ->
+ v.getCurrentUsage().getUsedSpace() / (double) Math.max(1,
v.getCurrentUsage().getCapacity())));
+ for (int k = 0; k < sorted.size() - 1; k++) {
+ HddsVolume v = sorted.get(k);
+ long avail = v.getCurrentUsage().getAvailable();
+ if (avail > 0) {
+ v.incCommittedBytes(avail);
Review Comment:
Yes. With 5% probability per iteration, the first block-all is expected
around iteration 20. When it runs, it blocks 19 of 20 volumes (all except the
highest-utilization one) and they stays blocked because there is no unblock
step. So in theory most volumes would be full after a few iterations.
In practice, the test shows 99,970 chosen vs 30 null, so block-all is not
having the expected effect. That’s likely because block-all sorts by raw
usedSpace/capacity, while the policy sorts by effective utilization (including
deltaMap). The “highest” volume can differ, so we may be blocking volumes that
the policy still treats as valid destinations.
Actually I am looking closely to make this performance test look more
realistic.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]