From 1354cdf8d61c738f22523f8470e835b07dbec2de Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Sun, 20 Dec 2020 14:20:08 +0700 Subject: [PATCH] Reduce dbcache post IBD (#345) --- docker-compose.yml | 4 +++- scripts/configure | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 13befb0..b652374 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -155,12 +155,13 @@ services: ipv4_address: $MIDDLEWARE_IP neutrino-switcher: container_name: neutrino-switcher - image: getumbrel/neutrino-switcher:v1.0.3 + image: getumbrel/neutrino-switcher:v1.1.1 logging: *default-logging depends_on: [ bitcoin, lnd ] restart: on-failure volumes: - ${PWD}/lnd:/lnd + - ${PWD}/bitcoin:/bitcoin - ${PWD}/statuses:/statuses - /var/run/docker.sock:/var/run/docker.sock environment: @@ -168,6 +169,7 @@ services: RPCUSER: $BITCOIN_RPC_USER RPCPASS: $BITCOIN_RPC_PASS LND_CONTAINER_NAME: lnd + BITCOIN_CONTAINER_NAME: bitcoin SLEEPTIME: 3600 networks: default: diff --git a/scripts/configure b/scripts/configure index c8c72c7..9764e1d 100755 --- a/scripts/configure +++ b/scripts/configure @@ -258,7 +258,13 @@ echo echo "Setting dbcache size" echo -DBCACHE_SIZE=$(awk '/MemTotal/{printf "%d\n", ($2/2^10 * 0.5) - 300}' /proc/meminfo) +if [[ -f "${STATUS_DIR}/node-status-bitcoind-ready" ]]; then + # Limit dbcache to 200 after IBD + DBCACHE_SIZE="200" +else + # Allocate (50% of RAM) - 300MB to dbcache for IDB + DBCACHE_SIZE=$(awk '/MemTotal/{printf "%d\n", ($2/2^10 * 0.5) - 300}' /proc/meminfo) +fi sed -i -e "s/dbcache=/dbcache=$DBCACHE_SIZE/g" "$BITCOIN_CONF_FILE" # TODO: Adjust prune size based on available disk space