Skip to content

Commit

Permalink
Merge pull request #118 from RobertKrawitz/io-flush-cache-optional
Browse files Browse the repository at this point in the history
Make cache flush an option
  • Loading branch information
RobertKrawitz authored Feb 23, 2023
2 parents d565e84 + 1b559f7 commit 755050c
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 5 deletions.
4 changes: 4 additions & 0 deletions lib/clusterbuster/CI/workloads/files.workload
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ declare -ga ___files_directs=(0 1)
declare -gi ___files_job_timeout=9000
declare -ga ___files_params=()
declare -gi ___files_min_direct=1024
declare -gi ___files_drop_cache=1

function files_test() {
___files_job_timeout=$(compute_timeout "$___files_job_timeout")
Expand Down Expand Up @@ -84,6 +85,7 @@ function files_process_option() {
files*timeout) ___files_job_timeout=$optvalue ;;
files*params) ___files_params+=(${optvalue//,/ }) ;;
filesmindir*) ___files_min_direct=$(parse_size "$optvalue") ;;
filesdrop*) ___files_drop_cache=$(bool "$optvalue") ;;
*) return 1 ;;
esac
}
Expand Down Expand Up @@ -122,6 +124,8 @@ function files_help_options() {
--files-direct=bool[,bool]
Space or comma separated list of whether to use
direct I/O. Default is $(IFS=,; echo "${___files_directs[*]}").
--files-drop-cache=[0,1]
Drop cache, don't merely sync (default $___files_drop_cache)
EOF
}

Expand Down
5 changes: 5 additions & 0 deletions lib/clusterbuster/CI/workloads/fio.workload
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ declare -g ___fio_relative_filesize=2
declare -g ___fio_max_relative_filesize=$___fio_relative_filesize
declare -gi ___fio_ramptime=5
declare -gi ___fio_job_timeout=9000
declare -gi ___fio_drop_cache=1
declare -gi ___fio_pod_memsize=

function fio_test() {
Expand Down Expand Up @@ -72,6 +73,7 @@ function fio_test() {
--fio_filesize="$filesize" \
--fio_ramp_time="$___fio_ramptime" \
--fio_workdir="$___fio_workdir" \
--fio-drop-cache="$___fio_drop_cache" \
${memory_annotation:+"$memory_annotation"}
done
}
Expand All @@ -95,6 +97,7 @@ function fio_process_option() {
fiorel*file*) ___fio_relative_filesize="$optvalue" ;;
fiomaxrel*file*) ___fio_max_relative_filesize="$optvalue" ;;
fio*timeout) ___fio_job_timeout=$optvalue ;;
fiodrop*) ___fio_drop_cache=$(bool "$optvalue") ;;
fio*memsize) ___fio_pod_memsize=$(parse_size "$optvalue") ;;
*) return 1 ;;
esac
Expand Down Expand Up @@ -149,6 +152,8 @@ function fio_help_options() {
is the global timeout default.
--fio-pod-memsize=size Memory size to allocate to sandboxed pods.
Default is the system default (normally 2GiB).
--fio-drop-cache=[0,1]
Drop cache, don't merely sync (default $___fio_drop_cache)
EOF
}

Expand Down
15 changes: 13 additions & 2 deletions lib/clusterbuster/workloads/files.workload
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ declare -ig ___file_block_size=0
declare -ig ___file_dirs_per_volume=1
declare -ig ___files_per_dir=1
declare -ig ___files_direct=0
declare -i ___files_drop_cache=1

