You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "nzw921rx (via GitHub)" <gi...@apache.org> on 2026/08/05 15:59:04 UTC
[PR] [Feature][Zeta] Add long-term benchmark framework [seatunnel]
nzw921rx opened a new pull request, #11671:
URL: https://github.com/apache/seatunnel/pull/11671
### Purpose of this pull request
Relates to #11598.
This PR delivers the Phase 1 MVP of STIP-32: a reproducible benchmark framework for
SeaTunnelRow hot paths and complete single-node Zeta pipelines. The first version focuses on a
fixed, observable baseline and machine-readable artifacts. It intentionally does not turn a single
GitHub-hosted runner result into a blocking performance gate.
The framework answers three concrete questions:
1. Did a change alter a focused SeaTunnelRow hot path?
2. Can the current Zeta code sustain the fixed workload without losing rows or accumulating
latency?
3. What is the incremental cost of Transform work, backpressure observability, and StainTrace under
the same resources and workload?
#### Project structure
```text
seatunnel/
├── pom.xml # opt-in benchmark Maven profile
├── seatunnel-benchmarks/
│ ├── pom.xml # JMH runner and engine dependencies
│ ├── README.md
│ └── src/
│ ├── main/java/org/apache/seatunnel/benchmark/
│ │ ├── BenchmarkBase.java
│ │ ├── SeaTunnelRowBenchmark.java
│ │ ├── SeaTunnelPipelineBenchmark.java
│ │ ├── SeaTunnelEnvironmentContext.java
│ │ ├── SeaTunnel*EnvironmentContext.java
│ │ ├── connector/source/ # deterministic in-memory Source
│ │ ├── connector/sink/ # blackhole Sink and latency result
│ │ └── transform/ # deterministic CPU work and checksum
│ └── test/java/org/apache/seatunnel/benchmark/
├── tools/benchmarks/
│ ├── run_benchmarks.sh
│ ├── save_jmh_result.py
│ └── regression_report.py
├── .github/workflows/benchmarks.yml
└── docs/{en,zh}/engines/zeta/benchmark.md
```
`seatunnel-benchmarks` is included only when `-Pbenchmark` is enabled. JMH and the engine runtime
dependencies therefore do not enter the normal SeaTunnel build or runtime classpath.
#### Measurement architecture
```mermaid
%%{init: {"theme": "base", "themeVariables": {"background": "#0f1d33", "primaryColor": "#0c2530", "primaryBorderColor": "#2dd4bf", "primaryTextColor": "#f8fbff", "actorBkg": "#0c2530", "actorBorder": "#2dd4bf", "actorTextColor": "#f8fbff", "activationBkgColor": "#1f1a34", "activationBorderColor": "#8d7cf6", "noteBkgColor": "#1f1a34", "noteBorderColor": "#8d7cf6", "noteTextColor": "#f8fbff", "signalColor": "#5db8e2", "signalTextColor": "#f8fbff", "labelBoxBkgColor": "#0f1d33", "labelBoxBorderColor": "#5db8e2", "labelTextColor": "#f8fbff", "loopTextColor": "#f8fbff"}}}%%
flowchart LR
JMH["JMH fork"] --> Context["SeaTunnelEnvironmentContext"]
Context --> Client["SeaTunnelClient"]
Client --> Zeta["single-node Zeta Master + Worker"]
Zeta --> Source["BenchmarkSource"]
Source --> Transform["BenchmarkTransform (optional)"]
Transform --> Sink["BenchmarkSink"]
Sink --> Pipeline["per-invocation Pipeline JSON"]
JMH --> Raw["raw JMH JSON"]
Pipeline --> Report["normalized JSON + Markdown summary"]
Raw --> Report
```
`SeaTunnelEnvironmentContext` starts a real embedded Zeta server and client in
`@Setup(Level.Trial)` and closes them in `@TearDown(Level.Trial)`. Cluster startup is outside JMH
timing. Job configuration, submission, scheduling, Source, optional Transform, Sink, and completion
are inside each benchmark invocation.
No SeaTunnel distribution, shell launcher, external broker, or installed connector is required.
The benchmark runs the engine code from the same commit as the benchmark.
#### Workload and scenarios
The default pipeline workload is fixed in code:
| Setting | Default |
|---|---:|
| JVM heap | `-Xms4g -Xmx4g` |
| JVM-visible processors | 4 |
| Garbage collector | G1 with pre-touch |
| Zeta slots / pipeline parallelism | 12 / 4 |
| Rows per invocation | 1,000,000 |
| Offered rate | 600,000 rows/s |
| Payload | 256 characters |
| Transform work | 64 hash operations/row |
| JMH forks | 3 |
| Warmup / measurement | 3 / 5 iterations |
The five pipeline methods keep the workload constant while selecting the path under test:
| JMH method | Purpose |
|---|---|
| `sourceSink` | Baseline `Source -> Sink` data path. |
| `sourceTransformSink` | Adds row copy and deterministic Transform work. |
| `sourceTransformSinkWithBackpressure` | Enables backpressure observability. |
| `sourceTransformSinkWithTrace` | Enables StainTrace. |
| `sourceTransformSinkWithBackpressureAndTrace` | Enables both observability features. |
The backpressure scenario does not artificially slow the Sink. Overload is produced by setting the
offered rate above current capacity and is detected from achieved throughput and latency growth.
#### Correctness and metric design
Performance is interpreted only after correctness validation:
- `processed_rows == expected_rows`;
- direct `Source -> Sink` has a zero checksum;
- every Transform pipeline has a deterministic non-zero checksum;
- the Zeta job finishes successfully and produces its result file.
JMH and the Sink intentionally expose different measurement boundaries:
| Metric | Boundary | Meaning |
|---|---|---|
| JMH `Score` | Job submission through complete job termination | Complete bounded-job rows/s, including scheduling and lifecycle cost. |
| `throughput_rows_per_second` | First-to-last Sink receipt | Data-path completion rate while records are arriving. |
| `event_time_latency_p50/p95/p99/max_ms` | Planned Source time to Sink receipt | End-to-end delay including open-loop backlog. |
| `first_half_p99_ms` / `second_half_p99_ms` | First and second half of the sequence | Whether latency keeps growing during the invocation. |
| `latency_growth_ratio` | `(second-half P99 + 1) / (first-half P99 + 1)` | Values above 1 indicate worsening latency. |
The Source uses an absolute open-loop schedule. Its planned time continues to advance when Zeta is
backpressured, so waiting time remains visible instead of being omitted by a coordinated-omission
style closed loop.
The current convenience guardrail marks a sample sustainable when output is complete, P99 is at
most 1,000 ms, and the latency growth ratio is at most 1.20. This is not a universal SLA and does not
create a CI failure in Phase 1.
#### Detailed execution flow
1. JMH creates an independent fork with the fixed JVM settings.
2. The environment context creates a temporary SeaTunnel home and starts one Zeta Master + Worker.
3. The benchmark method generates a unique run ID and normal SeaTunnel job configuration.
4. `SeaTunnelClient` submits a bounded batch job through the normal parser and client APIs.
5. Source readers emit deterministic interleaved sequence splits according to the absolute schedule.
6. The optional Transform copies the row, performs deterministic work, and writes the checksum.
7. Sink writers discard payloads after recording row count, checksum, throughput, and latency.
8. Sink writers merge their state and atomically write one Pipeline JSON result.
9. The context waits for `FINISHED`, reads the result, and rejects incomplete rows or an invalid
checksum.
10. JMH records the completed invocation; report tools preserve raw data and build a concise summary.
#### Local execution
Build the current repository code and benchmark runner:
```bash
./mvnw -Pbenchmark -pl seatunnel-benchmarks -am -DskipTests package
```
Run the complete fixed pipeline suite:
```bash
java -jar seatunnel-benchmarks/target/benchmarks.jar SeaTunnelPipelineBenchmark
```
Run one exact pipeline and save standard JMH JSON:
```bash
java -jar seatunnel-benchmarks/target/benchmarks.jar \
'sourceTransformSink$' \
-p offeredRatePerSecond=600000 \
-p parallelism=4 \
-p payloadSize=256 \
-p transformOperations=64 \
-rf json \
-rff seatunnel-benchmarks/target/zeta-pipeline-result.json
```
Run the SeaTunnelRow microbenchmarks:
```bash
java -jar seatunnel-benchmarks/target/benchmarks.jar SeaTunnelRowBenchmark \
-rf json \
-rff seatunnel-benchmarks/target/seatunnel-row-result.json
```
#### GitHub Actions execution
The `Benchmarks` workflow supports Java 8 and Java 11 and has three modes:
1. **Scheduled:** runs at `00:17 UTC` every day against `dev`. The non-zero minute avoids the common
top-of-hour scheduling peak.
2. **Manual:** selects a branch/tag/SHA and a common JMH selector. An optional custom selector can
override the dropdown.
3. **PR comparison:** supplies a PR number and runs `base -> PR -> PR -> base` on the same worker.
Each side uses the median of its two samples. The report is observational and has no failure
threshold.
Each Java job uploads raw JMH JSON, per-invocation Pipeline JSON, normalized JSON, Markdown summary,
and CPU/JDK/kernel/memory fingerprints for 90 days.
GitHub-hosted runner hardware varies. Daily absolute values are suitable for smoke checks, history,
and large changes, but a single run is not a precise regression gate. The same-worker PR comparison
reduces host differences; a future hard gate still requires a controlled runner and an empirically
derived variance model.
#### Future extensions
Phase 1 establishes the fixed workload and result schema. Follow-up work can add:
- a separate offered-rate capacity sweep and an unpaced saturation diagnostic;
- measurement-phase tagging so Pipeline history excludes warmup invocations;
- checkpoint, state, recovery, and controlled slow-Sink contexts;
- allocation, GC, CPU, and async-profiler diagnostics as separate runs;
- multi-node and production-connector suites with an external driver;
- long-term storage, rolling median/MAD anomaly detection, and a controlled performance gate.
### Does this PR introduce any user-facing change?
Yes. It adds an opt-in benchmark module, a `Benchmarks` GitHub Actions workflow, downloadable result
artifacts, and English/Chinese Zeta benchmark documentation. Normal SeaTunnel builds and runtime
behavior are unchanged unless the `benchmark` Maven profile is explicitly enabled.
### How was this patch tested?
```bash
./mvnw -Pbenchmark -pl seatunnel-benchmarks -am -DskipTests package
./mvnw spotless:apply
```
A local Java 8 visualization run also executed every `SeaTunnelPipelineBenchmark` method with the
fixed `600000:4:256:64` workload using one fork, one warmup iteration, and two measurement
iterations. It generated standard JMH JSON and 71 Pipeline result files. Every invocation processed
all 1,000,000 expected rows and every Transform checksum was non-zero. This shortened run verifies
execution and report compatibility; the default 3/3/5 JMH configuration remains the performance
baseline configuration.
### Check list
- [x] No new runtime Jar binary package is added to the SeaTunnel distribution.
- [x] English and Chinese documentation are included.
- [x] No incompatible user-facing configuration or API change is introduced.
- [x] This is not a connector contribution.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][Zeta] STIP-32 Phase 1: Add long-term benchmark framework [seatunnel]
Posted by "davidzollo (via GitHub)" <gi...@apache.org>.
davidzollo merged PR #11671:
URL: https://github.com/apache/seatunnel/pull/11671
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][Zeta] STIP-32 Phase 1: Add long-term benchmark framework [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #11671:
URL: https://github.com/apache/seatunnel/pull/11671#issuecomment-5233811086
Thanks @davidzollo! Closing the loop on the "if CI passes" condition: I just checked the Apache-side `Build` check at the current head (`ab49048d5781`) and it's green (passed in ~8h53m, no failing jobs). Combined with the fork's own `benchmark-test` jobs (JDK 8 and 11) that I verified passing on this exact head in my last review, there's no outstanding CI signal blocking this anymore.
With both of us at APPROVED and CI fully green on this head, I don't see anything else standing in the way of merging this Phase 1 benchmark framework. Thanks again for the second pair of eyes on the percentile-overflow and Maven-cache findings earlier in the review — both landed clean fixes.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][Zeta] STIP-32 Phase 1: Add long-term benchmark framework [seatunnel]
Posted by "davidzollo (via GitHub)" <gi...@apache.org>.
davidzollo commented on PR #11671:
URL: https://github.com/apache/seatunnel/pull/11671#issuecomment-5202144453
Went through the diff independently as well (architecture, scheduling math, sink/checksum aggregation, tooling, CI) and reached the same overall read as the review posted earlier today: nothing blocking for a Phase-1, opt-in tool. Two things worth adding that weren't covered there.
**1. `LatencyHistogram.percentile()` silently clamps during the exact overload scenario the docs recommend creating**
`LatencyHistogram` (`seatunnel-benchmarks/src/main/java/org/apache/seatunnel/benchmark/connector/sink/LatencyHistogram.java`) buckets latencies into a fixed `maxTrackedMillis + 2`-slot array (default `maxTrackedMillis = 60_000`), with the last slot as an overflow bucket:
```java
long percentile(double percentile) {
...
for (int index = 0; index < counts.length; index++) {
seen += counts[index];
if (seen >= rank) {
return index;
}
}
return maximum;
}
```
When the requested percentile's rank falls in the overflow bucket, this returns the bucket **index** (60001), not the true latency, which can be far higher during severe backlog. `getMaximum()` tracks the real unbounded max correctly, but `p50`/`p95`/`p99`/`first_half_p99`/`second_half_p99`/`latency_growth_ratio` all go through `percentile()` and can silently understate.
That lines up badly with the doc's own guidance ("start above expected capacity and lower the rate" / the "Evaluate the Result" table) — that workflow is specifically designed to push into this overflow regime. `latency_overflow_rows` is exposed in the JSON so a careful reader could catch it, but nothing in `regression_report.py`'s `validity_text()` or the docs' interpretation guidance ties the two together. There's also no dedicated unit test for `LatencyHistogram` — the one indirect exercise (`BenchmarkSinkWriterTest`) uses ~5ms latencies, nowhere near this path.
Suggest either surfacing overflow distinctly (don't let the clamped value read as a real millisecond figure) or explicitly gating `sustainable`/report rendering on `overflow == 0`, plus a one-line callout in the "Evaluate the Result" doc table.
**2. The untrusted PR-comparison build shares the job's Maven cache with the trusted baseline build**
In `benchmarks.yml`, `actions/setup-java` is configured once with `cache: maven`, and the same job then runs `mvn package` against both `baseline/` (trusted) and, when `pr_number` is set, `candidate/` — an arbitrary fork's `pom.xml`. Maven plugin execution during `package` is arbitrary JVM code with the job's full filesystem access, so a malicious `pom.xml`/plugin binding in the candidate build could write into `~/.m2/repository` before `setup-java`'s post-job hook persists that cache, which could then be restored into a later trusted run depending on GitHub's cache-key/restore-key matching. This sits on top of (not instead of) the "runs arbitrary PR code" trust boundary already flagged above — the specific new wrinkle is that the cache gives a poisoned artifact a path to outlive the single job run. `contents: read` and no `secrets:` usage cap the blast radius (no credential exfiltration), so I'd call this a cheap-to-fix hardening item rather than a confirmed exploit: disable
`cache: maven` for this workflow, or give the candidate build its own `-Dmaven.repo.local`.
Neither of these changes the overall verdict — still nothing blocking for Phase 1.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org