mirror of https://github.com/samply/bridgehead.git
refactor: tune configuration of blaze according to system memory
This commit is contained in:
parent
eeb17e7bfe
commit
e1e523f1ac
|
@ -50,7 +50,7 @@ loadVars() {
|
|||
source /etc/bridgehead/$PROJECT.local.conf || fail_and_report 1 "Found /etc/bridgehead/$PROJECT.local.conf but failed to import"
|
||||
fi
|
||||
fetchVarsFromVaultByFile /etc/bridgehead/$PROJECT.conf || fail_and_report 1 "Unable to fetchVarsFromVaultByFile"
|
||||
setBlazeMemoryCap
|
||||
optimizeBlazeMemoryUsage
|
||||
[ -e ./$PROJECT/vars ] && source ./$PROJECT/vars
|
||||
set +a
|
||||
|
||||
|
|
|
@ -155,13 +155,26 @@ setHostname() {
|
|||
fi
|
||||
}
|
||||
|
||||
# blaze memory cap should be approximately a quarter of the system memory
|
||||
# the memory cap will be applied to both the java heap size and db clock cache
|
||||
setBlazeMemoryCap() {
|
||||
# This function optimizes the usage of memory through blaze, according to the official performance tuning guide:
|
||||
# https://github.com/samply/blaze/blob/master/docs/tuning-guide.md
|
||||
# Short summary of the adjustments made:
|
||||
# - set blaze memory cap to a quarter of the system memory
|
||||
# - set db block cache size to a quarter of the system memory
|
||||
# - limit resource count allowed in blaze to 1,25M per 4GB available system memory
|
||||
optimizeBlazeMemoryUsage() {
|
||||
if [ -z "$BLAZE_MEMORY_CAP" ]; then
|
||||
system_memory_in_mb=$(free -m | grep 'Mem:' | awk '{print $2}');
|
||||
export BLAZE_MEMORY_CAP=$(("$system_memory_in_mb"/4));
|
||||
fi
|
||||
if [ -z "$BLAZE_RESOURCE_CACHE_CAP" ]; then
|
||||
available_system_memory_chuncks=$((BLAZE_MEMORY_CAP / 1000))
|
||||
if [ $available_system_memory_chuncks -eq 0 ]; then
|
||||
log WARN "Only ${BLAZE_MEMORY_CAP} system memory available for Blaze. If your Blaze stores more than 128000 fhir ressources it will run significally slower."
|
||||
export BLAZE_RESOURCE_CACHE_CAP=128000;
|
||||
else
|
||||
export BLAZE_RESOURCE_CACHE_CAP=$((available_system_memory_chuncks * 312500))
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Takes 1) The Backup Directory Path 2) The name of the Service to be backuped
|
||||
|
|
Loading…
Reference in New Issue