1#!/bin/ksh 2 3# This file and its contents are supplied under the terms of the 4# Common Development and Distribution License ("CDDL"), version 1.0. 5# You may only use this file in accordance with the terms of version 6# 1.0 of the CDDL. 7# 8# A full copy of the text of the CDDL should have accompanied this 9# source. A copy of the CDDL is also available via the Internet at 10# http://www.illumos.org/license/CDDL. 11# 12 13# 14# Copyright (c) 2017, 2021 by Delphix. All rights reserved. 15# 16 17# 18# Description: 19# Trigger fio runs using the random_readwrite_fixed job file. The number of runs and 20# data collected is determined by the PERF_* variables. See do_fio_run for 21# details about these variables. 22# 23# The files to read and write from are created prior to the first fio run, 24# and used for all fio runs. The ARC is cleared with `zinject -a` prior to 25# each run so reads will go to disk. 26# 27 28. $STF_SUITE/include/libtest.shlib 29. $STF_SUITE/tests/perf/perf.shlib 30 31function cleanup 32{ 33 # kill fio and iostat 34 pkill fio 35 pkill iostat 36 recreate_perf_pool 37} 38 39trap "log_fail \"Measure IO stats during random read write load\"" SIGTERM 40log_onexit cleanup 41 42recreate_perf_pool 43populate_perf_filesystems 44 45# Aim to fill the pool to 50% capacity while accounting for a 3x compressratio. 46export TOTAL_SIZE=$(($(get_prop avail $PERFPOOL) * 3 / 2)) 47 48# Variables specific to this test for use by fio. 49export PERF_NTHREADS=${PERF_NTHREADS:-'64 128'} 50export PERF_NTHREADS_PER_FS=${PERF_NTHREADS_PER_FS:-'0'} 51export PERF_IOSIZES=${PERF_IOSIZES:-'8k'} 52export PERF_SYNC_TYPES=${PERF_SYNC_TYPES:-'0 1'} 53 54# Layout the files to be used by the readwrite tests. Create as many files 55# as the largest number of threads. An fio run with fewer threads will use 56# a subset of the available files. 57export NUMJOBS=$(get_max $PERF_NTHREADS) 58export FILE_SIZE=$((TOTAL_SIZE / NUMJOBS)) 59export DIRECTORY=$(get_directory) 60log_must fio $FIO_SCRIPTS/mkfiles.fio 61 62# Set up the scripts and output files that will log performance data. 63lun_list=$(pool_to_lun_list $PERFPOOL) 64log_note "Collecting backend IO stats with lun list $lun_list" 65if is_linux; then 66 typeset perf_record_cmd="perf record -F 99 -a -g -q \ 67 -o /dev/stdout -- sleep ${PERF_RUNTIME}" 68 69 export collect_scripts=( 70 "zpool iostat -lpvyL $PERFPOOL 1" "zpool.iostat" 71 "vmstat -t 1" "vmstat" 72 "mpstat -P ALL 1" "mpstat" 73 "iostat -tdxyz 1" "iostat" 74 "$perf_record_cmd" "perf" 75 ) 76else 77 export collect_scripts=( 78 "kstat zfs:0 1" "kstat" 79 "vmstat -T d 1" "vmstat" 80 "mpstat -T d 1" "mpstat" 81 "iostat -T d -xcnz 1" "iostat" 82 "dtrace -Cs $PERF_SCRIPTS/io.d $PERFPOOL $lun_list 1" "io" 83 "dtrace -s $PERF_SCRIPTS/profile.d" "profile" 84 ) 85fi 86 87log_note "Random reads and writes with settings: $(print_perf_settings)" 88do_fio_run random_readwrite_fixed.fio false true 89log_pass "Measure IO stats during random read and write load" 90