/tests/zfs-tests/tests/perf/regression/random_readwrite_fixed.ksh

https://github.com/adilger/zfs · Korn Shell · 106 lines · 63 code · 13 blank · 30 comment · 2 complexity · a35d181aeae6813f9c3c8dc4b1d74f2f MD5 · raw file

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