ekuvardin commented on code in PR #18293:
URL: https://github.com/apache/kafka/pull/18293#discussion_r2198319395


##########
jmh-benchmarks/src/main/java/org/apache/kafka/jmh/acl/StandardAuthorizerUpdateBenchmark.java:
##########
@@ -55,8 +55,8 @@
 
 @State(Scope.Benchmark)
 @Fork(value = 1)
-@Warmup(iterations = 0)
-@Measurement(iterations = 4)
+@Warmup(iterations = 7, timeUnit = TimeUnit.SECONDS, time = 2)

Review Comment:
   The main goal is, what are we measuring?
   
   Jmh tests without a warmup look strange.
   
   Warmup removes the side effect of warm caching, JIT optimization, and so on.
   
   I add warmup = 7. From my observation, it's the minimum count of warm-ups to 
bring to remove side effects.
   
   Also increase measurement iteration to 10. I found that this count is enough 
to measure time. Fewer iterations give more error between measurements.



##########
jmh-benchmarks/src/main/java/org/apache/kafka/jmh/acl/AuthorizerBenchmark.java:
##########
@@ -204,17 +211,17 @@ public void tearDown() throws IOException {
     }
 
     @Benchmark
-    public void testAclsIterator() {
-        authorizer.acls(AclBindingFilter.ANY);
+    public Iterable<AclBinding> testAclsIterator() {
+        return authorizer.acls(filter);
     }
 
     @Benchmark
-    public void testAuthorizer() {
-        authorizer.authorize(authorizeContext, actions);
+    public List<AuthorizationResult> testAuthorizer() {
+        return authorizer.authorize(authorizeContext, actions);
     }
 
     @Benchmark
-    public void testAuthorizeByResourceType() {
-        authorizer.authorizeByResourceType(authorizeByResourceTypeContext, 
AclOperation.READ, ResourceType.TOPIC);
+    public AuthorizationResult testAuthorizeByResourceType() {
+        return 
authorizer.authorizeByResourceType(authorizeByResourceTypeContext, op, 
resourceType);

Review Comment:
   Return AuthorizationResult is equivalent to using BlackHole in this 
particular case.
   
   Take a look at the compiled class. All calls warped in BlackHole.
   
   ```
    control.announceWarmupReady();
               while (control.warmupShouldWait) {
                   
blackhole.consume(l_authorizerbenchmark0_G.testAuthorizeByResourceType());
                   if (control.shouldYield) Thread.yield();
                   res.allOps++;
               }
   ```



-- 
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-unsubscr...@kafka.apache.org

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

Reply via email to