diff --git a/.github/workflows/perftest.yml b/.github/workflows/perftest.yml index c2213f535..2eb82eb0b 100644 --- a/.github/workflows/perftest.yml +++ b/.github/workflows/perftest.yml @@ -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" @@ -61,6 +82,8 @@ jobs: comment-on-alert: true gh-pages-branch: "benchmarks" benchmark-data-dir-path: bandwidth + + diff --git a/benchmark/fio_bench.sh b/benchmark/fio_bench.sh new file mode 100644 index 000000000..4509e8c7a --- /dev/null +++ b/benchmark/fio_bench.sh @@ -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 \ No newline at end of file diff --git a/benchmark/fio_read_config/rand_read.fio b/benchmark/fio_read_config/rand_read.fio new file mode 100644 index 000000000..81e1d0b04 --- /dev/null +++ b/benchmark/fio_read_config/rand_read.fio @@ -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 \ No newline at end of file diff --git a/benchmark/fio_read_config/rand_read_small.fio b/benchmark/fio_read_config/rand_read_small.fio new file mode 100644 index 000000000..ddc4f2216 --- /dev/null +++ b/benchmark/fio_read_config/rand_read_small.fio @@ -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 \ No newline at end of file diff --git a/benchmark/fio_read_config/seq_read.fio b/benchmark/fio_read_config/seq_read.fio new file mode 100644 index 000000000..07d529b2e --- /dev/null +++ b/benchmark/fio_read_config/seq_read.fio @@ -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 \ No newline at end of file diff --git a/benchmark/fio_read_config/seq_read_4thread.fio b/benchmark/fio_read_config/seq_read_4thread.fio new file mode 100644 index 000000000..edbdf93f4 --- /dev/null +++ b/benchmark/fio_read_config/seq_read_4thread.fio @@ -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 \ No newline at end of file diff --git a/benchmark/fio_read_config/seq_read_small.fio b/benchmark/fio_read_config/seq_read_small.fio new file mode 100644 index 000000000..02338ff42 --- /dev/null +++ b/benchmark/fio_read_config/seq_read_small.fio @@ -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 \ No newline at end of file diff --git a/benchmark/fio_write_config/seq_write.fio b/benchmark/fio_write_config/seq_write.fio new file mode 100644 index 000000000..59ae4c3c4 --- /dev/null +++ b/benchmark/fio_write_config/seq_write.fio @@ -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 \ No newline at end of file diff --git a/testdata/config/azure_block_bench.yaml b/testdata/config/azure_block_bench.yaml new file mode 100644 index 000000000..2c0dfe6ad --- /dev/null +++ b/testdata/config/azure_block_bench.yaml @@ -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