You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "clolov (via GitHub)" <gi...@apache.org> on 2023/02/02 10:16:30 UTC

[GitHub] [kafka] clolov commented on a diff in pull request #13177: [KAFKA-14441] Benchmark performance impact of metrics library

clolov commented on code in PR #13177:
URL: https://github.com/apache/kafka/pull/13177#discussion_r1094319881


##########
jmh-benchmarks/src/main/java/org/apache/kafka/jmh/common/metrics/SensorBenchmark.java:
##########
@@ -0,0 +1,145 @@
+package org.apache.kafka.jmh.common.metrics;
+
+import org.apache.kafka.common.metrics.Metrics;
+import org.apache.kafka.common.metrics.Sensor;
+import org.apache.kafka.common.metrics.stats.Avg;
+import org.apache.kafka.common.metrics.stats.Max;
+import org.apache.kafka.common.metrics.stats.Min;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Fork;
+import org.openjdk.jmh.annotations.Measurement;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Param;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.annotations.Warmup;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+@State(Scope.Benchmark)
+@Fork(value = 1)
+@Warmup(iterations = 5)
+@Measurement(iterations = 5)
+@BenchmarkMode(Mode.AverageTime)
+@OutputTimeUnit(TimeUnit.NANOSECONDS)
+public class SensorBenchmark {
+
+    @State(Scope.Benchmark)
+    public static class SensorWithNoStats {
+
+        Metrics metrics = new Metrics();
+
+        List<Sensor> sensors = new ArrayList<>();
+        @Param({"1", "5", "20"})

Review Comment:
   In general I am more than happy with this benchmark, but where did these numbers come from? Are they roughly the number of sensors you have seen registered per Connector task?



-- 
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: jira-unsubscribe@kafka.apache.org

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