Skip to content

Commit

Permalink
Adding fio config and scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
vibhansa-msft committed Feb 29, 2024
1 parent 40e58bc commit e1af5c6
Show file tree
Hide file tree
Showing 9 changed files with 237 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/perftest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,27 @@ jobs:
- name: "Validate Version"
run: |
./blobfuse2 --version
pwd
working-directory: ${{ github.workspace }}

- name: "Create config file"
run: |
./blobfuse2 gen-test-config --config-file=azure_block_bench.yaml --container-name=${{ secrets.BLOB_STORAGE_CONTAINER }} --output-file=./config.yaml
cat ./config.yaml
working-directory: ${{ github.workspace }}

- name: "Run Benchmark Script"
run: |
mkdir -p ./blob_mnt
./benchmark/fio_bench.sh ./blob_mnt
working-directory: ${{ github.workspace }}
env:
AZURE_STORAGE_ACCOUNT: ${{ secrets.BLOB_STORAGE_ACCOUNT }}
AZURE_STORAGE_ACCOUNT_CONTAINER: ${{ secrets.BLOB_STORAGE_CONTAINER }}
AZURE_STORAGE_ACCESS_KEY: ${{ secrets.BLOB_STORAGE_KEY }}

- name: "Print latest results"
run: cat ./benchmark/results.json
working-directory: ${{ github.workspace }}

- name: "Update Benchmark Results"
Expand All @@ -61,6 +82,8 @@ jobs:
comment-on-alert: true
gh-pages-branch: "benchmarks"
benchmark-data-dir-path: bandwidth





106 changes: 106 additions & 0 deletions benchmark/fio_bench.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
#!/bin/bash
set -e

output="./results_bandwidth"
iterations=3
mount_dir=$1

rm -rf ./blobfuse2.log
rm -rf ${output}
mkdir -p ${output}
chmod 777 ${output}

./blobfuse2 unmount all

run_fio_job() {
job_file=$1
bench_file=$2
log_dir=$4

job_name=$(basename "${job_file}")
job_name="${job_name%.*}"

echo -n "Running job ${job_name} for ${iterations} iterations... "

for i in $(seq 1 $iterations);
do
echo -n "${i};"
set +e
timeout 300s fio --thread \
--output=${output}/${job_name}_iter${i}.json \
--output-format=json \
--directory=${mount_dir} \
--filename=${bench_file} \
--eta=never \
${job_file}
job_status=$?
set -e
if [ $job_status -ne 0 ]; then
echo "Job ${job_name} failed : ${job_status}"
exit 1
fi
done

jq -n 'reduce inputs.jobs[] as $job (null; .name = $job.jobname | .len += 1 | .value += (if ($job."job options".rw == "read")
then $job.read.bw / 1024
elif ($job."job options".rw == "randread") then $job.read.bw / 1024
elif ($job."job options".rw == "randwrite") then $job.write.bw / 1024
else $job.write.bw / 1024 end)) | {name: .name, value: (.value / .len), unit: "MiB/s"}' ${output}/${job_name}_iter*.json | tee ${output}/${job_name}_parsed.json
}

read_benchmark () {
jobs_dir=./benchmark/fio_read_config

for job_file in "${jobs_dir}"/*.fio; do
job_name=$(basename "${job_file}")
job_name="${job_name%.*}"

echo "Running Read benchmark for ${job_name}"
set +e
./blobfuse2 mount ${mount_dir} --config-file=./config.yaml
mount_status=$?
set -e
if [ $mount_status -ne 0 ]; then
echo "Failed to mount file system"
exit 1
fi
sleep 3

run_fio_job $job_file ${job_name}.dat

./blobfuse2 unmount all
sleep 5
done
}

write_benchmark () {
jobs_dir=./benchmark/fio_write_config

for job_file in "${jobs_dir}"/*.fio; do
job_name=$(basename "${job_file}")
job_name="${job_name%.*}"

echo "Running Write benchmark for ${job_name}"

set +e
./blobfuse2 mount ${mount_dir} --config-file=./config.yaml
mount_status=$?
set -e
if [ $mount_status -ne 0 ]; then
echo "Failed to mount file system"
exit 1
fi
sleep 3

run_fio_job $job_file ${job_name}.dat

./blobfuse2 unmount all
sleep 5
done
}

write_benchmark
read_benchmark

# combine all bench results into one json file
jq -n '[inputs]' ${output}/*_parsed.json | tee ./benchmark/results.json
13 changes: 13 additions & 0 deletions benchmark/fio_read_config/rand_read.fio
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[global]
name=fs_bench
bs=256k
runtime=30s
time_based
group_reporting

[random_read]
size=10G
rw=randread
ioengine=sync
fallocate=none
startdelay=30s
13 changes: 13 additions & 0 deletions benchmark/fio_read_config/rand_read_small.fio
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[global]
name=fs_bench
bs=256k
runtime=30s
time_based
group_reporting

[random_read_small_file]
size=5m
rw=randread
ioengine=sync
fallocate=none
startdelay=30s
13 changes: 13 additions & 0 deletions benchmark/fio_read_config/seq_read.fio
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[global]
name=fs_bench
bs=256k
runtime=30s
time_based
group_reporting

[sequential_read]
size=10G
rw=read
ioengine=sync
fallocate=none
startdelay=30s
14 changes: 14 additions & 0 deletions benchmark/fio_read_config/seq_read_4thread.fio
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[global]
name=fs_bench
bs=256k
runtime=30s
time_based
group_reporting

[sequential_read_four_threads]
size=10G
rw=read
ioengine=sync
fallocate=none
numjobs=4
startdelay=30s
13 changes: 13 additions & 0 deletions benchmark/fio_read_config/seq_read_small.fio
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[global]
name=fs_bench
bs=256k
runtime=30s
time_based
group_reporting

[sequential_read_small_file]
size=5m
rw=read
ioengine=sync
fallocate=none
startdelay=30s
13 changes: 13 additions & 0 deletions benchmark/fio_write_config/seq_write.fio
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[global]
name=fs_bench
bs=256k
runtime=30s
time_based
group_reporting

[sequential_write]
size=10G
rw=write
ioengine=sync
fallocate=none
startdelay=30s
29 changes: 29 additions & 0 deletions testdata/config/azure_block_bench.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
logging:
level: log_err
file-path: "./blobfuse2.log"
type: base

components:
- libfuse
- block_cache
- attr_cache
- azstorage

libfuse:
attribute-expiration-sec: 120
entry-expiration-sec: 120
negative-entry-expiration-sec: 240
ignore-open-flags: true

block_cache:
block-size-mb: 16
mem-size-mb: 102400
prefetch: 200
parallelism: 300
prefetch-on-open: true

attr_cache:
timeout-sec: 7200

azstorage:
mode: key

0 comments on commit e1af5c6

Please sign in to comment.