peterxcli commented on code in PR #11741: URL: https://github.com/apache/ozone/pull/11741#discussion_r4373332788
########## hadoop-ozone/freon/src/main/java/org/apache/hadoop/ozone/freon/OzoneClientPositionedReader.java: ########## @@ -0,0 +1,207 @@ +/* + * 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.ozone.freon; + +import com.codahale.metrics.Counter; +import com.codahale.metrics.Timer; +import java.io.IOException; +import java.nio.ByteBuffer; +import java.util.ArrayList; +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; +import org.apache.hadoop.hdds.cli.HddsVersionProvider; +import org.apache.hadoop.hdds.conf.OzoneConfiguration; +import org.apache.hadoop.hdds.utils.IOUtils; +import org.apache.hadoop.ozone.client.OzoneBucket; +import org.apache.hadoop.ozone.client.OzoneClient; +import org.apache.hadoop.ozone.client.io.OzoneInputStream; +import org.kohsuke.MetaInfServices; +import picocli.CommandLine.Command; +import picocli.CommandLine.Option; + +/** + * Random positioned reads of one existing key, with threads sharing each input stream. + */ +@Command(name = "ocpr", + aliases = "ozone-client-positioned-reader", + description = "Read random ranges of an existing key with positioned reads. " + + "Threads share the input streams opened on the key.", + versionProvider = HddsVersionProvider.class, + mixinStandardHelpOptions = true, + showDefaultValues = true) +@MetaInfServices(FreonSubcommand.class) +public class OzoneClientPositionedReader extends BaseFreonGenerator implements Callable<Void> { + + @Option(names = {"-v", "--volume"}, + description = "Name of the volume which contains the key.", + defaultValue = "vol1") + private String volumeName; + + @Option(names = {"-b", "--bucket"}, + description = "Name of the bucket which contains the key.", + defaultValue = "bucket1") + private String bucketName; + + @Option(names = {"-k", "--key"}, + required = true, + description = "Name of the key to read.") + private String keyName; + + @Option(names = "--om-service-id", + description = "OM Service ID") + private String omServiceID = null; + + @Option(names = "--streams", + description = "Number of input streams opened on the key. Thread i reads from stream (i mod streams).", + defaultValue = "1") + private int streamCount; + + @Option(names = "--clients", + description = "Number of Ozone clients. Stream j is opened from client (j mod clients).", + defaultValue = "1") + private int clientCount; + + @Option(names = "--read-size", + description = "Size of each positioned read in bytes.", + defaultValue = "65536") + private int readSize; + + @Option(names = "--sequential-readers", + description = "Number of extra threads for each stream that read the stream sequentially during the test.", Review Comment: > Just curious, is this what --sequential-readers > 1 is meant to model? Yes, more than one sequential reader per stream is meant to put more load on the stream’s sequential path. > I might be missing something, but readers on the same stream seem to share one cursor, so each one may only read part of it. The “from start to end” wording was wrong, so I removed it from the PR description and the Jira. -- 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]
