kfaraz commented on code in PR #18108:
URL: https://github.com/apache/druid/pull/18108#discussion_r2137696252


##########
benchmarks/src/test/java/org/apache/druid/benchmark/indexing/SqlSegmentsMetadataQueryBenchmark.java:
##########
@@ -0,0 +1,95 @@
+package org.apache.druid.benchmark.indexing;
+
+import com.google.common.collect.ImmutableSet;
+import org.apache.druid.java.util.common.DateTimes;
+import org.apache.druid.java.util.common.granularity.Granularities;
+import org.apache.druid.java.util.common.parsers.CloseableIterator;
+import org.apache.druid.metadata.IndexerSqlMetadataStorageCoordinatorTestBase;
+import org.apache.druid.metadata.MetadataStorageTablesConfig;
+import org.apache.druid.metadata.SqlSegmentsMetadataQuery;
+import org.apache.druid.metadata.TestDerbyConnector;
+import org.apache.druid.metadata.storage.derby.DerbyConnector;
+import org.apache.druid.segment.TestDataSource;
+import org.apache.druid.segment.TestHelper;
+import org.apache.druid.server.coordinator.CreateDataSegments;
+import org.apache.druid.timeline.DataSegment;
+import org.joda.time.DateTime;
+import org.joda.time.Interval;
+import org.openjdk.jmh.annotations.*;
+import org.openjdk.jmh.infra.Blackhole;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Function;
+
+@State(Scope.Benchmark)
+@Fork(value = 1)
+@Warmup(iterations = 1, time = 1)
+@Measurement(iterations = 20, time = 2)
+@BenchmarkMode({Mode.AverageTime})
+@OutputTimeUnit(TimeUnit.NANOSECONDS)
+public class SqlSegmentsMetadataQueryBenchmark {
+
+  private static final DateTime JAN_1 = DateTimes.of("2025-01-01");
+  private static final String V1 = JAN_1.toString();
+  private static final List<DataSegment> WIKI_SEGMENTS_2X5D
+          = CreateDataSegments.ofDatasource(TestDataSource.WIKI)
+          .forIntervals(10, Granularities.DAY)
+          .withNumPartitions(20)
+          .startingAt(JAN_1)
+          .withVersion(V1)
+          .eachOfSizeInMb(500);
+  @Param({
+          "2025-01-01T00:00:00.000Z/2025-01-02T00:00:00.000Z",

Review Comment:
   Rather than parameterizing this, I would advise adding separate benchmark 
methods for various cases.
   For example:
   
   1. search for an interval that overlaps multiple time chunks
   2. search for an interval which returns empty results
   3. search for eternity interval which returns all segments
   4. search for the first interval
   5. search for the last interval



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