function files_arglist() {
local mountdir=$1; shift
Expand All @@ -31,6 +32,12 @@ function files_arglist() {
local secret_count=$3
local replicas=$4
local containers_per_pod=$5
local dc_service=
local dc_port=0
if ((___files_drop_cache)) ; then
dc_service="svc-${namespace}-files-${instance}-${replica}-dc"
dc_port="$drop_cache_port"
fi
while [[ "$1" != '--' ]] ; do shift; done; shift
local -i file_blocks=$((___file_size/___file_block_size))
local mounts=("${volume_mount_paths[@]}" "${emptydirs[@]}")
Expand Down Expand Up @@ -86,6 +93,8 @@ function files_help_options() {
This should be a divisor of the file size; if not,
the results are unspecified.
--files-direct Use direct I/O (default no)
--files-drop-cache=[0,1]
Drop cache, don't merely sync (default $___files_drop_cache)
EOF
}

Expand All @@ -107,6 +116,7 @@ function files_process_options() {
fileblocksize) ___file_block_size=$(parse_size "$optvalue") ;;
filesize) ___file_size=$(parse_size "$optvalue") ;;
filesdirect) ___files_direct=$(bool "$optvalue") ;;
filesdrop*) ___files_drop_cache=$(bool "$optvalue") ;;
*) unknown_opts+=("$noptname ($noptname1)") ;;
esac
done
Expand All @@ -119,7 +129,7 @@ function files_process_options() {
}

function files_requires_drop_cache() {
:
((___files_drop_cache))
}

function files_supports_reporting() {
Expand All @@ -136,7 +146,8 @@ function files_report_options() {
"files_per_dir": $___files_per_dir,
"file_block_size": $___file_block_size,
"file_size": $___file_size,
"files_direct": $___files_direct
"files_direct": $___files_direct,
"files_drop_cache": $___files_drop_cache
EOF
}

Expand Down
17 changes: 14 additions & 3 deletions lib/clusterbuster/workloads/fio.workload
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ declare -gi ___fio_ramp_time=5
declare -gi ___fio_filesize=; ___fio_filesize=$(parse_size "4Gi")
declare -g ___fio_workdir="/tmp"
declare -g ___fio_processed_job_file
declare -i ___fio_drop_cache=1

function fio_arglist() {
local mountdir=$1; shift
Expand All @@ -38,10 +39,16 @@ function fio_arglist() {
local secret_count=$3
local replicas=$4
local containers_per_pod=$5
local dc_service=
local dc_port=0
if ((___fio_drop_cache)) ; then
dc_service="svc-${namespace}-fio-${instance}-${replica}-dc"
dc_port="$drop_cache_port"
fi
while [[ "$1" != '--' ]] ; do shift; done; shift
mk_yaml_args "python3" "${mountdir}fio.py" "$@" \
"$processes_per_pod" "$___fio_workdir" "$workload_run_time" "$configmap_mount_dir" \
"svc-${namespace}-fio-${instance}-${replica}-dc" "$drop_cache_port" \
"$dc_service" "$dc_port" \
"${___fio_blocksizes[*]:-}" "${___fio_patterns[*]:-}" "${___fio_iodepths[*]:-}" \
"${___fio_fdatasyncs[*]:-}" "${___fio_directs[*]:-}" "${___fio_ioengines[*]:-}" \
"$___fio_ramp_time" "${___fio_generic_options[*]:-}"
Expand Down Expand Up @@ -120,6 +127,8 @@ function fio_help_options() {
File size (default $___fio_filesize)
--fio-workdir=<dir>
Work directory (default $___fio_workdir)
--fio-drop-cache=[0,1]
Drop cache, don't merely sync (default $___fio_drop_cache)
EOF
}

Expand Down Expand Up @@ -154,6 +163,7 @@ function fio_process_options() {
fiofdatasync*) fiofdatasync=$optvalue ;;
fiofilesize) ___fio_filesize=$(parse_size "$optvalue");;
fioworkdir) ___fio_workdir=$optvalue ;;
fiodrop*) ___fio_drop_cache=$(bool "$optvalue") ;;
*) unknown_opts+=("$noptname ($noptname1)") ;;
esac
done
Expand Down Expand Up @@ -260,12 +270,13 @@ function fio_report_options() {
"fio_ioengines": $(mk_str_list "${___fio_ioengines[@]}"),
"fio_ramp_time": $___fio_ramp_time,
"fio_filesize": $___fio_filesize,
"fio_workdir": "$___fio_workdir"
"fio_workdir": "$___fio_workdir",
"fio_drop_cache": $___fio_drop_cache
EOF
}

function fio_requires_drop_cache() {
:
((___fio_drop_cache))
}

register_workload fio

0 comments on commit 755050c

Please sign in to comment.