You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2022/07/26 20:48:24 UTC

[GitHub] [ozone] kerneltime commented on a diff in pull request #3614: HDDS-6997. Add support for "echo" lookup to measure raw performance in OM

kerneltime commented on code in PR #3614:
URL: https://github.com/apache/ozone/pull/3614#discussion_r930391777


##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/protocol/ClientProtocol.java:
##########
@@ -701,6 +701,17 @@ TenantUserList listUsersInTenant(String tenantId, String prefix)
    */
   String getCanonicalServiceName();
 
+  /**
+   * Freon api to send request with or without payload to OM
+   * to benchmark RPC request performance.
+   *
+   * @param payload payload
+   * @throws IOException if there is error in the RPC communication
+   * @return response in bytes.
+   */
+  byte[] postRPCReq(byte[] payload, boolean emptyResp) throws IOException;

Review Comment:
   ```suggestion
     byte[] echoRPC(byte[] payload, boolean emptyResp) throws IOException;
   ```



##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmRPCLoadGenerator.java:
##########
@@ -0,0 +1,110 @@
+/*
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.ozone.freon;
+
+import com.codahale.metrics.Timer;
+import org.apache.commons.lang3.RandomUtils;
+import org.apache.hadoop.hdds.cli.HddsVersionProvider;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+import org.apache.hadoop.ozone.client.rpc.RpcClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.concurrent.Callable;
+import picocli.CommandLine.Command;
+import picocli.CommandLine.Option;
+
+/**
+ * Utility to generate RPC request to OM with or without payload.
+ */
+@Command(name = "om-rpc-load",
+        aliases = "rpcl",
+        description =
+                "Generate random RPC request to the OM " +
+                        "with or without layload.",
+        versionProvider = HddsVersionProvider.class,
+        mixinStandardHelpOptions = true,
+        showDefaultValues = true)
+public class OmRPCLoadGenerator extends BaseFreonGenerator
+        implements Callable<Void> {
+
+  private static final Logger LOG =
+          LoggerFactory.getLogger(OmRPCLoadGenerator.class);
+
+  private static final int MULTIPLICATION_FACTOR = 1000;
+
+  private Timer timer;
+
+  @Option(names = {"-p", "--payload"},
+          description =
+                  "Specifies the size of payload in KB in each RPC request.",
+          defaultValue = "1")
+  private int payloadSizeKB = 1;
+
+  @Option(names = {"-erq", "--empty-req"},
+          description =
+                  "Specifies whether the payload of request is empty or not",
+          defaultValue = "False")
+  private boolean isEmptyReq = false;
+
+  @Option(names = {"-erp", "--empty-resp"},
+          description =
+                  "Specifies whether the payload of response is empty or not",
+          defaultValue = "False")
+  private boolean isEmptyResp = false;
+
+  @Override
+  public Void call() throws Exception {
+    init();
+    int numOfThreads = getThreadNo();
+    LOG.info("Number of Threads: {}", numOfThreads);
+    LOG.info("RPC request payload size: {} KB", payloadSizeKB);
+    LOG.info("Empty RPC request: {}", isEmptyReq);
+    LOG.info("Empty RPC response: {}", isEmptyResp);

Review Comment:
   Skip printing if not set.



##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/protocol/ClientProtocol.java:
##########
@@ -701,6 +701,17 @@ TenantUserList listUsersInTenant(String tenantId, String prefix)
    */
   String getCanonicalServiceName();
 
+  /**
+   * Freon api to send request with or without payload to OM
+   * to benchmark RPC request performance.
+   *
+   * @param payload payload
+   * @throws IOException if there is error in the RPC communication

Review Comment:
   Javadoc for emptyResp



##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmRPCLoadGenerator.java:
##########
@@ -0,0 +1,110 @@
+/*
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.ozone.freon;
+
+import com.codahale.metrics.Timer;
+import org.apache.commons.lang3.RandomUtils;
+import org.apache.hadoop.hdds.cli.HddsVersionProvider;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+import org.apache.hadoop.ozone.client.rpc.RpcClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.concurrent.Callable;
+import picocli.CommandLine.Command;
+import picocli.CommandLine.Option;
+
+/**
+ * Utility to generate RPC request to OM with or without payload.
+ */
+@Command(name = "om-rpc-load",
+        aliases = "rpcl",
+        description =
+                "Generate random RPC request to the OM " +
+                        "with or without layload.",
+        versionProvider = HddsVersionProvider.class,
+        mixinStandardHelpOptions = true,
+        showDefaultValues = true)
+public class OmRPCLoadGenerator extends BaseFreonGenerator
+        implements Callable<Void> {
+
+  private static final Logger LOG =
+          LoggerFactory.getLogger(OmRPCLoadGenerator.class);
+
+  private static final int MULTIPLICATION_FACTOR = 1000;
+
+  private Timer timer;
+
+  @Option(names = {"-p", "--payload"},
+          description =
+                  "Specifies the size of payload in KB in each RPC request.",
+          defaultValue = "1")
+  private int payloadSizeKB = 1;
+
+  @Option(names = {"-erq", "--empty-req"},
+          description =
+                  "Specifies whether the payload of request is empty or not",
+          defaultValue = "False")
+  private boolean isEmptyReq = false;
+
+  @Option(names = {"-erp", "--empty-resp"},
+          description =
+                  "Specifies whether the payload of response is empty or not",
+          defaultValue = "False")
+  private boolean isEmptyResp = false;
+
+  @Override
+  public Void call() throws Exception {
+    init();
+    int numOfThreads = getThreadNo();
+    LOG.info("Number of Threads: {}", numOfThreads);
+    LOG.info("RPC request payload size: {} KB", payloadSizeKB);
+    LOG.info("Empty RPC request: {}", isEmptyReq);
+    LOG.info("Empty RPC response: {}", isEmptyResp);
+    timer = getMetrics().timer("rpc-payload");
+
+    for (int i = 0; i < numOfThreads; i++) {
+      runTests(this::sendRPCReq);
+    }
+    printReport();
+    return null;
+  }
+  private void sendRPCReq(long l) throws Exception {
+    OzoneConfiguration configuration = createOzoneConfiguration();
+    RpcClient rpcclient = new RpcClient(configuration, null);
+    if (payloadSizeKB < 0) {

Review Comment:
   This validation should be done before running the tests to avoid each thread from hitting the same validation failure.



##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmRPCLoadGenerator.java:
##########
@@ -0,0 +1,110 @@
+/*
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.ozone.freon;
+
+import com.codahale.metrics.Timer;
+import org.apache.commons.lang3.RandomUtils;
+import org.apache.hadoop.hdds.cli.HddsVersionProvider;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+import org.apache.hadoop.ozone.client.rpc.RpcClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.concurrent.Callable;
+import picocli.CommandLine.Command;
+import picocli.CommandLine.Option;
+
+/**
+ * Utility to generate RPC request to OM with or without payload.
+ */
+@Command(name = "om-rpc-load",
+        aliases = "rpcl",
+        description =
+                "Generate random RPC request to the OM " +
+                        "with or without layload.",
+        versionProvider = HddsVersionProvider.class,
+        mixinStandardHelpOptions = true,
+        showDefaultValues = true)
+public class OmRPCLoadGenerator extends BaseFreonGenerator
+        implements Callable<Void> {
+
+  private static final Logger LOG =
+          LoggerFactory.getLogger(OmRPCLoadGenerator.class);
+
+  private static final int MULTIPLICATION_FACTOR = 1000;

Review Comment:
   This should be 1024 to convert to Bytes



##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/protocol/ClientProtocol.java:
##########
@@ -701,6 +701,17 @@ TenantUserList listUsersInTenant(String tenantId, String prefix)
    */
   String getCanonicalServiceName();
 
+  /**
+   * Freon api to send request with or without payload to OM
+   * to benchmark RPC request performance.
+   *
+   * @param payload payload

Review Comment:
   ```suggestion
      * @param payload Optional payload to send.
   ```



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org