kerneltime commented on code in PR #3614: URL: https://github.com/apache/ozone/pull/3614#discussion_r927155424
########## hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmRPCLoadGenerator.java: ########## @@ -0,0 +1,214 @@ +package org.apache.hadoop.ozone.freon; + +import com.codahale.metrics.Histogram; +import com.codahale.metrics.Snapshot; +import com.codahale.metrics.UniformReservoir; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.PropertyAccessor; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.ObjectWriter; +import org.apache.commons.lang3.time.DurationFormatUtils; +import org.apache.hadoop.hdds.cli.HddsVersionProvider; +import org.apache.hadoop.hdds.conf.OzoneConfiguration; +import org.apache.hadoop.hdds.protocol.proto.HddsProtos; +import org.apache.hadoop.ozone.OzoneManagerVersion; +import org.apache.hadoop.ozone.client.OzoneClient; +import org.apache.hadoop.ozone.client.OzoneClientFactory; +import org.apache.hadoop.ozone.om.helpers.ServiceInfo; +import org.apache.hadoop.ozone.util.ShutdownHookManager; +import org.apache.hadoop.util.Time; +import org.apache.hadoop.util.VersionInfo; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import picocli.CommandLine; + +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.concurrent.*; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicLong; + +import static org.apache.hadoop.ozone.conf.OzoneServiceConfig.DEFAULT_SHUTDOWN_HOOK_PRIORITY; + [email protected](name = "om-rpc-load", + aliases = "orpcl", + 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> { + + @CommandLine.ParentCommand + private Freon freon; + + enum FreonOps { + op1, + op2, + op3, + op4 + } + + private static final Logger LOG = + LoggerFactory.getLogger(OmRPCLoadGenerator.class); + private volatile Throwable exception; + + @CommandLine.Option(names = {"--threads"}, + description = "Specifies numbers of thread to generate RPC request", + defaultValue = "1") + private int numOfThreads = 1; + + @CommandLine.Option(names = {"--payload"}, + description = "Specifies the size of payload in bytes in each RPC request", + defaultValue = "1024") + private int payloadSize = 1024; + + private long startTime; + private int threadPoolSize; + private OzoneClient ozoneClient; + private ExecutorService executor; + private AtomicLong totalBytesWritten; + private OzoneConfiguration ozoneConfiguration; + private ArrayList<Histogram> histograms = new ArrayList<>(); + + + OmRPCLoadGenerator(OzoneConfiguration ozoneConfiguration) { + this.ozoneConfiguration = ozoneConfiguration; + } + + public void init(OzoneConfiguration configuration) throws IOException { + totalBytesWritten = new AtomicLong(); + ozoneClient = OzoneClientFactory.getRpcClient(configuration); +// objectStore = ozoneClient.getObjectStore(); +// for (RandomKeyGenerator.FreonOps ops : RandomKeyGenerator.FreonOps.values()) { +// histograms.add(ops.ordinal(), new Histogram(new UniformReservoir())); +// } + if (freon != null) { + freon.startHttpServer(); Review Comment: How is this used? -- 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]
