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/09/07 13:30:20 UTC

[PR] [Test][Zeta] Add ProtoStuff serializer microbenchmarks [seatunnel]

nzw921rx opened a new pull request, #12177:
URL: https://github.com/apache/seatunnel/pull/12177

   ### Purpose of this pull request
   
   Add a focused JMH microbenchmark for concurrent `ProtoStuffSerializer` serialization and deserialization, so future changes to this shared serialization path can be compared using a repeatable workload and the existing benchmark reports.
   
   #### Background
   
   While investigating `IMapWalStorageBenchmark.recoverAll`, lock profiles identified contention in `ProtoStuffSerializer.getSchema()`. The measured stacks included repeatedly setting `protostuff.runtime.preserve_null_elements` and accessing the schema cache through `ConcurrentHashMap.computeIfAbsent`. The related optimization is described in https://github.com/apache/seatunnel/pull/12176.
   
   The serializer is used by the engine's file-backed IMap storage and checkpoint-related code. WAL writing serializes keys, values, and the outer `IMapFileData` record; recovery deserializes those records and their contents. Repeated schema lookup is therefore part of actual storage processing, rather than an isolated utility call used only during startup.
   
   The existing WAL benchmark is useful for evaluating overall recovery, but its result also includes file enumeration, filesystem access, record processing, and Hazelcast scheduling. These costs can make it difficult to isolate the effect of a serializer change. A smaller in-memory benchmark complements that coverage: it measures the serializer directly, while the existing WAL benchmark can show how much of an improvement carries through to recovery.
   
   This PR establishes that measurement baseline. It does not change the production serializer, include the optimization from PR #12176, or claim a measured speedup.
   
   #### What is measured
   
   - `ProtoStuffSerializerBenchmark.serializeWalRecord`: serialize one `IMapFileData` record.
   - `ProtoStuffSerializerBenchmark.deserializeWalRecord`: deserialize one prepared record.
   - One fixed fixture containing a pre-serialized Long key and a 1,024-character ASCII String value. Nested key/value preparation is performed in trial setup, not inside the measured methods.
   - `IMapFileData` is **not** a `SerializerDeserializerWrapper` type. Both measured methods enter the production `getSchema()` path on every invocation, including after the schema has been initialized.
   - Eight JMH workers by default. Each worker has its own input fixture, while the production static schema cache remains shared. This exercises the concurrent path involved in the related optimization without introducing an executor, filesystem, or running Hazelcast/Zeta cluster into the benchmark.
   - Schema initialization and fixture validation occur in setup. Normal serializer buffer, output-array, and deserialized-object allocations remain part of the measured operation.
   
   The benchmark uses throughput in `ops/ms`, three forks, and the existing warmup/measurement defaults. Its JVM resource settings match the pipeline benchmark: a fixed 4 GiB heap, G1, pre-touch, disabled explicit GC, and four JVM-visible processors.
   
   #### Reporting and future comparisons
   
   The benchmark emits standard JMH results and reuses the unchanged `save_jmh_result.py` and `regression_report.py` pipeline. Markdown reports retain the existing **Score / Error / CV / Unit** columns and calculations. CPU, wall-clock, lock, and GC diagnostics can use the existing profiling script with an exact method selector.
   
   The class is added to the manual Benchmarks workflow selector, with English/Chinese documentation and local commands. It is not added to `benchmarks_core`, so the default scheduled suite is not expanded.
   
   For subsequent optimizations, the same benchmark can run against both revisions with equivalent JDK, hardware, thread count, payload, and JVM/JMH settings. Throughput and allocation evidence can then be considered alongside the existing end-to-end WAL measurements.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Adds a developer-facing benchmark, a manual workflow selection, and documentation. No production behavior, configuration, API, or serialized format changes. No new dependencies are introduced.
   
   ### How was this patch tested?
   
   - Module Spotless formatting and `git diff --check` passed.
   - Java 8 benchmark unit tests: **3 passed**, covering the JMH configuration, fixture round-trip correctness, repeated calls, and independent outputs without input mutation.
   - Existing reporting tests: **17 passed**. Reporting scripts were not modified.
   - The benchmark reactor package build passed with `-Dskip.ui=true`, after the unrelated UI `npm install` step failed in the local environment.
   - The final throughput benchmark-module rebuild and its three tests passed on Java 8.
   - A full local throughput run is in progress: both methods, 8 threads, 3 forks, 3 warmup and 5 measurement iterations per fork, 10 seconds each, without a profiler. Results will be reviewed separately; no performance conclusion is claimed here.
   - `verify` was not run.
   
   Build and test:
   
   ```sh
   ./mvnw -Pbenchmark -pl seatunnel-benchmarks -am -Dskip.ui=true \
     -Dtest=ProtoStuffSerializerBenchmarkTest -Dsurefire.failIfNoSpecifiedTests=false package
   ```
   
   Run the complete microbenchmark:
   
   ```sh
   java -jar seatunnel-benchmarks/target/benchmarks.jar ProtoStuffSerializerBenchmark \
     -f 3 -wi 3 -i 5 -w 10s -r 10s -rf json \
     -rff seatunnel-benchmarks/target/protostuff.json
   ```
   
   ### Check list
   
   - [x] No new dependencies or binary packages.
   - [x] Updated the benchmark README and English/Chinese benchmark guides.
   - [x] No incompatible production changes; migration documentation is not needed.
   - [x] No connector changes; connector registration and E2E checklist items do not apply.
   


-- 
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] [Test][Zeta] Add ProtoStuff serializer microbenchmarks [seatunnel]

Posted by "davidzollo (via GitHub)" <gi...@apache.org>.
davidzollo merged PR #12177:
URL: https://github.com/apache/seatunnel/pull/12177


-- 
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] [Test][Zeta] Add ProtoStuff serializer microbenchmarks [seatunnel]

Posted by "nzw921rx (via GitHub)" <gi...@apache.org>.
nzw921rx commented on PR #12177:
URL: https://github.com/apache/seatunnel/pull/12177#issuecomment-5577556158

   @davidzollo can you help me review this pr?thanks🥳


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