|
|
@ -1056,18 +1056,20 @@ bool AppInit2(boost::thread_group& threadGroup) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// cache size calculations
|
|
|
|
// cache size calculations
|
|
|
|
size_t nTotalCache = (GetArg("-dbcache", nDefaultDbCache) << 20); |
|
|
|
int64_t nTotalCache = (GetArg("-dbcache", nDefaultDbCache) << 20); |
|
|
|
if (nTotalCache < (nMinDbCache << 20)) |
|
|
|
nTotalCache = std::max(nTotalCache, nMinDbCache << 20); // total cache cannot be less than nMinDbCache
|
|
|
|
nTotalCache = (nMinDbCache << 20); // total cache cannot be less than nMinDbCache
|
|
|
|
nTotalCache = std::min(nTotalCache, nMaxDbCache << 20); // total cache cannot be greated than nMaxDbcache
|
|
|
|
else if (nTotalCache > (nMaxDbCache << 20)) |
|
|
|
int64_t nBlockTreeDBCache = nTotalCache / 8; |
|
|
|
nTotalCache = (nMaxDbCache << 20); // total cache cannot be greater than nMaxDbCache
|
|
|
|
|
|
|
|
size_t nBlockTreeDBCache = nTotalCache / 8; |
|
|
|
|
|
|
|
if (nBlockTreeDBCache > (1 << 21) && !GetBoolArg("-txindex", false)) |
|
|
|
if (nBlockTreeDBCache > (1 << 21) && !GetBoolArg("-txindex", false)) |
|
|
|
nBlockTreeDBCache = (1 << 21); // block tree db cache shouldn't be larger than 2 MiB
|
|
|
|
nBlockTreeDBCache = (1 << 21); // block tree db cache shouldn't be larger than 2 MiB
|
|
|
|
nTotalCache -= nBlockTreeDBCache; |
|
|
|
nTotalCache -= nBlockTreeDBCache; |
|
|
|
size_t nCoinDBCache = nTotalCache / 2; // use half of the remaining cache for coindb cache
|
|
|
|
int64_t nCoinDBCache = std::min(nTotalCache / 2, (nTotalCache / 4) + (1 << 23)); // use 25%-50% of the remainder for disk cache
|
|
|
|
nTotalCache -= nCoinDBCache; |
|
|
|
nTotalCache -= nCoinDBCache; |
|
|
|
nCoinCacheUsage = nTotalCache; |
|
|
|
nCoinCacheUsage = nTotalCache; // the rest goes to in-memory cache
|
|
|
|
|
|
|
|
LogPrintf("Cache configuration:\n"); |
|
|
|
|
|
|
|
LogPrintf("* Using %.1fMiB for block index database\n", nBlockTreeDBCache * (1.0 / 1024 / 1024)); |
|
|
|
|
|
|
|
LogPrintf("* Using %.1fMiB for chain state database\n", nCoinDBCache * (1.0 / 1024 / 1024)); |
|
|
|
|
|
|
|
LogPrintf("* Using %.1fMiB for in-memory UTXO set\n", nCoinCacheUsage * (1.0 / 1024 / 1024)); |
|
|
|
|
|
|
|
|
|
|
|
bool fLoaded = false; |
|
|
|
bool fLoaded = false; |
|
|
|
while (!fLoaded) { |
|
|
|
while (!fLoaded) { |
|
|
|