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


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

Review Comment:
   > Unsure how representative the benchmark is for high-throughput invocations 
in production environments.
   
   Yeah, I don't think these are highly representative, but a starting point to 
compare stats and how adding either sensors or stats affect latency (which is 
the concern from KIP-864). 
   Though, happy to hear thoughts on how to make these more solid. e.g. I have 
an idea to also add a benchmark of Yammer metrics to compare the impact of 
these two libraries.
   
   Also, found there was some work around it: 
   - 
[MetricsBench](https://github.com/apache/kafka/blob/a8aedc85ebfadcf1472acafe2e0311a73d3040be/clients/src/test/java/org/apache/kafka/test/MetricsBench.java):
 simple average time execution of a sensor + a bunch of stats.
   - 
[Microbenchmarks](https://github.com/apache/kafka/blob/00e5803cd3af89011254e734232308618403309d/clients/src/test/java/org/apache/kafka/test/Microbenchmarks.java)
 which seems more elaborated, but haven't looked into details yet.



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

Reply via email to