mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-09 07:08:25 +02:00
Merge bitcoin/bitcoin#34692: Bump dbcache to 1 GiB
4ae9a10adadoc: add release notes for dbcache bump (Andrew Toth)c510d126efdoc: update dbcache default in reduce-memory.md (Andrew Toth)027cac8527qt: show GetDefaultDBCache() in settings (Andrew Toth)5b34f25184dbcache: bump default from 450MB -> 1024MB if enough memory (Andrew Toth) Pull request description: Alternative to #34641 This increases the default `dbcache` value from `450MiB` to `1024MiB` if: - `dbcache` is unset - The system is 64 bit - At least 4GiB of RAM is detected Otherwise fallback to previous `450MiB` default. This should be simple enough to get into v31. The bump to 1GiB shows significant performance increases in #34641. It also alleviates concerns of too high default for steady state, and of lowering the current dbcache for systems with less RAM. This change only changes bitcoind behavior, while kernel still defaults to 450 MiB. ACKs for top commit: ajtowns: ACK4ae9a10adakevkevinpal: reACK [4ae9a10](4ae9a10ada) svanstaa: ACK [4ae9a10](4ae9a10ada) achow101: ACK4ae9a10adasipa: ACK4ae9a10adaTree-SHA512: ee3acf1fb08523ac80e37ec8f0caca226ffde6667f3a75ae6f4f4f54bc905a883ebcf1bf0e8a8a15c7cfabff96c23225825b3fff4506b9ab9936bf2c0a2c2513
This commit is contained in:
@@ -27,8 +27,22 @@ static constexpr size_t MAX_FILTER_INDEX_CACHE{1024_MiB};
|
||||
static constexpr size_t MAX_TXOSPENDER_INDEX_CACHE{1024_MiB};
|
||||
//! Maximum dbcache size on 32-bit systems.
|
||||
static constexpr size_t MAX_32BIT_DBCACHE{1024_MiB};
|
||||
//! Larger default dbcache on 64-bit systems with enough RAM.
|
||||
static constexpr size_t HIGH_DEFAULT_DBCACHE{1024_MiB};
|
||||
//! Minimum detected RAM required for HIGH_DEFAULT_DBCACHE.
|
||||
static constexpr uint64_t HIGH_DEFAULT_DBCACHE_MIN_TOTAL_RAM{4096ULL << 20};
|
||||
|
||||
namespace node {
|
||||
size_t GetDefaultDBCache()
|
||||
{
|
||||
if constexpr (sizeof(void*) >= 8) {
|
||||
if (GetTotalRAM().value_or(0) >= HIGH_DEFAULT_DBCACHE_MIN_TOTAL_RAM) {
|
||||
return HIGH_DEFAULT_DBCACHE;
|
||||
}
|
||||
}
|
||||
return DEFAULT_DB_CACHE;
|
||||
}
|
||||
|
||||
size_t CalculateDbCacheBytes(const ArgsManager& args)
|
||||
{
|
||||
if (auto db_cache{args.GetIntArg("-dbcache")}) {
|
||||
@@ -37,7 +51,7 @@ size_t CalculateDbCacheBytes(const ArgsManager& args)
|
||||
constexpr auto max_db_cache{sizeof(void*) == 4 ? MAX_32BIT_DBCACHE : std::numeric_limits<size_t>::max()};
|
||||
return std::max<size_t>(MIN_DB_CACHE, std::min<uint64_t>(db_cache_bytes, max_db_cache));
|
||||
}
|
||||
return DEFAULT_DB_CACHE;
|
||||
return GetDefaultDBCache();
|
||||
}
|
||||
|
||||
CacheSizes CalculateCacheSizes(const ArgsManager& args, size_t n_indexes)
|
||||
|
||||
@@ -18,6 +18,7 @@ static constexpr size_t MIN_DB_CACHE{4_MiB};
|
||||
static constexpr size_t DEFAULT_DB_CACHE{DEFAULT_KERNEL_CACHE};
|
||||
|
||||
namespace node {
|
||||
size_t GetDefaultDBCache();
|
||||
struct IndexCacheSizes {
|
||||
size_t tx_index{0};
|
||||
size_t filter_index{0};
|
||||
|
||||
Reference in New Issue
Block a user