From 4a754a1bc8860242480203ed861a24171ab0f3a0 Mon Sep 17 00:00:00 2001 From: Victor Da Costa <vdacosta@voidtek.com> Date: Fri, 2 Feb 2024 09:40:08 +0000 Subject: [PATCH] FPFISINFRA-0000: Dynamise mydumper/myloader --- scripts/mydumper.sh | 3 ++- scripts/myloader.sh | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/mydumper.sh b/scripts/mydumper.sh index 5abc0cb..d0054b9 100755 --- a/scripts/mydumper.sh +++ b/scripts/mydumper.sh @@ -5,7 +5,8 @@ set -e #### VARIABLES #### TIMESTAMP=$(date +%s%N) CONFILE=/tmp/$(openssl rand -hex 12) -DUMPOPTS="--threads 8 --exit-if-broken-table-found --defaults-extra-file=${CONFILE} --disk-limits '500:800' --skip-definer --compress ZSTD --trx-consistency-only --lock-all-tables --verbose 2 --outputdir ${1}${TIMESTAMP}" +NUMTHREADS=$(($(nproc)+1)) +DUMPOPTS="--threads ${NUMTHREADS} --exit-if-broken-table-found --defaults-extra-file=${CONFILE} --disk-limits '500:800' --skip-definer --compress ZSTD --trx-consistency-only --lock-all-tables --verbose 2 --outputdir ${1}${TIMESTAMP}" #### MAIN #### check_dump "${1}" diff --git a/scripts/myloader.sh b/scripts/myloader.sh index aa56550..cb2189c 100755 --- a/scripts/myloader.sh +++ b/scripts/myloader.sh @@ -5,7 +5,10 @@ set -e #### VARIABLES #### TIMESTAMP=$(date +%s%N) CONFILE=/tmp/$(openssl rand -hex 12) -LOADOPTS="--threads 8 --max-threads-per-table 1 --max-threads-for-index-creation 4 --innodb-optimize-keys AFTER_IMPORT_PER_TABLE --purge-mode NONE --defaults-extra-file=${CONFILE} --skip-definer --verbose=2 --directory ${1}${TIMESTAMP}" +NUMTHREADS=$(($(nproc)+1)) +NUMTHREADSCREATION=$((NUMTHREADS/2)) +NUMTHREADSTABLE=1 +LOADOPTS="--threads ${NUMTHREADS} --max-threads-per-table ${NUMTHREADSTABLE} --max-threads-for-index-creation ${NUMTHREADSCREATION} --innodb-optimize-keys AFTER_IMPORT_PER_TABLE --purge-mode NONE --defaults-extra-file=${CONFILE} --skip-definer --verbose=2 --directory ${1}${TIMESTAMP}" #### MAIN #### check_dump "${1}" -- GitLab