1*65d28c0bSJohn Wren Kennedy#!/usr/bin/ksh 2*65d28c0bSJohn Wren Kennedy# file and its contents are supplied under the terms of the 3*65d28c0bSJohn Wren Kennedy# Common Development and Distribution License ("CDDL"), version 1.0. 4*65d28c0bSJohn Wren Kennedy# You may only use this file in accordance with the terms of version 5*65d28c0bSJohn Wren Kennedy# 1.0 of the CDDL. 6*65d28c0bSJohn Wren Kennedy# 7*65d28c0bSJohn Wren Kennedy# A full copy of the text of the CDDL should have accompanied this 8*65d28c0bSJohn Wren Kennedy# source. A copy of the CDDL is also available via the Internet at 9*65d28c0bSJohn Wren Kennedy# http://www.illumos.org/license/CDDL. 10*65d28c0bSJohn Wren Kennedy# 11*65d28c0bSJohn Wren Kennedy 12*65d28c0bSJohn Wren Kennedy# 13*65d28c0bSJohn Wren Kennedy# Copyright (c) 2017 by Delphix. All rights reserved. 14*65d28c0bSJohn Wren Kennedy# 15*65d28c0bSJohn Wren Kennedy 16*65d28c0bSJohn Wren Kennedy# 17*65d28c0bSJohn Wren Kennedy# Description: 18*65d28c0bSJohn Wren Kennedy# Trigger fio runs using the random_readwrite_fixed job file. The number of runs and 19*65d28c0bSJohn Wren Kennedy# data collected is determined by the PERF_* variables. See do_fio_run for 20*65d28c0bSJohn Wren Kennedy# details about these variables. 21*65d28c0bSJohn Wren Kennedy# 22*65d28c0bSJohn Wren Kennedy# The files to read and write from are created prior to the first fio run, 23*65d28c0bSJohn Wren Kennedy# and used for all fio runs. The ARC is cleared with `zinject -a` prior to 24*65d28c0bSJohn Wren Kennedy# each run so reads will go to disk. 25*65d28c0bSJohn Wren Kennedy# 26*65d28c0bSJohn Wren Kennedy 27*65d28c0bSJohn Wren Kennedy. $STF_SUITE/include/libtest.shlib 28*65d28c0bSJohn Wren Kennedy. $STF_SUITE/tests/perf/perf.shlib 29*65d28c0bSJohn Wren Kennedy 30*65d28c0bSJohn Wren Kennedyfunction cleanup 31*65d28c0bSJohn Wren Kennedy{ 32*65d28c0bSJohn Wren Kennedy recreate_perf_pool 33*65d28c0bSJohn Wren Kennedy} 34*65d28c0bSJohn Wren Kennedy 35*65d28c0bSJohn Wren Kennedylog_onexit cleanup 36*65d28c0bSJohn Wren Kennedy 37*65d28c0bSJohn Wren Kennedyrecreate_perf_pool 38*65d28c0bSJohn Wren Kennedypopulate_perf_filesystems 39*65d28c0bSJohn Wren Kennedy 40*65d28c0bSJohn Wren Kennedy# Aim to fill the pool to 50% capacity while accounting for a 3x compressratio. 41*65d28c0bSJohn Wren Kennedyexport TOTAL_SIZE=$(($(get_prop avail $PERFPOOL) * 3 / 2)) 42*65d28c0bSJohn Wren Kennedy 43*65d28c0bSJohn Wren Kennedy# Variables for use by fio. 44*65d28c0bSJohn Wren Kennedyif [[ -n $PERF_REGRESSION_WEEKLY ]]; then 45*65d28c0bSJohn Wren Kennedy export PERF_RUNTIME=${PERF_RUNTIME:-$PERF_RUNTIME_WEEKLY} 46*65d28c0bSJohn Wren Kennedy export PERF_RUNTYPE=${PERF_RUNTYPE:-'weekly'} 47*65d28c0bSJohn Wren Kennedy export PERF_NTHREADS=${PERF_NTHREADS:-'8 16 32 64'} 48*65d28c0bSJohn Wren Kennedy export PERF_NTHREADS_PER_FS=${PERF_NTHREADS_PER_FS:-'0'} 49*65d28c0bSJohn Wren Kennedy export PERF_SYNC_TYPES=${PERF_SYNC_TYPES:-'0 1'} 50*65d28c0bSJohn Wren Kennedy export PERF_IOSIZES='8k 64k' 51*65d28c0bSJohn Wren Kennedyelif [[ -n $PERF_REGRESSION_NIGHTLY ]]; then 52*65d28c0bSJohn Wren Kennedy export PERF_RUNTIME=${PERF_RUNTIME:-$PERF_RUNTIME_NIGHTLY} 53*65d28c0bSJohn Wren Kennedy export PERF_RUNTYPE=${PERF_RUNTYPE:-'nightly'} 54*65d28c0bSJohn Wren Kennedy export PERF_NTHREADS=${PERF_NTHREADS:-'64 128'} 55*65d28c0bSJohn Wren Kennedy export PERF_NTHREADS_PER_FS=${PERF_NTHREADS_PER_FS:-'0'} 56*65d28c0bSJohn Wren Kennedy export PERF_SYNC_TYPES=${PERF_SYNC_TYPES:-'1'} 57*65d28c0bSJohn Wren Kennedy export PERF_IOSIZES='8k' 58*65d28c0bSJohn Wren Kennedyfi 59*65d28c0bSJohn Wren Kennedy 60*65d28c0bSJohn Wren Kennedy# Layout the files to be used by the readwrite tests. Create as many files 61*65d28c0bSJohn Wren Kennedy# as the largest number of threads. An fio run with fewer threads will use 62*65d28c0bSJohn Wren Kennedy# a subset of the available files. 63*65d28c0bSJohn Wren Kennedyexport NUMJOBS=$(get_max $PERF_NTHREADS) 64*65d28c0bSJohn Wren Kennedyexport FILE_SIZE=$((TOTAL_SIZE / NUMJOBS)) 65*65d28c0bSJohn Wren Kennedyexport DIRECTORY=$(get_directory) 66*65d28c0bSJohn Wren Kennedylog_must fio $FIO_SCRIPTS/mkfiles.fio 67*65d28c0bSJohn Wren Kennedy 68*65d28c0bSJohn Wren Kennedy# Set up the scripts and output files that will log performance data. 69*65d28c0bSJohn Wren Kennedylun_list=$(pool_to_lun_list $PERFPOOL) 70*65d28c0bSJohn Wren Kennedylog_note "Collecting backend IO stats with lun list $lun_list" 71*65d28c0bSJohn Wren Kennedyexport collect_scripts=( 72*65d28c0bSJohn Wren Kennedy "kstat zfs:0 1" "kstat" 73*65d28c0bSJohn Wren Kennedy "vmstat -T d 1" "vmstat" 74*65d28c0bSJohn Wren Kennedy "mpstat -T d 1" "mpstat" 75*65d28c0bSJohn Wren Kennedy "iostat -T d -xcnz 1" "iostat" 76*65d28c0bSJohn Wren Kennedy "dtrace -Cs $PERF_SCRIPTS/io.d $PERFPOOL $lun_list 1" "io" 77*65d28c0bSJohn Wren Kennedy "dtrace -s $PERF_SCRIPTS/profile.d" "profile" 78*65d28c0bSJohn Wren Kennedy) 79*65d28c0bSJohn Wren Kennedy 80*65d28c0bSJohn Wren Kennedylog_note "Random reads and writes with $PERF_RUNTYPE settings" 81*65d28c0bSJohn Wren Kennedydo_fio_run random_readwrite_fixed.fio false true 82*65d28c0bSJohn Wren Kennedylog_pass "Measure IO stats during random read and write load" 83