From b9b18a13c85871ef4f7472661513fe402515de18 Mon Sep 17 00:00:00 2001 From: esgn <5435148+esgn@users.noreply.github.com> Date: Thu, 21 Mar 2024 10:33:38 +0100 Subject: [PATCH] add huge_pages and cleanup --- pgtune.sh | 163 ++++++++++-------- .../10_linux_web_8GB_8_1000_hdd.txt | 1 + .../10_linux_web_8GB_8_1000_san.txt | 1 + .../10_linux_web_8GB_8_1000_ssd.txt | 1 + .../11_linux_web_8GB_8_1000_hdd.txt | 1 + .../11_linux_web_8GB_8_1000_san.txt | 1 + .../11_linux_web_8GB_8_1000_ssd.txt | 1 + .../12_linux_web_8GB_8_1000_hdd.txt | 1 + .../12_linux_web_8GB_8_1000_san.txt | 1 + .../12_linux_web_8GB_8_1000_ssd.txt | 1 + .../13_linux_web_8GB_8_1000_hdd.txt | 1 + .../13_linux_web_8GB_8_1000_san.txt | 1 + .../13_linux_web_8GB_8_1000_ssd.txt | 1 + .../14_linux_web_8GB_8_1000_hdd.txt | 1 + .../14_linux_web_8GB_8_1000_san.txt | 1 + .../14_linux_web_8GB_8_1000_ssd.txt | 1 + .../15_linux_web_8GB_8_1000_hdd.txt | 1 + .../15_linux_web_8GB_8_1000_san.txt | 1 + .../15_linux_web_8GB_8_1000_ssd.txt | 1 + .../9.5_linux_web_8GB_8_1000_hdd.txt | 1 + .../9.5_linux_web_8GB_8_1000_san.txt | 1 + .../9.5_linux_web_8GB_8_1000_ssd.txt | 1 + .../9.6_linux_web_8GB_8_1000_hdd.txt | 1 + .../9.6_linux_web_8GB_8_1000_san.txt | 1 + .../9.6_linux_web_8GB_8_1000_ssd.txt | 1 + test/scripts/test_pgtune.sh | 22 +-- 26 files changed, 127 insertions(+), 82 deletions(-) diff --git a/pgtune.sh b/pgtune.sh index e9fa6c8..7c770e8 100644 --- a/pgtune.sh +++ b/pgtune.sh @@ -37,7 +37,7 @@ It produces a postgresql.conf file based on supplied parameters. accepted values: integer between 1 and 9999 CPUs = threads per core * cores per socket * sockets default value: this script will try to determine the CPUs count and exit in case of failure - -c MAX_CONN (optional) Maxsimum number of PostgreSQL client connections + -c MAX_CONN (optional) Maximum number of PostgreSQL client connections accepted values: integer between 20 and 9999 default value: preset corresponding to DB_TYPE -s STGE_TYPE (optional) Type of data storage device used with PostgreSQL @@ -57,7 +57,7 @@ function _warn() { } ####################################### -# Utility function to print an error. +# Utility function to print an error # related to an input value # Arguments: # Message to print as input error @@ -68,7 +68,7 @@ function _input_error() { } ####################################### -# Utility functions to print error messages. +# Utility function to print error messages. # Arguments: # Message to print as error ####################################### @@ -90,7 +90,7 @@ function get_total_ram () { if [[ -z $total_ram ]] || [[ "$total_ram" -eq "0" ]]; then _error "Cannot detect total memory size, terminating script. Please supply -m TOTAL_MEM." fi - echo $total_ram + echo "$total_ram" } ####################################### @@ -106,7 +106,7 @@ function get_cpu_count () { if [[ -z $cpu_count ]] || [[ "$cpu_count" -eq "0" ]]; then _error "Cannot detect CPU count, terminating script. Please supply -u CPU_COUNT." fi - echo $cpu_count + echo "$cpu_count" } ####################################### @@ -416,7 +416,7 @@ function set_random_page_cost() { } ####################################### -# Set set_random_page_cost config value. +# Set effective_io_concurrency config value. # Globals: # STORAGE_TYPE: used # effective_io_concurrency: modified @@ -456,26 +456,31 @@ function set_effective_io_concurrency() { ####################################### function set_parallel_settings() { declare -Ag parallel_settings - if [ "$CPU_NUM" -lt 2 ] || ( [ "${DB_VERSION%.*}" -le 9 ] && [ "${DB_VERSION//./}" -lt 95 ] ); then + declare -ag orders + if [ "$CPU_NUM" -lt 2 ] || { [ "${DB_VERSION%.*}" -le 9 ] && [ "${DB_VERSION//./}" -lt 95 ]; }; then return 0 fi - parallel_settings[max_worker_processes]="$CPU_NUM" + parallel_settings["max_worker_processes"]="$CPU_NUM" + orders+=( "max_worker_processes" ) if [ "${DB_VERSION//./}" -ge "96" ] || [ "${DB_VERSION%.*}" -ge 10 ]; then workers_per_gather=$(( CPU_NUM / 2 )) if [ $workers_per_gather -gt 4 ] && [[ "$DB_TYPE" != "dw" ]]; then workers_per_gather=4 fi - parallel_settings[max_parallel_workers_per_gather]="$workers_per_gather" + parallel_settings["max_parallel_workers_per_gather"]="$workers_per_gather" + orders+=( "max_parallel_workers_per_gather" ) fi if [ "${DB_VERSION%.*}" -ge 10 ]; then - parallel_settings[max_parallel_workers]="$CPU_NUM" + parallel_settings["max_parallel_workers"]="$CPU_NUM" + orders+=( "max_parallel_workers" ) fi if [ "${DB_VERSION%.*}" -ge 11 ]; then maintenance_workers=$(( CPU_NUM / 2 )) if [ $maintenance_workers -gt 4 ]; then maintenance_workers=4 fi - parallel_settings[max_parallel_maintenance_workers]="$maintenance_workers" + parallel_settings["max_parallel_maintenance_workers"]="$maintenance_workers" + orders+=( "max_parallel_maintenance_workers" ) fi } @@ -493,13 +498,13 @@ function set_parallel_settings() { function set_work_mem() { local -i parallel_for_work_mem=1 if [ "${#parallel_settings[@]}" -gt "0" ]; then - if [[ ${parallel_settings[max_parallel_workers_per_gather]} ]]; then - parallel_for_work_mem=${parallel_settings[max_parallel_workers_per_gather]} + if [[ ${parallel_settings["max_parallel_workers_per_gather"]} ]]; then + parallel_for_work_mem=${parallel_settings["max_parallel_workers_per_gather"]} fi - elif [ ! -z ${max_parallel_workers_per_gather+x} ]; then + elif [ -n "${max_parallel_workers_per_gather+x}" ]; then parallel_for_work_mem=$max_parallel_workers_per_gather fi - work_mem_value=$(( ($TOTAL_MEM - $shared_buffers) / ($CONN_NUM * 3) / $parallel_for_work_mem )) + work_mem_value=$(( (TOTAL_MEM - shared_buffers) / (CONN_NUM * 3) / parallel_for_work_mem )) case "$DB_TYPE" in "web") work_mem=$work_mem_value @@ -508,13 +513,13 @@ function set_work_mem() { work_mem=$work_mem_value ;; "dw") - work_mem=$(( $work_mem_value/2 )) + work_mem=$(( work_mem_value/2 )) ;; "desktop") - work_mem=$(( $work_mem_value/6 )) + work_mem=$(( work_mem_value/6 )) ;; "mixed") - work_mem=$(( $work_mem_value/2 )) + work_mem=$(( work_mem_value/2 )) ;; *) _error "unknown DB_TYPE, cannot calculate work_mem" @@ -525,6 +530,20 @@ function set_work_mem() { fi } +####################################### +# Set huge pages +# Globals: +# disk_type: used +# huge_pages: modified +####################################### +function set_huge_pages() { + if [[ "$TOTAL_MEM" -ge "$(( 32 * MB ))" ]]; then + huge_pages="try" + else + huge_pages="off" + fi +} + ####################################### # Format config option value # Arguments: @@ -541,15 +560,15 @@ function format_value() { else space="" fi - if [ $(( $1 % $MB )) -eq 0 ]; then - formatted_value=$(( $1 / $MB ))$space"GB" - echo $formatted_value - elif [ $(( $1 % $KB )) -eq 0 ]; then - formatted_value=$(( $1 / $KB ))$space"MB" - echo $formatted_value + if [ $(( $1 % MB )) -eq 0 ]; then + formatted_value=$(( $1 / MB ))$space"GB" + echo "$formatted_value" + elif [ $(( $1 % KB )) -eq 0 ]; then + formatted_value=$(( $1 / KB ))$space"MB" + echo "$formatted_value" else formatted_value=$1$space"kB" - echo $formatted_value + echo "$formatted_value" fi } @@ -566,26 +585,26 @@ function main() { ;; v) v=$OPTARG - if [ $v != "9.5" ] && \ - [ $v != "9.6" ] && \ - [ $v != "10" ] && \ - [ $v != "11" ] && \ - [ $v != "12" ] && \ - [ $v != "13" ] && \ - [ $v != "14" ] && \ - [ $v != "15" ] && \ - [ $v != "16" ]; then + if [ "$v" != "9.5" ] && \ + [ "$v" != "9.6" ] && \ + [ "$v" != "10" ] && \ + [ "$v" != "11" ] && \ + [ "$v" != "12" ] && \ + [ "$v" != "13" ] && \ + [ "$v" != "14" ] && \ + [ "$v" != "15" ] && \ + [ "$v" != "16" ]; then _input_error "$v is not a valid PostgreSQL version number" fi DB_VERSION=$v ;; t) t=$OPTARG - if [ $t != "web" ] && \ - [ $t != "oltp" ] && \ - [ $t != "dw" ] && \ - [ $t != "desktop" ] && \ - [ $t != "mixed" ]; then + if [ "$t" != "web" ] && \ + [ "$t" != "oltp" ] && \ + [ "$t" != "dw" ] && \ + [ "$t" != "desktop" ] && \ + [ "$t" != "mixed" ]; then _input_error "$t is not a valid database type identifier" fi DB_TYPE="$t" @@ -597,13 +616,13 @@ function main() { if [ "$ram" -lt "512" ] || [ "$ram" -gt "9999" ]; then _input_error "total memory in MB must be greater than or equal to 512MB and less than or equal to 9999MB" fi - ram=$(( $ram*$KB )) + ram=$(( ram*KB )) elif [[ $m == *"GB"* ]]; then ram=${m%"GB"} if [ "$ram" -lt "1" ] || [ "$ram" -gt "9999" ]; then _input_error "total memory in GB must be greater than or equal to 1GB and less than or equal to 9999GB" fi - ram=$(( $ram*$MB )) + ram=$(( ram*MB )) else _input_error "$m does not contain a valid unit identifier (use MB or GB)" fi @@ -625,9 +644,9 @@ function main() { ;; s) s=$OPTARG - if [ $s != "hdd" ] && \ - [ $s != "ssd" ] && \ - [ $s != "san" ]; then + if [ "$s" != "hdd" ] && \ + [ "$s" != "ssd" ] && \ + [ "$s" != "san" ]; then _input_error "$s is not a valid storage type identifier" fi STORAGE_TYPE="$s" @@ -639,7 +658,7 @@ function main() { esac done - if [ "$DB_VERSION" -eq "0" ]; then + if [ "${DB_VERSION//./}" -eq "0" ]; then DB_VERSION=16 fi @@ -659,11 +678,11 @@ function main() { STORAGE_TYPE=$(get_disk_type) fi - if [ "$DB_VERSION" -eq "0" ]; then + if [ "${DB_VERSION//./}" -eq "0" ]; then DB_VERSION=16 fi - if [ $CONN_NUM -eq "0" ]; then + if [ "$CONN_NUM" -eq "0" ]; then case $DB_TYPE in "web") CONN_NUM=200 @@ -706,34 +725,36 @@ function main() { set_effective_io_concurrency || exit $? set_parallel_settings set_work_mem || exit $? + set_huge_pages - echo "# DB Version: "$DB_VERSION + echo "# DB Version: $DB_VERSION" echo "# OS Type: linux" - echo "# DB Type: "$DB_TYPE - echo "# Total Memory (RAM): "$(format_value $TOTAL_MEM 1) - echo "# CPUs num: "$CPU_NUM - echo "# Connections num: "$CONN_NUM - echo "# Data Storage: "$STORAGE_TYPE + echo "# DB Type: $DB_TYPE" + echo "# Total Memory (RAM): $(format_value "$TOTAL_MEM" 1)" + echo "# CPUs num: $CPU_NUM" + echo "# Connections num: $CONN_NUM" + echo "# Data Storage: $STORAGE_TYPE" echo - echo "max_connections = "$CONN_NUM - echo "shared_buffers = "$(format_value $shared_buffers) - echo "effective_cache_size = "$(format_value $effective_cache_size) - echo "maintenance_work_mem = "$(format_value $maintenance_work_mem) - echo "checkpoint_completion_target = "$checkpoint_completion_target - echo "wal_buffers = "$(format_value $wal_buffers) - echo "default_statistics_target = "$default_statistics_target - echo "random_page_cost = "$random_page_cost - echo "effective_io_concurrency = "$effective_io_concurrency - echo "work_mem = "$(format_value $work_mem) - echo "min_wal_size = "$(format_value $min_wal_size) - echo "max_wal_size = "$(format_value $max_wal_size) - - for key in "${!parallel_settings[@]}"; do - echo $key" = "${parallel_settings[$key]} + echo "max_connections = $CONN_NUM" + echo "shared_buffers = $(format_value $shared_buffers)" + echo "effective_cache_size = $(format_value $effective_cache_size)" + echo "maintenance_work_mem = $(format_value $maintenance_work_mem)" + echo "checkpoint_completion_target = $checkpoint_completion_target" + echo "wal_buffers = $(format_value $wal_buffers)" + echo "default_statistics_target = $default_statistics_target" + echo "random_page_cost = $random_page_cost" + echo "effective_io_concurrency = $effective_io_concurrency" + echo "work_mem = $(format_value $work_mem)" + echo "huge_pages = $huge_pages" + echo "min_wal_size = $(format_value $min_wal_size)" + echo "max_wal_size = $(format_value $max_wal_size)" + + for key in "${orders[@]}"; do + echo "$key = ${parallel_settings["$key"]}" done - if [ ! -z ${checkpoint_segments+x} ]; then - echo "checkpoint_segments = "$checkpoint_segments - fi + if [ -n "${checkpoint_segments+x}" ]; then + echo "checkpoint_segments = $checkpoint_segments" + fi unset set_parallel_settings } diff --git a/test/expected_results/10_linux_web_8GB_8_1000_hdd.txt b/test/expected_results/10_linux_web_8GB_8_1000_hdd.txt index 47f5b36..05a8d2e 100644 --- a/test/expected_results/10_linux_web_8GB_8_1000_hdd.txt +++ b/test/expected_results/10_linux_web_8GB_8_1000_hdd.txt @@ -16,6 +16,7 @@ default_statistics_target = 100 random_page_cost = 4 effective_io_concurrency = 2 work_mem = 524kB +huge_pages = off min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 diff --git a/test/expected_results/10_linux_web_8GB_8_1000_san.txt b/test/expected_results/10_linux_web_8GB_8_1000_san.txt index b05417e..f6972dd 100644 --- a/test/expected_results/10_linux_web_8GB_8_1000_san.txt +++ b/test/expected_results/10_linux_web_8GB_8_1000_san.txt @@ -16,6 +16,7 @@ default_statistics_target = 100 random_page_cost = 1.1 effective_io_concurrency = 300 work_mem = 524kB +huge_pages = off min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 diff --git a/test/expected_results/10_linux_web_8GB_8_1000_ssd.txt b/test/expected_results/10_linux_web_8GB_8_1000_ssd.txt index f752792..c994226 100644 --- a/test/expected_results/10_linux_web_8GB_8_1000_ssd.txt +++ b/test/expected_results/10_linux_web_8GB_8_1000_ssd.txt @@ -16,6 +16,7 @@ default_statistics_target = 100 random_page_cost = 1.1 effective_io_concurrency = 200 work_mem = 524kB +huge_pages = off min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 diff --git a/test/expected_results/11_linux_web_8GB_8_1000_hdd.txt b/test/expected_results/11_linux_web_8GB_8_1000_hdd.txt index a5d68a1..5b9f9c2 100644 --- a/test/expected_results/11_linux_web_8GB_8_1000_hdd.txt +++ b/test/expected_results/11_linux_web_8GB_8_1000_hdd.txt @@ -16,6 +16,7 @@ default_statistics_target = 100 random_page_cost = 4 effective_io_concurrency = 2 work_mem = 524kB +huge_pages = off min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 diff --git a/test/expected_results/11_linux_web_8GB_8_1000_san.txt b/test/expected_results/11_linux_web_8GB_8_1000_san.txt index 868e208..4414c0c 100644 --- a/test/expected_results/11_linux_web_8GB_8_1000_san.txt +++ b/test/expected_results/11_linux_web_8GB_8_1000_san.txt @@ -16,6 +16,7 @@ default_statistics_target = 100 random_page_cost = 1.1 effective_io_concurrency = 300 work_mem = 524kB +huge_pages = off min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 diff --git a/test/expected_results/11_linux_web_8GB_8_1000_ssd.txt b/test/expected_results/11_linux_web_8GB_8_1000_ssd.txt index 126d21f..8efb085 100644 --- a/test/expected_results/11_linux_web_8GB_8_1000_ssd.txt +++ b/test/expected_results/11_linux_web_8GB_8_1000_ssd.txt @@ -16,6 +16,7 @@ default_statistics_target = 100 random_page_cost = 1.1 effective_io_concurrency = 200 work_mem = 524kB +huge_pages = off min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 diff --git a/test/expected_results/12_linux_web_8GB_8_1000_hdd.txt b/test/expected_results/12_linux_web_8GB_8_1000_hdd.txt index 02b497b..b848b21 100644 --- a/test/expected_results/12_linux_web_8GB_8_1000_hdd.txt +++ b/test/expected_results/12_linux_web_8GB_8_1000_hdd.txt @@ -16,6 +16,7 @@ default_statistics_target = 100 random_page_cost = 4 effective_io_concurrency = 2 work_mem = 524kB +huge_pages = off min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 diff --git a/test/expected_results/12_linux_web_8GB_8_1000_san.txt b/test/expected_results/12_linux_web_8GB_8_1000_san.txt index 867dfeb..16dc54f 100644 --- a/test/expected_results/12_linux_web_8GB_8_1000_san.txt +++ b/test/expected_results/12_linux_web_8GB_8_1000_san.txt @@ -16,6 +16,7 @@ default_statistics_target = 100 random_page_cost = 1.1 effective_io_concurrency = 300 work_mem = 524kB +huge_pages = off min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 diff --git a/test/expected_results/12_linux_web_8GB_8_1000_ssd.txt b/test/expected_results/12_linux_web_8GB_8_1000_ssd.txt index 995f9ca..8ec0508 100644 --- a/test/expected_results/12_linux_web_8GB_8_1000_ssd.txt +++ b/test/expected_results/12_linux_web_8GB_8_1000_ssd.txt @@ -16,6 +16,7 @@ default_statistics_target = 100 random_page_cost = 1.1 effective_io_concurrency = 200 work_mem = 524kB +huge_pages = off min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 diff --git a/test/expected_results/13_linux_web_8GB_8_1000_hdd.txt b/test/expected_results/13_linux_web_8GB_8_1000_hdd.txt index 468d3d4..0a4778e 100644 --- a/test/expected_results/13_linux_web_8GB_8_1000_hdd.txt +++ b/test/expected_results/13_linux_web_8GB_8_1000_hdd.txt @@ -16,6 +16,7 @@ default_statistics_target = 100 random_page_cost = 4 effective_io_concurrency = 2 work_mem = 524kB +huge_pages = off min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 diff --git a/test/expected_results/13_linux_web_8GB_8_1000_san.txt b/test/expected_results/13_linux_web_8GB_8_1000_san.txt index dfbf149..5f36610 100644 --- a/test/expected_results/13_linux_web_8GB_8_1000_san.txt +++ b/test/expected_results/13_linux_web_8GB_8_1000_san.txt @@ -16,6 +16,7 @@ default_statistics_target = 100 random_page_cost = 1.1 effective_io_concurrency = 300 work_mem = 524kB +huge_pages = off min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 diff --git a/test/expected_results/13_linux_web_8GB_8_1000_ssd.txt b/test/expected_results/13_linux_web_8GB_8_1000_ssd.txt index 68723bf..57a09f6 100644 --- a/test/expected_results/13_linux_web_8GB_8_1000_ssd.txt +++ b/test/expected_results/13_linux_web_8GB_8_1000_ssd.txt @@ -16,6 +16,7 @@ default_statistics_target = 100 random_page_cost = 1.1 effective_io_concurrency = 200 work_mem = 524kB +huge_pages = off min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 diff --git a/test/expected_results/14_linux_web_8GB_8_1000_hdd.txt b/test/expected_results/14_linux_web_8GB_8_1000_hdd.txt index cb1fca5..76710a8 100644 --- a/test/expected_results/14_linux_web_8GB_8_1000_hdd.txt +++ b/test/expected_results/14_linux_web_8GB_8_1000_hdd.txt @@ -16,6 +16,7 @@ default_statistics_target = 100 random_page_cost = 4 effective_io_concurrency = 2 work_mem = 524kB +huge_pages = off min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 diff --git a/test/expected_results/14_linux_web_8GB_8_1000_san.txt b/test/expected_results/14_linux_web_8GB_8_1000_san.txt index 9b7b4f4..70a3d41 100644 --- a/test/expected_results/14_linux_web_8GB_8_1000_san.txt +++ b/test/expected_results/14_linux_web_8GB_8_1000_san.txt @@ -16,6 +16,7 @@ default_statistics_target = 100 random_page_cost = 1.1 effective_io_concurrency = 300 work_mem = 524kB +huge_pages = off min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 diff --git a/test/expected_results/14_linux_web_8GB_8_1000_ssd.txt b/test/expected_results/14_linux_web_8GB_8_1000_ssd.txt index 428e03d..a2ed946 100644 --- a/test/expected_results/14_linux_web_8GB_8_1000_ssd.txt +++ b/test/expected_results/14_linux_web_8GB_8_1000_ssd.txt @@ -16,6 +16,7 @@ default_statistics_target = 100 random_page_cost = 1.1 effective_io_concurrency = 200 work_mem = 524kB +huge_pages = off min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 diff --git a/test/expected_results/15_linux_web_8GB_8_1000_hdd.txt b/test/expected_results/15_linux_web_8GB_8_1000_hdd.txt index 10edf08..d9b31ab 100644 --- a/test/expected_results/15_linux_web_8GB_8_1000_hdd.txt +++ b/test/expected_results/15_linux_web_8GB_8_1000_hdd.txt @@ -16,6 +16,7 @@ default_statistics_target = 100 random_page_cost = 4 effective_io_concurrency = 2 work_mem = 524kB +huge_pages = off min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 diff --git a/test/expected_results/15_linux_web_8GB_8_1000_san.txt b/test/expected_results/15_linux_web_8GB_8_1000_san.txt index 04c3ce6..ec86040 100644 --- a/test/expected_results/15_linux_web_8GB_8_1000_san.txt +++ b/test/expected_results/15_linux_web_8GB_8_1000_san.txt @@ -16,6 +16,7 @@ default_statistics_target = 100 random_page_cost = 1.1 effective_io_concurrency = 300 work_mem = 524kB +huge_pages = off min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 diff --git a/test/expected_results/15_linux_web_8GB_8_1000_ssd.txt b/test/expected_results/15_linux_web_8GB_8_1000_ssd.txt index 00df6c7..ed2ae23 100644 --- a/test/expected_results/15_linux_web_8GB_8_1000_ssd.txt +++ b/test/expected_results/15_linux_web_8GB_8_1000_ssd.txt @@ -16,6 +16,7 @@ default_statistics_target = 100 random_page_cost = 1.1 effective_io_concurrency = 200 work_mem = 524kB +huge_pages = off min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 diff --git a/test/expected_results/9.5_linux_web_8GB_8_1000_hdd.txt b/test/expected_results/9.5_linux_web_8GB_8_1000_hdd.txt index 19e1a4c..8011a5e 100644 --- a/test/expected_results/9.5_linux_web_8GB_8_1000_hdd.txt +++ b/test/expected_results/9.5_linux_web_8GB_8_1000_hdd.txt @@ -16,6 +16,7 @@ default_statistics_target = 100 random_page_cost = 4 effective_io_concurrency = 2 work_mem = 2097kB +huge_pages = off min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 diff --git a/test/expected_results/9.5_linux_web_8GB_8_1000_san.txt b/test/expected_results/9.5_linux_web_8GB_8_1000_san.txt index e068bfa..b2d8304 100644 --- a/test/expected_results/9.5_linux_web_8GB_8_1000_san.txt +++ b/test/expected_results/9.5_linux_web_8GB_8_1000_san.txt @@ -16,6 +16,7 @@ default_statistics_target = 100 random_page_cost = 1.1 effective_io_concurrency = 300 work_mem = 2097kB +huge_pages = off min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 diff --git a/test/expected_results/9.5_linux_web_8GB_8_1000_ssd.txt b/test/expected_results/9.5_linux_web_8GB_8_1000_ssd.txt index bad61ba..fd32fe5 100644 --- a/test/expected_results/9.5_linux_web_8GB_8_1000_ssd.txt +++ b/test/expected_results/9.5_linux_web_8GB_8_1000_ssd.txt @@ -16,6 +16,7 @@ default_statistics_target = 100 random_page_cost = 1.1 effective_io_concurrency = 200 work_mem = 2097kB +huge_pages = off min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 diff --git a/test/expected_results/9.6_linux_web_8GB_8_1000_hdd.txt b/test/expected_results/9.6_linux_web_8GB_8_1000_hdd.txt index 17db648..a4c1584 100644 --- a/test/expected_results/9.6_linux_web_8GB_8_1000_hdd.txt +++ b/test/expected_results/9.6_linux_web_8GB_8_1000_hdd.txt @@ -16,6 +16,7 @@ default_statistics_target = 100 random_page_cost = 4 effective_io_concurrency = 2 work_mem = 524kB +huge_pages = off min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 diff --git a/test/expected_results/9.6_linux_web_8GB_8_1000_san.txt b/test/expected_results/9.6_linux_web_8GB_8_1000_san.txt index 2a07382..783c8d1 100644 --- a/test/expected_results/9.6_linux_web_8GB_8_1000_san.txt +++ b/test/expected_results/9.6_linux_web_8GB_8_1000_san.txt @@ -16,6 +16,7 @@ default_statistics_target = 100 random_page_cost = 1.1 effective_io_concurrency = 300 work_mem = 524kB +huge_pages = off min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 diff --git a/test/expected_results/9.6_linux_web_8GB_8_1000_ssd.txt b/test/expected_results/9.6_linux_web_8GB_8_1000_ssd.txt index e790d78..5c88c09 100644 --- a/test/expected_results/9.6_linux_web_8GB_8_1000_ssd.txt +++ b/test/expected_results/9.6_linux_web_8GB_8_1000_ssd.txt @@ -16,6 +16,7 @@ default_statistics_target = 100 random_page_cost = 1.1 effective_io_concurrency = 200 work_mem = 524kB +huge_pages = off min_wal_size = 1GB max_wal_size = 4GB max_worker_processes = 8 diff --git a/test/scripts/test_pgtune.sh b/test/scripts/test_pgtune.sh index 5bdf320..a9edb47 100644 --- a/test/scripts/test_pgtune.sh +++ b/test/scripts/test_pgtune.sh @@ -19,23 +19,23 @@ do db_type="web" echo "TESTING WITH THE FOLLOWING PARAMETERS" echo "=====================================" - echo "= pg_version: "$pg_version - echo "= db_type: "$db_type - echo "= total_mem: "$total_mem - echo "= cpu_count: "$cpu_count - echo "= max_conn: "$max_conn - echo "= stge_type: "$stge_type + echo "= pg_version: $pg_version" + echo "= db_type: $db_type" + echo "= total_mem: $total_mem" + echo "= cpu_count: $cpu_count" + echo "= max_conn: $max_conn" + echo "= stge_type: $stge_type" echo "=====================================" - output_file=$pg_version$db_type$total_mem$cpu_count$max_conn$stge_type".txt" - bash $pgtuned_script -v $pg_version -t $db_type -m $total_mem -u $cpu_count -c $max_conn -s $stge_type > $output_file - test_file=$pg_version"_linux_"$db_type"_"$total_mem"_"$cpu_count"_"$max_conn"_"$stge_type".txt" + output_file="$pg_version$db_type$total_mem$cpu_count$max_conn$stge_type.txt" + bash "$pgtuned_script" -v "$pg_version" -t "$db_type" -m "$total_mem" -u "$cpu_count" -c "$max_conn" -s "$stge_type" > "$output_file" + test_file="$pg_version"_linux_"$db_type"_"$total_mem"_"$cpu_count"_"$max_conn"_"$stge_type".txt if [ ! -f "$test_files_dir$test_file" ] then echo "Test result : error" echo "REASON : $test_file does not exist" exit 2 fi - if [ "$(cmp $test_files_dir$test_file $output_file)" ] + if [ "$(cmp "$test_files_dir$test_file" "$output_file")" ] then echo "Test result : error" echo "REASON : generated file does not match existing file. Inspect $output_file." @@ -44,6 +44,6 @@ do echo "Test result : passed" echo fi - rm $output_file + rm "$output_file" done done