nzw921rx commented on code in PR #12418:
URL: https://github.com/apache/seatunnel/pull/12418#discussion_r4140561199


##########
seatunnel-benchmarks/src/main/java/org/apache/seatunnel/benchmark/CheckpointSchedulingBenchmark.java:
##########
@@ -0,0 +1,155 @@
+/*
+ * 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.seatunnel.benchmark;
+
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Fork;
+import org.openjdk.jmh.annotations.Level;
+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.TearDown;
+import org.openjdk.jmh.annotations.Threads;
+import org.openjdk.jmh.annotations.Warmup;
+import org.openjdk.jmh.runner.Runner;
+import org.openjdk.jmh.runner.RunnerException;
+import org.openjdk.jmh.runner.options.Options;
+import org.openjdk.jmh.runner.options.OptionsBuilder;
+import org.openjdk.jmh.runner.options.VerboseMode;
+
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Measures how late a periodic checkpoint trigger runs after it is due, on a 
real member with
+ * {@code pipelineNum} real checkpoint coordinators.
+ *
+ * <p>This is the part of checkpointing the scheduling model decides. 
Checkpoint completion time,
+ * which {@link CheckpointingTimeBenchmark} measures, is dominated by the 
barrier round-trip and is
+ * close to blind to how the trigger was scheduled.
+ *
+ * <p>Each invocation measures one trigger. The untimed setup picks the 
coordinator due soonest and
+ * returns exactly when its trigger is due; the timed body spins until that 
trigger has created its
+ * pending checkpoint. The score is therefore the scheduling delay plus the 
trigger's own decision
+ * logic up to creating the checkpoint, and nothing else. {@code 
Level.Invocation} is normally
+ * discouraged, but here the delay being measured is in microseconds while the 
setup overhead JMH
+ * leaves outside the timed region is tens of nanoseconds. See {@link 
CheckpointSchedulingFixture}
+ * for how due times are known and which triggers are skipped.
+ *
+ * <p>The checkpoint interval is {@code pipelineNum * triggerSpacingMillis}, 
so every point of the
+ * sweep sees the same rate of due triggers and the same checkpoint load on 
storage, and only the
+ * number of coordinators changes. It is floored at {@link 
#MIN_MEASURABLE_INTERVAL_MILLIS}, so the
+ * smallest pipeline counts sample less often. Each job has one pipeline: many 
jobs is what "many
+ * active pipelines" means on a member, and it keeps per-job checkpoint state 
from becoming the
+ * bottleneck.
+ */
+@BenchmarkMode(Mode.SampleTime)
+@OutputTimeUnit(TimeUnit.MICROSECONDS)
+@Threads(1)
+@Warmup(iterations = 2, time = 10)
+@Measurement(iterations = 5, time = 10)
+@Fork(
+        value = 2,

Review Comment:
   Or can you explain what considerations fork=2 is based on?



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