brumi1024 commented on code in PR #8799:
URL: https://github.com/apache/hadoop/pull/8799#discussion_r4237383195


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestCapacitySchedulerConfigBenchmark.java:
##########
@@ -0,0 +1,234 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.StandardOpenOption;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.test.GenericTestUtils;
+import org.apache.hadoop.yarn.conf.YarnConfiguration;
+import org.apache.hadoop.yarn.server.resourcemanager.MockRM;
+import org.apache.hadoop.yarn.server.resourcemanager.NodeAttributeTestUtils;
+import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
+import org.apache.hadoop.yarn.server.resourcemanager.scheduler.QueueMetrics;
+import 
org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler;
+import org.junit.jupiter.api.Test;
+import org.slf4j.event.Level;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
+
+/**
+ * Capacity Scheduler configuration benchmark: scheduler load, queue refresh
+ * and configuration validation on generated trees of
+ * {@link CSConfigBenchmarkGenerator}.
+ *
+ * <p>It only runs with {@code -DRunCapacitySchedulerConfigBenchmark=true}.
+ * Each size should run in its own JVM, and each fork is a separate Maven
+ * invocation, for example three forks of every size:</p>
+ * <pre>
+ * 
RM=hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager
+ * for fork in 1 2 3; do for size in 10 100 1000 5000; do
+ *   ./mvnw -o test -pl $RM -Dtest=TestCapacitySchedulerConfigBenchmark \
+ *     -DRunCapacitySchedulerConfigBenchmark=true -Dcs.bench.sizes=$size \
+ *     -Dcs.bench.fork=$fork -Dcs.bench.out=/tmp/cs-bench.txt
+ * done; done
+ * </pre>
+ * <p>Properties:</p>
+ * <ul>
+ *   <li>{@code cs.bench.sizes}: requested queue counts, default
+ *   {@code 10,100,1000,5000};</li>
+ *   <li>{@code cs.bench.warmups} (default 2) and {@code cs.bench.iterations}
+ *   (default 5) per operation; the median of the iterations is reported;</li>
+ *   <li>{@code cs.bench.ops}: subset of {@code scheduler-load},
+ *   {@code refresh} and {@code validate}, default all;</li>
+ *   <li>{@code cs.bench.validators}: implementations measured by the
+ *   {@code validate} operation, default {@code legacy}
+ *   ({@link CapacitySchedulerConfigValidator#validateCSConfiguration}, the
+ *   core of {@code POST /scheduler-conf/validate}); any other entry is the
+ *   class name of a {@link ProposalValidator} with a no-argument constructor,
+ *   which is the hook for {@code validate/v2};</li>
+ *   <li>{@code cs.bench.capacityMode}: a
+ *   {@link CSConfigBenchmarkGenerator.CapacityMode}, default
+ *   {@code PCT_WEIGHT_MIXED};</li>
+ *   <li>{@code cs.bench.fork}: label printed with the results;</li>
+ *   <li>{@code cs.bench.out}: file the {@code BENCH} result lines are
+ *   appended to (they are always printed to standard output).</li>
+ * </ul>
+ * <p>Operations: {@code scheduler-load} initializes a fresh
+ * {@link CapacityScheduler} from the configuration, {@code refresh}
+ * reinitializes the running scheduler with the unchanged configuration (what
+ * {@code AdminService.refreshQueues} does after loading the file), and
+ * {@code validate} validates a proposal that moves one percent of capacity

Review Comment:
   Done.



-- 
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]

Reply via email to