Skip to content

feat: add micro benchmark runner and EC2 guide - #5374

Draft
andygrove wants to merge 6 commits into
apache:mainfrom
andygrove:micro-benchmark-ec2
Draft

feat: add micro benchmark runner and EC2 guide#5374
andygrove wants to merge 6 commits into
apache:mainfrom
andygrove:micro-benchmark-ec2

Conversation

@andygrove

@andygrove andygrove commented Aug 15, 2026

Copy link
Copy Markdown
Member

Which issue does this PR close?

Part of #1636.

Rationale for this change

Comet has around 35 micro benchmark suites, but running them is a manual, one-suite-at-a-time
exercise (SPARK_GENERATE_BENCHMARK_FILES=1 make benchmark-<class>), and the results are written
to spark/benchmarks, which is git ignored. That makes it tedious to produce a full set of numbers
and impossible to publish them without force adding files.

Running the suites on a laptop also produces noisy numbers because of thermal throttling,
efficiency cores, and background load. A dedicated EC2 instance gives repeatable results, but the
existing EC2 guide only covers TPC-H and TPC-DS.

What changes are included in this PR?

  • benchmarks/micro/run.py, a dependency-free Python entry point with setup, run, collect,
    publish and all subcommands. It installs the prerequisites, clones or updates the repository
    at a chosen ref, builds in release mode, runs each suite in its own JVM with per-suite logs,
    timings and timeouts, continues past failures, and copies the results into
    benchmarks/results/micro together with a RUN-INFO.md recording the instance type, CPU,
    memory, JDK, Rust and Comet commit that produced them. The script can be downloaded on its own
    before the repository is cloned.
  • The three TPC suites and CometC2RIsolatedBench are excluded from the default set, with the
    reason reported by run --list. The default set is the 35 suites that generate their own data.
  • benchmarks/results/micro as the tracked location for published results. spark/benchmarks
    stays ignored and is used as scratch output.
  • A new contributor guide, benchmarking_micro_ec2.md, covering instance creation on
    m7i.xlarge, manual installation of every prerequisite (git, make, gcc, cmake,
    protobuf-compiler, JDK 17, Rust, and a note that Maven is provided by ./mvnw), running,
    collecting, publishing, guidance on getting comparable numbers, and troubleshooting.
  • BENCH_HEAP in the Makefile, defaulting to the previous 20g, so that the benchmark-%
    target can also be run by hand on an instance with less memory.
  • A RAT exclusion for the result text files, and a prettier exemption for the generated
    RUN-INFO.md, whose tables do not match prettier's column alignment and would otherwise
    fail the markdown lint job on every results PR.

How are these changes tested?

The runner was exercised locally against a release build: suite listing and --only / --skip
filtering, a dry run of the Maven invocation, a real run of CometArithmeticBenchmark that
completed in 4m35s and produced a results file which collect then picked up, and the publish step
including the generated RUN-INFO.md and the git and gh commands. Documentation changes were
checked with prettier.

Add benchmarks/micro/run.py, a single entry point that installs the
prerequisites, builds Comet in release mode, runs the 35 self-contained
micro benchmark suites, collects the results with the environment they
were produced in, and optionally opens a pull request with them.

Results are published to benchmarks/results/micro, which is tracked.
spark/benchmarks remains ignored and is used as scratch output.

Add a contributor guide covering instance creation, manual prerequisite
installation, running, collecting and publishing.

Make the benchmark heap configurable through BENCH_HEAP so the Makefile
target also works on instances with less than 20 GiB of memory.
The native build compiles the protobuf definitions with prost-build,
which needs protoc on the PATH. Amazon Linux 2023 does not always
provide it, and the build then fails with "Could not find protoc".

Have setup fall back to the protobuf release archive when protoc is
still missing after the package manager step, and document both the
package and the manual install in the guide.

Also treat a .git file as a checkout so that the clone check works in
a git worktree.
Spark 4.x, the default profile, does not compile on JDK 11: scalac
reports "Class java.lang.Record not found" and continues with a stub,
which surfaces much later as a confusing compilation failure.

Prefer the newest JDK under /usr/lib/jvm when JAVA_HOME is unset, rather
than the first one alphabetically, and check the version before building
or benchmarking so that the failure is immediate and explains itself.
The pom defaults java.version to 11 and only auto-activates a profile for
JDK 11 or JDK 17 exactly. On JDK 21 neither matches, so the Spark 4.x
sources compile against the Java 11 API and fail with "Class
java.lang.Record not found" despite the JDK being new enough.

Prefer a JDK 17 when detecting JAVA_HOME, and add -Pjdk17 to the build
and benchmark invocations whenever the JDK in use is a different version.
The last lines of a failed suite log are Maven's epilogue and a
NoClassDefFoundError from the Hadoop shutdown hook, which say nothing
about the cause. Print the first exception in the log instead, keeping
the tail for timeouts, where the end of the log is what matters.

Also give CometShuffleBenchmark 180 minutes rather than the default 60,
which it exceeds on a 4 vCPU instance.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant