mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2024-11-20 02:09:15 +01:00
Give more dbcache RAM during IBD #709
This commit is contained in:
parent
12270c4c69
commit
2d569da849
@ -56,6 +56,24 @@ if [ "$network" = "bitcoin" ]; then
|
|||||||
|
|
||||||
fi
|
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 ***"
|
echo "*** Activating Blockain Sync ***"
|
||||||
|
|
||||||
sudo mkdir /mnt/hdd/${network} 2>/dev/null
|
sudo mkdir /mnt/hdd/${network} 2>/dev/null
|
||||||
|
@ -261,6 +261,44 @@ do
|
|||||||
fi
|
fi
|
||||||
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
|
# Prepare next loop
|
||||||
###############################
|
###############################
|
||||||
|
@ -62,7 +62,7 @@ kbSizeRAM=$(cat /proc/meminfo | grep "MemTotal" | sed 's/[^0-9]*//g')
|
|||||||
if [ ${kbSizeRAM} -gt 1500000 ]; then
|
if [ ${kbSizeRAM} -gt 1500000 ]; then
|
||||||
echo "Detected RAM >1GB --> optimizing ${network}.conf"
|
echo "Detected RAM >1GB --> optimizing ${network}.conf"
|
||||||
sudo sed -i "s/^dbcache=.*/dbcache=1024/g" /mnt/hdd/${network}/${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
|
fi
|
||||||
|
|
||||||
# link and copy HDD content into new OS
|
# link and copy HDD content into new OS
|
||||||
|
@ -19,9 +19,9 @@ zmqpubrawblock=tcp://127.0.0.1:28332
|
|||||||
zmqpubrawtx=tcp://127.0.0.1:28333
|
zmqpubrawtx=tcp://127.0.0.1:28333
|
||||||
|
|
||||||
# Raspberry Pi optimizations
|
# Raspberry Pi optimizations
|
||||||
dbcache=100
|
dbcache=128
|
||||||
maxorphantx=10
|
maxorphantx=10
|
||||||
maxmempool=50
|
maxmempool=64
|
||||||
maxconnections=40
|
maxconnections=40
|
||||||
maxuploadtarget=5000
|
maxuploadtarget=5000
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user