This is an automated email from the ASF dual-hosted git repository.
dongjoon pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/spark-kubernetes-operator.git
The following commit(s) were added to refs/heads/main by this push:
new 45048fd [SPARK-52662] Add `SparkApp` benchmark
45048fd is described below
commit 45048fd243d8b59ed7f912e488de5a0a3ac6c48a
Author: Dongjoon Hyun <[email protected]>
AuthorDate: Wed Jul 2 18:43:51 2025 -0700
[SPARK-52662] Add `SparkApp` benchmark
### What changes were proposed in this pull request?
This PR aims to add a simple E2E benchmark for `SparkApp` as a baseline.
### Why are the changes needed?
To check `SparkApp` creation and deletion in a measurable way.
### Does this PR introduce _any_ user-facing change?
No, this is a test.
### How was this patch tested?
Manual tests. When the argument is not given, the default value for the
number of jobs is 1000.
```
$ sh tests/benchmark/sparkapps.sh 100
CLEAN UP NAMESPACE FOR BENCHMARK
START BENCHMARK WITH 100 JOBS
FINISHED 100 JOBS IN 56 SECONDS.
DELETED 100 JOBS IN 40 SECONDS.
```
```
$ sh tests/benchmark/sparkapps.sh
CLEAN UP NAMESPACE FOR BENCHMARK
START BENCHMARK WITH 1000 JOBS
FINISHED 1000 JOBS IN 340 SECONDS.
DELETED 1000 JOBS IN 401 SECONDS.
```
### Was this patch authored or co-authored using generative AI tooling?
No.
Closes #273 from dongjoon-hyun/SPARK-52662.
Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
---
tests/benchmark/sparkapps.sh | 67 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 67 insertions(+)
diff --git a/tests/benchmark/sparkapps.sh b/tests/benchmark/sparkapps.sh
new file mode 100755
index 0000000..be363fc
--- /dev/null
+++ b/tests/benchmark/sparkapps.sh
@@ -0,0 +1,67 @@
+#!/usr/bin/env bash
+
+#
+# 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.
+#
+
+# 1. Clear the existing CRDs before staring the benchmark
+echo "CLEAN UP NAMESPACE FOR BENCHMARK"
+kubectl get sparkapplications.spark.apache.org -o name | xargs kubectl delete
+
+NUM="${1:-1000}"
+echo "START BENCHMARK WITH $NUM JOBS"
+
+# 2. Creation Benchmark
+filename=$(mktemp)
+
+for i in $(seq -f "%05g" 1 $NUM); do
+ cat << EOF >> $filename
+apiVersion: spark.apache.org/v1beta1
+kind: SparkApplication
+metadata:
+ name: test-${i}
+spec:
+ mainClass: "org.apache.spark.examples.DriverSubmissionTest"
+ jars: "local:///opt/spark/examples/jars/spark-examples.jar"
+ driverArgs: ["0"]
+ sparkConf:
+ spark.kubernetes.driver.request.cores: "100m"
+ spark.kubernetes.driver.request.memory: "100Mi"
+ spark.kubernetes.driver.master: "local[1]"
+ spark.kubernetes.authenticate.driver.serviceAccountName: "spark"
+ spark.kubernetes.container.image: "apache/spark:4.0.0"
+ runtimeVersions:
+ sparkVersion: "4.0.0"
+---
+EOF
+done
+
+start=`date +%s`
+kubectl apply -f $filename > /dev/null
+while [ $(kubectl get sparkapplications.spark.apache.org | grep
ResourceReleased | wc -l) -lt $NUM ]
+do
+ sleep 1
+done
+end=`date +%s`
+completionTime=$((end - start))
+echo "FINISHED $NUM JOBS IN $completionTime SECONDS."
+
+# 3. Deletion Benchmark
+start=`date +%s`
+kubectl get sparkapplications.spark.apache.org -o name | xargs kubectl delete
> /dev/null
+end=`date +%s`
+deletionTime=$((end - start))
+echo "DELETED $NUM JOBS IN $deletionTime SECONDS."
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]