[ 
https://issues.apache.org/jira/browse/HDFS-17506?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17845185#comment-17845185
 ] 

ASF GitHub Bot commented on HDFS-17506:
---------------------------------------

ferhui commented on code in PR #6806:
URL: https://github.com/apache/hadoop/pull/6806#discussion_r1596215333


##########
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/fgl/FSNLockBenchmarkThroughput.java:
##########
@@ -0,0 +1,269 @@
+/**
+ * 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.hdfs.server.namenode.fgl;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FSDataOutputStream;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.permission.FsPermission;
+import org.apache.hadoop.hdfs.HdfsConfiguration;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.ThreadLocalRandom;
+
+/**
+ * This class benchmarks the throughput of NN for both global-lock and 
fine-grained lock.
+ */
+public class FSNLockBenchmarkThroughput {
+
+  private final int readWriteRatio;
+  private final int testingCount;
+  private final ExecutorService executorService;
+  private final FileSystem fileSystem;
+
+  public FSNLockBenchmarkThroughput(FileSystem fileSystem,
+      int readWriteRatio, int testingCount, int concurrency) {
+    this.fileSystem = fileSystem;
+    this.readWriteRatio = readWriteRatio;
+    this.testingCount = testingCount;
+    this.executorService = Executors.newFixedThreadPool(concurrency);
+  }
+
+  public void benchmark(String lockName) throws Exception {
+    System.out.println("Do benchmark for " + lockName);
+    Path basePath = new Path("/tmp/fsnlock/benchmark/throughput");

Review Comment:
   How about making the path as an input? if no input, can set a default path.





> [FGL] Performance for phase 1
> -----------------------------
>
>                 Key: HDFS-17506
>                 URL: https://issues.apache.org/jira/browse/HDFS-17506
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>            Reporter: ZanderXu
>            Priority: Major
>              Labels: pull-request-available
>
> Do some benchmark testing for phase 1.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to