|
1 | 1 | --- |
2 | | -title: Benchmark Spark |
| 2 | +title: Benchmark Apache Spark on Azure Cobalt 100 Arm64 and x86_64 |
3 | 3 | weight: 7 |
4 | 4 |
|
5 | 5 | ### FIXED, DO NOT MODIFY |
6 | 6 | layout: learningpathall |
7 | 7 | --- |
8 | 8 |
|
9 | | -## Apache Spark Internal Benchmarking |
10 | | -Apache Spark includes internal micro-benchmarks to evaluate the performance of core components like SQL execution, aggregation, joins, and data source reads. These benchmarks are helpful for comparing platforms such as x86_64 vs Arm64. |
11 | | -Below are the steps to run Spark’s built-in SQL benchmarks using the SBT-based framework. |
| 9 | +# Benchmark Apache Spark on Azure Cobalt 100 Arm64 and x86_64 |
12 | 10 |
|
13 | | -1. Clone the Apache Spark source code |
14 | | -```console |
15 | | -git clone https://github.com/apache/spark.git |
16 | | -``` |
17 | | -This downloads the full Spark source including internal test suites and the benchmarking tools. |
| 11 | +Apache Spark includes internal micro-benchmarks to evaluate the performance of core components such as SQL execution, aggregation, joins, and data source reads. These benchmarks are useful for comparing performance on Arm64 and x86_64 platforms in Azure. |
18 | 12 |
|
19 | | -2. Checkout the desired Spark version |
20 | | -```console |
21 | | -cd spark/ && git checkout v4.0.0 |
22 | | -``` |
23 | | -Switch to the stable Spark 4.0.0 release, which supports the latest internal benchmarking APIs. |
| 13 | +This section shows you how to run Spark’s built-in SQL benchmarks using the SBT-based framework. |
24 | 14 |
|
25 | | -3. Build Spark with benchmarking profile enabled |
26 | | -```console |
27 | | -./build/sbt -Pbenchmarks clean package |
28 | | -``` |
29 | | -This compiles Spark and its dependencies, enabling the benchmarks build profile for performance testing. |
| 15 | +## Steps to run Spark benchmarks |
30 | 16 |
|
31 | | -4. Run a built-in benchmark suite |
32 | | -```console |
33 | | -./build/sbt -Pbenchmarks "sql/test:runMain org.apache.spark.sql.execution.benchmark.JoinBenchmark" |
34 | | -``` |
35 | | -This executes the `JoinBenchmark`, which measures the performance of various SQL join operations (e.g., SortMergeJoin, BroadcastHashJoin) under different query plans. It helps evaluate how Spark SQL optimizes and executes join strategies, especially with and without WholeStageCodegen, a technique that compiles entire query stages into efficient bytecode for faster execution. |
| 17 | +1. Clone the Apache Spark source code |
| 18 | + |
| 19 | + ```console |
| 20 | + git clone https://github.com/apache/spark.git |
| 21 | + ``` |
| 22 | + This downloads the full Spark source code, including test suites and benchmarking tools |
| 23 | + |
| 24 | +2. Checkout the desired Spark version |
| 25 | + |
| 26 | + ```console |
| 27 | + cd spark/ && git checkout v4.0.0 |
| 28 | + ``` |
| 29 | + Switch to the stable Spark 4.0.0 release, which supports the latest benchmarking APIs |
| 30 | + |
| 31 | +3. Build Spark with the benchmarking profile |
| 32 | + |
| 33 | + ```console |
| 34 | + ./build/sbt -Pbenchmarks clean package |
| 35 | + ``` |
| 36 | + This compiles Spark and its dependencies, enabling the benchmarking build profile |
| 37 | + |
| 38 | +4. Run a built-in benchmark suite |
| 39 | + |
| 40 | + ```console |
| 41 | + ./build/sbt -Pbenchmarks "sql/test:runMain org.apache.spark.sql.execution.benchmark.JoinBenchmark" |
| 42 | + ``` |
| 43 | + This runs the `JoinBenchmark`, which measures the performance of SQL join operations such as `SortMergeJoin` and `BroadcastHashJoin`. It evaluates how Spark SQL optimizes join strategies, especially with and without WholeStageCodegen |
| 44 | + |
| 45 | +## Example Apache Spark benchmark output |
| 46 | + |
| 47 | +You should see output similar to the following: |
36 | 48 |
|
37 | | -The output should look similar to: |
38 | 49 | ```output |
39 | 50 | [info] Running benchmark: Join w long |
40 | 51 | [info] Running case: Join w long wholestage off |
@@ -180,7 +191,7 @@ The output should look similar to: |
180 | 191 | - **Relative Speed comparison:** baseline (1.0X) is the slower version. |
181 | 192 |
|
182 | 193 | {{% notice Note %}} |
183 | | -Benchmarking was performed in both an Azure Linux 3.0 Docker container and an Azure Linux 3.0 virtual machine. The benchmark results were found to be comparable. |
| 194 | +Benchmarks were performed in both an Azure Linux 3.0 Docker container and an Azure Linux 3.0 virtual machine. Results were found to be comparable. |
184 | 195 | {{% /notice %}} |
185 | 196 |
|
186 | 197 |
|
@@ -241,11 +252,11 @@ Shown here is a summary of the benchmark results collected on an `x86_64` `D4s_v |
241 | 252 |
|
242 | 253 | ### Benchmark comparison insights |
243 | 254 |
|
244 | | -When you compare the benchmark results you will notice that on the Azure Linux Arm64 virtual machine: |
| 255 | +When comparing the results on Arm64 vs x86_64 virtual machines: |
245 | 256 |
|
246 | | -- Whole-stage codegen improves performance by up to 2.8× on complex joins (e.g., with long columns). |
247 | | -- Simple joins (e.g., on integers) show negligible performance gain, remains comparable to performance on `x86_64`. |
248 | | -- Broadcast and shuffle-based joins benefit with 1.4× to 1.5× improvements. |
249 | | -- Overall enabling whole-stage codegen consistently improves performance across most join types. |
| 257 | +- Whole-stage codegen improves performance by up to 2.8× on complex joins |
| 258 | +- Simple joins, such as integer joins, show negligible performance differences |
| 259 | +- Broadcast and shuffle-based joins achieve 1.4× to 1.5× improvements |
| 260 | +- Enabling whole-stage codegen consistently improves performance across most join types |
250 | 261 |
|
251 | | -You have successfully learnt how to deploy Apache Spark on an Azure Cobalt 100 virtual machine and measure the performance uplift. |
| 262 | +You have now benchmarked Apache Spark on an Azure Cobalt 100 Arm64 virtual machine and compared results with x86_64. |
0 commit comments