-
Notifications
You must be signed in to change notification settings - Fork 435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GLUTEN-7641][VL] Add Gluten benchmark scripts #7642
Merged
Merged
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
2a7e3da
gluten benchmark scripts
marin-ma 7542404
fix
marin-ma a021ff4
update
marin-ma 4a66ee6
update
marin-ma 9388c3c
fix
marin-ma dfab905
fix
marin-ma bc628da
update
marin-ma 420235e
remove duplicate
marin-ma bc58f7f
update
marin-ma 50d7f12
add install traceviewer
marin-ma 792f4b3
update
marin-ma fed5c1f
Merge branch 'main' into benchmark-scripts
FelixYBW 4a610a7
address comments
marin-ma File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Setup, Build and Benchmark Spark/Gluten with Jupyter Notebook | ||
|
||
This guide provides notebooks and scripts for conducting performance testing in Gluten. The standard approach involves setting up the test environment on a bare-metal machine or cloud instance and running performance tests with TPC-H/TPC-DS workloads. These scripts enable users to reproduce our performance results in their own environment. | ||
|
||
## Environment Setup | ||
|
||
The recommended OS is ubuntu22.04 with kernel 5.15. To prepare the environment, run [initialize.ipynb](./initialize.ipynb), which will: | ||
|
||
- Install system dependencies and set up jupyter notebook | ||
- Configure Hadoop and Spark | ||
- Configure kernel parameters | ||
- Install monitoring tools (e.g., sar, emon) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's remove emon |
||
- Build Gluten using Docker | ||
- Generate TPC-H/TPC-DS tables | ||
|
||
## Running TPC-H/TPC-DS Benchmarks | ||
|
||
To run TPC-H/TPC-DS benchmarks, use [tpc_workload.ipynb](./tpc_workload.ipynb). You can create a copy of the notebook and modify the parameters defined in this notebook to run different workloads. However, creating and modifying a copy each time you change workloads can be inconvenient. Instead, it's recommended to use Papermill to pass parameters via the command line for greater flexibility. | ||
|
||
The required parameters are specified in [params.yaml.template](./params.yaml.template). To use it, create your own YAML file by copying and modifying the template. The command to run the notebook is: | ||
|
||
```bash | ||
papermill tpc_workload.ipynb -f params.yaml gluten_tpch.ipynb | ||
``` | ||
After execution, the output notebook will be saved as `gluten_tpch.ipynb`. | ||
|
||
If you want to use different parameters, you can specify them via the `-f` option. It will overwrite the previously defined parameters in `params.yaml`. e.g. To switch to the TPC-DS workload, run: | ||
|
||
```bash | ||
papermill tpc_workload.ipynb -f params.yaml -p workoad tpcds gluten_tpcds.ipynb | ||
``` | ||
|
||
Please refer to the Papermill documentation for additional usage details. | ||
|
||
We also provide a script [run_tpc_workload.sh](./run_tpc_workload.sh). This script wraps the Papermill command, automatically renaming the output notebook with a timestamp and application ID to prevent overwriting existing output files. | ||
|
||
## Analyzing Performance Results | ||
|
||
You can check the **Show Performance** section in the output notebook after execution. It shows the cpu% per query, and draws charts for the cpu%, memory throughput, disk throughput/util%, network throughput and pagefaults. | ||
|
||
To get more detailed metrics, We use a performance analysis cluster to analyze the output from event log and system monitors (TBD). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import sys | ||
import subprocess | ||
import questionary | ||
import json | ||
|
||
def yes_or_no(question): | ||
while True: | ||
user_input = input(question + '(yes/no/quit): ') | ||
if user_input.lower() == 'yes': | ||
return True | ||
elif user_input.lower() == 'no': | ||
return False | ||
elif user_input.lower() == 'quit': | ||
sys.exit(0) | ||
else: | ||
continue | ||
|
||
def filter_empty_str(l): | ||
return [x for x in l if x] | ||
|
||
def run_and_log(cmd): | ||
print('\033[92m' + '>>> Running command: ' + repr(cmd) + '\033[0m') | ||
result = subprocess.run(cmd, check=True, shell=True, capture_output=True, text=True) | ||
print(result.stdout) | ||
print(result.stderr) | ||
|
||
def init_disks(): | ||
all_disks = filter_empty_str(subprocess.run("lsblk -I 7,8,259 -npd --output NAME".split(' '), capture_output=True, text=True).stdout.split('\n')) | ||
if not all_disks: | ||
print("No disks found on system. Exit.") | ||
sys.exit(0) | ||
|
||
answer = False | ||
disks = [] | ||
while not answer: | ||
disks = questionary.checkbox('Select disks to initialize:', choices=all_disks).ask() | ||
answer = yes_or_no('Confirm selected:\n' + '\n'.join(disks) + '\n') | ||
|
||
if not disks: | ||
print('No disks are selected.') | ||
return | ||
|
||
for d in disks: | ||
print('Initializing {} ...'.format(d)) | ||
run_and_log('wipefs -a {}'.format(d)) | ||
run_and_log('echo "g\nw\n" | fdisk {}'.format(d)) | ||
run_and_log('echo "n\n\n\n\nw\n" | fdisk {}'.format(d)) | ||
run_and_log('mkfs.ext4 {}p1'.format(d)) | ||
|
||
def mount_partitions(): | ||
subprocess.run('lsblk -pf --json > lsblk.json', shell=True) | ||
partitions = [] | ||
with open('lsblk.json', 'r') as f: | ||
data = json.load(f) | ||
for d in data['blockdevices']: | ||
if 'children' in d: | ||
for c in d['children']: | ||
if c['fstype'] == 'ext4': | ||
partitions.append(c['name']) | ||
answer = False | ||
while not answer: | ||
partitions = questionary.checkbox('Select partitions to create mount points:', choices=partitions).ask() | ||
answer = yes_or_no('Confirm selected:\n' + '\n'.join(partitions) + '\n') | ||
|
||
for i, p in enumerate(partitions): | ||
d = 'data{}'.format(i) | ||
run_and_log('e2label {} ""'.format(p)) | ||
run_and_log('e2label {} {}'.format(p, d)) | ||
run_and_log('mkdir -p /{}'.format(d)) | ||
run_and_log('mount -L {} /{}'.format(d, d)) | ||
|
||
def choose(): | ||
choice = questionary.select('Select operation:', choices=['Format disks', 'Mount partitions']).ask() | ||
print(choice) | ||
if choice == 'Format disks': | ||
init_disks() | ||
elif choice == 'Mount partitions': | ||
mount_partitions() | ||
|
||
if __name__ == '__main__': | ||
choose() |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the PR a work in progress or ready to merge? As I see contents in
tools/notebook
andtools/workload
are identical.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WIP
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zhztheplayer Moved contents in
tools/notebook
totools/workload/benchmark_velox