Improve benchmarks: add IO intensive task workload, add task size option, integrate...
[poolifier.git] / benchmarks / versus-external-pools / bench.sh
1 #!/usr/bin/env bash
2
3 ### The -t argument permit to specify the type of task that you want to benchmark.
4 ### The -s argument permit to specify the size of task that you want to benchmark.
5 ### Supported values are CPU_INTENSIVE, IO_INTENSIVE
6
7 taskType='CPU_INTENSIVE'
8 taskSize=5000
9 while getopts "t:s:h" option
10 do
11 case "${option}" in
12 t)
13 taskType=${OPTARG}
14 ;;
15 s)
16 taskSize=${OPTARG}
17 ;;
18 *|h)
19 echo "Usage: $0 [-t taskType] [-s taskSize]"
20 exit 1
21 ;;
22 esac
23 done
24
25 echo 'Running benchmarks for task type:' ${taskType} 'and task size:' ${taskSize}
26 export TASK_TYPE=${taskType}
27 export TASK_SIZE=${taskSize}
28 # Execute bench
29 export NODE_ENV=production
30 export POOL_SIZE=10
31 export NUM_ITERATIONS=100000
32 case "$OSTYPE" in
33 darwin*)
34 caffeinate ./hyperfine_benchmarks.sh
35 ;;
36 linux*)
37 systemd-inhibit ./hyperfine_benchmarks.sh
38 ;;
39 *)
40 echo "Unsupported $OSTYPE"
41 ;;
42 esac