Browse Source

Give more dbcache RAM during IBD #709

v1.3
Christian Rotzoll 5 years ago
parent
commit
2d569da849
  1. 18
      home.admin/50syncHDD.sh
  2. 38
      home.admin/_background.sh
  3. 2
      home.admin/_bootstrap.provision.sh
  4. 4
      home.admin/assets/bitcoin.conf

18
home.admin/50syncHDD.sh

@ -56,6 +56,24 @@ if [ "$network" = "bitcoin" ]; then
fi
echo "*** Optimizing RAM for Sync ***"
kbSizeRAM=$(cat /proc/meminfo | grep "MemTotal" | sed 's/[^0-9]*//g')
echo "dont forget to reduce dbcache once IBD is done" > "/home/admin/selfsync.flag"
# RP4 4GB
if [ ${kbSizeRAM} -gt 3500000 ]; then
echo "Detected RAM >=4GB --> optimizing ${network}.conf"
sudo sed -i "s/^dbcache=.*/dbcache=3072/g" /mnt/hdd/${network}/${network}.conf
# RP4 2GB
elif [ ${kbSizeRAM} -gt 1500000 ]; then
echo "Detected RAM >=2GB --> optimizing ${network}.conf"
sudo sed -i "s/^dbcache=.*/dbcache=1536/g" /mnt/hdd/${network}/${network}.conf
# RP3/4 1GB
else
echo "Detected RAM <=1GB --> optimizing ${network}.conf"
sudo sed -i "s/^dbcache=.*/dbcache=768/g" /mnt/hdd/${network}/${network}.conf
fi
echo "*** Activating Blockain Sync ***"
sudo mkdir /mnt/hdd/${network} 2>/dev/null

38
home.admin/_background.sh

@ -261,6 +261,44 @@ do
fi
fi
####################################################
# CHECK FOR END OF IBD (self validation)
####################################################
# check every 60secs
recheckIBD=$((($counter % 60)+1))
if [ ${recheckIBD} -eq 1 ]; then
# check if flag exists (got created on 50syncHDD.sh)
flagExists=$(ls /home/admin/selfsync.flag 2>/dev/null | grep -c "selfsync.flag")
if [ ${flagExists} -eq 1 ]; then
finishedIBD=$(bitcoin-cli getblockchaininfo | grep "initialblockdownload" | grep -c "false")
if [ ${finishedIBD} -eq 1 ]; then
echo "CHECK FOR END OF IBD --> reduce RAM and restart bitcoind"
# remove flag
rm /home/admin/selfsync.flag
# stop bitcoind
sudo systemctl stop bitcoind
# set dbcache back to normal (to give room for other apps)
kbSizeRAM=$(cat /proc/meminfo | grep "MemTotal" | sed 's/[^0-9]*//g')
if [ ${kbSizeRAM} -gt 1500000 ]; then
echo "Detected RAM >1GB --> optimizing ${network}.conf"
sudo sed -i "s/^dbcache=.*/dbcache=1024/g" /mnt/hdd/${network}/${network}.conf
else
echo "Detected RAM 1GB --> optimizing ${network}.conf"
sudo sed -i "s/^dbcache=.*/dbcache=128/g" /mnt/hdd/${network}/${network}.conf
fi
# restart bitcoind
sudo systemctl start bitcoind
fi
fi
fi
###############################
# Prepare next loop
###############################

2
home.admin/_bootstrap.provision.sh

@ -62,7 +62,7 @@ kbSizeRAM=$(cat /proc/meminfo | grep "MemTotal" | sed 's/[^0-9]*//g')
if [ ${kbSizeRAM} -gt 1500000 ]; then
echo "Detected RAM >1GB --> optimizing ${network}.conf"
sudo sed -i "s/^dbcache=.*/dbcache=1024/g" /mnt/hdd/${network}/${network}.conf
sudo sed -i "s/^maxmempool=.*/maxmempool=300/g" /mnt/hdd/${network}/${network}.conf
sudo sed -i "s/^maxmempool=.*/maxmempool=256/g" /mnt/hdd/${network}/${network}.conf
fi
# link and copy HDD content into new OS

4
home.admin/assets/bitcoin.conf

@ -19,9 +19,9 @@ zmqpubrawblock=tcp://127.0.0.1:28332
zmqpubrawtx=tcp://127.0.0.1:28333
# Raspberry Pi optimizations
dbcache=100
dbcache=128
maxorphantx=10
maxmempool=50
maxmempool=64
maxconnections=40
maxuploadtarget=5000

Loading…
Cancel
Save