Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop -dbcache limit #28358

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Sjors
Copy link
Member

@Sjors Sjors commented Aug 28, 2023

Due to recent UTXO set growth, the current maximum value for -dbcache of 16GB is just months away from being insufficient (for those who wish to complete IBD with the UTXO set held in RAM).

This drops the limit. It also adds a warning that it's up to users to check that they have enough RAM.

Fixes #28249.


A previous version of this PR increased the maximum to 64GB. It also made startup abort if the value provided is too high, rather than quietly round it down. But this didn't get much support.

@DrahtBot
Copy link
Contributor

DrahtBot commented Aug 28, 2023

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage

For detailed information about the code coverage, see the test coverage report.

Reviews

See the guideline for information on the review process.

Type Reviewers
Concept ACK kristapsk, TheCharlatan, henrikhk, 0xB10C, darosior, jonatack, tdb3, BenWestgate, sdaftuar
Stale ACK cbergqvist

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #30059 (Add option dbfilesize to control LevelDB target ("max") file size by luke-jr)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@Sjors Sjors marked this pull request as ready for review August 28, 2023 15:57
@Sjors Sjors force-pushed the 2023/08/double-your-coins---cache branch from 4e27771 to f311e45 Compare August 28, 2023 16:05
@maflcko
Copy link
Member

maflcko commented Aug 28, 2023

insufficient

Can you explain this? Why is there a requirement that the whole utxo set must fit in the cache? This can easily lead to OOM, as you explain, in which case the user would have to start from zero, because potentially nothing has been persisted at all. Also, for slow storage it could lead to hangs, which could lead the user (or OS) to kill the process, causing the same issues. Finally, with assumeutxo, I wonder why there is any need to chase this? No objection to this pull, but I wonder if this really makes users happier on average, or will just lead to more hangs, crashes and -reindex.

Node
------

- The maximum value for `-dbcache` has been increased to 32,000 MiB due to recent UTXO set growth. Be sure to check that you have enough RAM before increasing this.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of implying that users should check their RAM and then increase this, it would be more helpful to explain why a user should change the setting in the first place, what they can expect, and what the tradeoffs are, but this seems better put in a separate document or the -help.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was not the intended implication. If they feel like increasing it, they should check their RAM first.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is just that this is the only thing you mention in the release notes. In any case, I don't think the release notes are the right place for extended documentation. Either put it in the -help or a separate md.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dropped the "check RAM" sentence.

@jamesob
Copy link
Member

jamesob commented Aug 28, 2023

This can easily lead to OOM

Wonder if it's worth warning/failing if the dbcache param exceeds available memory.

@Sjors
Copy link
Member Author

Sjors commented Aug 28, 2023

My recollection is that an IBD without a single flush is faster, but have not benched this in recent years.

We can always recommend a lower setting if that turns out to be better. By not increasing it to infinity at least we constrain the worst case here, e.g. if it turns out the failures you mean get exponentially worse as the UTXO set keeps growing. While at the same time not removing the existing ability to sync in one go.

@Sjors
Copy link
Member Author

Sjors commented Aug 28, 2023

if the dbcache param exceeds available memory.

My understanding was that we can't measure available RAM reliably.

@andrewtoth
Copy link
Contributor

andrewtoth commented Aug 28, 2023

My recollection is that an IBD without a single flush is faster, but have not benched this in recent years.

A single flush throughout the entire multi-hour IBD will not make a noticeable difference to a user. My initial version of #28280 had 3 extra pointers per cache entry, which caused the dbcache limit to be hit. It was still >2% faster than master which did not have a single flush.

@kristapsk
Copy link
Contributor

Concept ACK. This does not change defaults, just gives more options to power users. And UTXO set will grow in future. For some server environments 16 GB more or less will mean nothing.

@TheCharlatan
Copy link
Contributor

Concept ACK.

1 similar comment
@henrikhk
Copy link

Concept ACK.

@BenWestgate
Copy link
Contributor

Concept ACK.

Except for:

make startup abort if the value provided is too high, rather than quietly rounding it down.

This breaks scripts that set dbcache to a % of available RAM.

And is inconsistent with it rounding up silently rather than fail to start if the value is too low.

@0xB10C
Copy link
Contributor

0xB10C commented Aug 30, 2023

Concept ACK on increasing the maximum dbcache.

I had to manually bump the dbcache to run bitcoin-cli verifychain 4 0 last year (#24851 (comment)). This came close to using 32 GB and might not be enough anymore (or soon - I haven't checked again). Maybe worth considering going directly to 64 GB here to be able to actually use the verifychain 4 0 RPC?

@darosior
Copy link
Member

Concept ACK on giving more options.

@Sjors
Copy link
Member Author

Sjors commented Aug 30, 2023

This breaks scripts that set dbcache to a % of available RAM.

Do you know any example of people doing that?

In general I think we should fail to startup if the user provides an invalid configuration option, as this often leads to problems. I believe this has been gradually introduced for various other options too (see also #16545).

At the same time I don't want to needless break scripts out there.

From my own experience I was very surprised to find that this rounding down behavior happened, which is which I prefer an error. But we could also print a warning in the debug log.

Maybe worth considering going directly to 64 GB here to be able to actually use the verifychain 4 0 RPC?

@sipa any thoughts on a sane maximum?

@BenWestgate
Copy link
Contributor

This breaks scripts that set dbcache to a % of available RAM.

Do you know any example of people doing that?

My project Bails puts this in bitcoin-qt.desktop as well as .config/autostart/Bitcoin/bitcoin.desktop:
-dbcache=$(($(grep Available /proc/meminfo | sed s/[^0-9]//g)/1024-2000))

It's an alpha with about 20 users, makes a portable USB stick node that keeps Bitcoin Core up to date, none probably own a 64GB computer, but it will break if they do.

I found a couple other projects with the idea:
Start9Labs/bitcoind-startos#39
JWWeatherman/yeticold#145
epiccurious/bitcoin-core-node-builder#38

They'll waste time if they miss the change notes.
Maybe a one time warning would be better when the value rounds up or down? It took me a long time to notice that it did that.

Copy link
Contributor

@jonatack jonatack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK

In general I think we should fail to startup if the user provides an invalid configuration option, as this often leads to problems. I believe this has been gradually introduced for various other options too (see also #16545).

#27632 was another recent example of switching from a warning to raising an error. It's too easy for users, even experienced ones, not to notice a warning line in the log.

src/init.cpp Outdated
@@ -446,7 +446,7 @@ void SetupServerArgs(ArgsManager& argsman)
argsman.AddArg("-conf=<file>", strprintf("Specify path to read-only configuration file. Relative paths will be prefixed by datadir location (only useable from command line, not configuration file) (default: %s)", BITCOIN_CONF_FILENAME), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
argsman.AddArg("-datadir=<dir>", "Specify data directory", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
argsman.AddArg("-dbbatchsize", strprintf("Maximum database write batch size in bytes (default: %u)", nDefaultDbBatchSize), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::OPTIONS);
argsman.AddArg("-dbcache=<n>", strprintf("Maximum database cache size <n> MiB (%d to %d, default: %d). In addition, unused mempool memory is shared for this cache (see -maxmempool).", nMinDbCache, nMaxDbCache, nDefaultDbCache), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
argsman.AddArg("-dbcache=<n>", strprintf("Maximum database cache size <n> MiB (%d to %d, default: %d). Make sure you have enough RAM. In addition, unused mempool memory is shared for this cache (see -maxmempool).", nMinDbCache, nMaxDbCache, nDefaultDbCache), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
Copy link
Contributor

@jonatack jonatack Aug 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While touching this help, I think the following would be much clearer (particularly s/for/with).

Suggested change
argsman.AddArg("-dbcache=<n>", strprintf("Maximum database cache size <n> MiB (%d to %d, default: %d). Make sure you have enough RAM. In addition, unused mempool memory is shared for this cache (see -maxmempool).", nMinDbCache, nMaxDbCache, nDefaultDbCache), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
argsman.AddArg("-dbcache=<n>", strprintf("Maximum database cache size <n> MiB (%d to %d, default: %d). Make sure you have enough RAM. In addition, unused memory allocated to the mempool is shared with this cache (see -maxmempool).", nMinDbCache, nMaxDbCache, nDefaultDbCache), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taken

src/init.cpp Outdated
@@ -925,6 +925,10 @@ bool AppInitParameterInteraction(const ArgsManager& args)
return InitError(Untranslated("Cannot set -listen=0 together with -listenonion=1"));
}

if (args.GetIntArg("-dbcache", nDefaultDbCache) > nMaxDbCache) {
return InitError(Untranslated(strprintf("-dbcache must be at most %d MiB", nMaxDbCache)));
}
Copy link
Contributor

@jonatack jonatack Aug 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could add a test.

Edit: maybe -dbcache configuration option can be at most %d MiB, but %d was passed.

Copy link
Member Author

@Sjors Sjors Feb 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used the text, added a test.

Node
------

- The maximum value for `-dbcache` has been increased to 32,000 MiB due to recent UTXO set growth. Be sure to check that you have enough RAM before increasing this.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- The maximum value for `-dbcache` has been increased to 32,000 MiB due to recent UTXO set growth. Be sure to check that you have enough RAM before increasing this.
- The maximum allowed value for the `-dbcache` configuration option has been increased to 32,000 MiB due to recent UTXO set growth. Be sure to check that you have enough RAM before increasing this. (#28358)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might also add something like "Even with sufficient RAM the maximum setting may not be optimal."

Copy link
Contributor

@jonatack jonatack Aug 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes -- and why, or link to an improved In-memory caches section in doc/reduce-memory.md.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taken the suggested text diff.

@@ -0,0 +1,5 @@
Node
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe (I'm not sure this matters).

Suggested change
Node
Updated settings

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Release notes get edited later anyway, but I'll change once I retouch.

(waiting for more inputs in the discussion on warning/failure and the max size)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

@BenWestgate
Copy link
Contributor

BenWestgate commented Aug 30, 2023

Perhaps it should be set so high that you can't easily buy a Desktop with more RAM than the limit.

I could go to Microcenter today and walk out with a 64GB gaming tower, or a Xeon workstation with 128GB, likely a 64GB laptop as well.

Lots of guides on internet (foolishly) suggest setting it to half the total RAM.

src/init.cpp Outdated
@@ -925,6 +925,10 @@ bool AppInitParameterInteraction(const ArgsManager& args)
return InitError(Untranslated("Cannot set -listen=0 together with -listenonion=1"));
}

if (args.GetIntArg("-dbcache", nDefaultDbCache) > nMaxDbCache) {
return InitError(Untranslated(strprintf("-dbcache must be at most %d MiB", nMaxDbCache)));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that this will break software out there, why not simply keep the previous behavior and leave it as-is? What problem are you trying to solve?

Printing a warning and/or updating the docs should be more than enough.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That indeed seems like the best approach. Silently rounding down is annoying, but doesn't break anything, so a warning should be fine.

Copy link
Contributor

@jonatack jonatack Aug 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OTOH, it seems that raising would be a clearer user interface than rounding down silently as now, or with an added warning. See https://en.wikipedia.org/wiki/Principle_of_least_astonishment. I don't want to break anything, but the only software mentioned so far that this might marginally affect is that of @BenWestgate (thank you for reporting), who would be aware of the change.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm leaving this error as is for now, unless there are other examples of breaking software.

I would also rather drop nMaxDbCache entirely than quietly enforce it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See https://en.wikipedia.org/wiki/Principle_of_least_astonishment

If I imagined myself running into this error. I'd be indeed astonished and ask myself why the dbcache is capped at all. Again, if there is a reason for this change, it should be explained. It can't hurt to put the reason in the error string.

@luke-jr
Copy link
Member

luke-jr commented Sep 5, 2023

Why do we have an upper limit at all?

My understanding was that we can't measure available RAM reliably.

#19873 does exactly that

src/txdb.h Outdated
@@ -38,7 +38,7 @@ static const int64_t nDefaultDbCache = 450;
//! -dbbatchsize default (bytes)
static const int64_t nDefaultDbBatchSize = 16 << 20;
//! max. -dbcache (MiB)
static const int64_t nMaxDbCache = sizeof(void*) > 4 ? 16384 : 1024;
static const int64_t nMaxDbCache = sizeof(void*) > 4 ? 32768 : 1024;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might as well make it constexpr while you're touching it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@Sjors
Copy link
Member Author

Sjors commented Feb 13, 2024

Rebased, incorporated most of the text feedback above. Dropped the RAM warning from the release note, since that's already in the help text.

Why do we have an upper limit at all?

@sipa seemed worried about users going overboard with this setting: #28249 (comment)

@DrahtBot DrahtBot requested review from tdb3 and removed request for tdb3 March 5, 2024 08:44
@Sjors Sjors changed the title Double -dbache maximum to 64GB Quadruple -dbache maximum to 64GB Mar 11, 2024
@maflcko
Copy link
Member

maflcko commented Mar 12, 2024

@maflcko do you prefer to drop the limit? We should not quietly change a user setting, so imo an invalid value should explicitly fail, rather than silently fail.

Why would the value be "invalid"?

@Sjors
Copy link
Member Author

Sjors commented Mar 12, 2024

If there is a limit, a value above the limit is invalid. That is the entire point of a limit. Which is why I asked if you prefer to drop the limit.

@maflcko
Copy link
Member

maflcko commented Mar 12, 2024

I don't know if it is safe to drop the limit. For example, one could run into a signed integer overflow for some values. If that is the reason for the limit, you should add a comment for it.

However, if there is no reason for the limit, I don't see why a limit should exist.

@Sjors Sjors force-pushed the 2023/08/double-your-coins---cache branch from 39a3d48 to 5f31349 Compare March 12, 2024 10:50
@Sjors
Copy link
Member Author

Sjors commented Mar 12, 2024

It seems there's more enthusiasm for dropping this limit entirely, so I did that. This also impacts the GUI (but none of the translated strings), cc @hebasto.

For future reference, c016405 + 39a3d48 is the last version of this PR which does have a limit.

@Sjors Sjors changed the title Quadruple -dbache maximum to 64GB Drop -dbache limit Mar 12, 2024
@@ -94,8 +94,7 @@ OptionsDialog::OptionsDialog(QWidget* parent, bool enableWallet)
ui->setupUi(this);

/* Main elements init */
ui->databaseCache->setMinimum(nMinDbCache);
ui->databaseCache->setMaximum(nMaxDbCache);
ui->databaseCache->setRange(nMinDbCache, std::numeric_limits<int>::max());
Copy link
Member Author

@Sjors Sjors Mar 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even on a 32 bit system the maximum would be 2 petabyte (2 billion MiB), so not a practical concern imo.

@Sjors Sjors changed the title Drop -dbache limit Drop -dbcache limit Mar 12, 2024
@sipa
Copy link
Member

sipa commented Mar 12, 2024

On 32-bit systems we shouldn't raise the cache size too close to 4 GiB or more, as it'll just result in memory allocation errors.

On 64-bit systems, the limit is much less necessary, but I'd still worry about wildly too large numbers, as they also affect leveldb cache sizes. Setting those (way) too large is probably counterproductive.

@Sjors
Copy link
Member Author

Sjors commented Mar 12, 2024

@sipa since 32 bit systems can't have more than 4 GiB of RAM, the "Make sure you have enough RAM" wording in the documentation should cover that. Though perhaps "Stay at least 1 GiB below your RAM size" may be safer, also because of swap behaviour (see e.g. #29603 (comment))

With something like #19873 we could warn the use if they pick a value too close to the limit (on both 32 and 64 bit systems).

wildly too large

We could suggest an optimum, but without further experimentation we don't know where that is.

Ideally we would measure performance in real time and flush when it starts degrading (unless the user really insists that we don't).

@cbergqvist
Copy link
Contributor

Built 5f31349 and ran bitcoin-qt because I was worried that setting a very high max value might cause issues with the QT UI control. It's not some kind of horizontal slider that goes crazy, but rather a textbox with up/down arrows. It ignores key inputs that would make the value go further than std::numeric_limits<int>::max(). So all good from that perspective.

bitcoin-qt_screenshot

@hebasto
Copy link
Member

hebasto commented Mar 18, 2024

This also impacts the GUI (but none of the translated strings), cc @hebasto.

5f31349: changes to the GUI code look good to me. It might worth considering adding the "Make sure you have enough RAM." warning to the GUI as well (as a follow-up).

@Sjors
Copy link
Member Author

Sjors commented Mar 18, 2024

"Make sure you have enough RAM." warning to the GUI as well (as a follow-up).

Will do if I need to retouch.

@andrewtoth
Copy link
Contributor

After #28233 keeping the entire utxo set in memory will also help connect new blocks as fast as possible, not just for IBD.

@Sjors Sjors force-pushed the 2023/08/double-your-coins---cache branch from 5f31349 to 2a71819 Compare May 14, 2024 06:53
@Sjors
Copy link
Member Author

Sjors commented May 14, 2024

Rebased to make it easier to test the interaction with (merged) #28233. However, any potential benefit goes away after the first restart. The only time -dbcache is filled beyond its previous 16GB limit is during IDB.

In order to benefit from having the full UTXO set in RAM after a restart, we'd have to proactively load the entire UTXO set into -dbcache if space permits. Or maybe fill half the available space with coins, picked randomly.

Added "Make sure you have enough RAM." warning to the GUI.

@andrewtoth
Copy link
Contributor

The only time -dbcache is filled beyond its previous 16GB limit is during IDB

I'm sure it will happen if you restart your node now and leave it running for long enough ;)

In order to benefit from having the full UTXO set in RAM after a restart, we'd have to proactively load the entire UTXO set into -dbcache if space permits.

I did make a crude attempt at that years ago #18941. Not sure it is worth it.

Copy link
Contributor

@BenWestgate BenWestgate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

crACK

------

- The maximum value for `-dbcache` has been increased to 32,000 MiB due to recent UTXO set growth. Be sure to check that you have enough RAM before increasing this.
- Setting `-dbcache` above the maximum causes the node to abort startup. Previously it would round the number down.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer it quietly round down to the maximum. Especially since it rounds up to the minimum.

I know a few scripts people use that set dbcache to a percentage of available memory that this part of the PR would break for 64GB RAM.

What problem is failing to start meant to solve?

Copy link
Member

@sdaftuar sdaftuar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK.

I don't see much of a philosophical difference between having no limit and having a limit of 16GB on systems where a user has less than 16GB actually available... If we're already requiring users to do something smart, we can keep doing that -- and if we are worried about someone using an inappropriate value we can try to solve that separately (maybe by testing that we can allocate that much at startup or something?).

doc/release-notes-25358.md Outdated Show resolved Hide resolved
@BenWestgate
Copy link
Contributor

BenWestgate commented May 23, 2024

If we are worried about someone using an inappropriate value we can try to solve that separately (maybe by testing that we can allocate that much at startup or something?).

The best would be never setting it greater than total RAM. -dbcache=<total RAM> is still higher than optimal as there will be applications in memory that won't be swapped to disk including Bitcoin. But measuring Available RAM or swap is precarious as it changes.

Since other reviewers mentioned only wildly excessive values are seriously detrimental with swap, capping to max RAM is sensible.

In order to benefit from having the full UTXO set in RAM after a restart, we'd have to proactively load the entire UTXO set into -dbcache if space permits. Or maybe fill half the available space with coins, picked randomly.

Some have used cat .bitcoin/chainstate/* > /dev/null to make a node that's far behind start syncing faster. Because of the disk io to read the chainstate folder, there's a trade off between initial speed and medium-term speed. A node mere hours behind shouldn't read the entire UTXO set into memory. But one that's weeks behind will reach tip faster if it does.

Though perhaps "Stay at least 1 GiB below your RAM size" may be safer, also because of swap behaviour (see e.g. #29603 (comment))

That's barely safe without swap, Bitcoin-QT and the OS will use most of the 1 GiB offset leaving it pretty close to locking up.

Without a swap file, an offset from total ram (1-2 GiB?) may avoid OOM, but this becomes arbitrary and may limit performance if set too low. It's better users w/o swap who set it too high OOM, than to limit performance of systems w/ swap that may benefit from more.

So total memory is still the best limit, if any is enforced.

We could suggest an optimum, but without further experimentation we don't know where that is.

I've done a lot of tests on 4 GB and 8 GB RAM machines with zram swap and the -datadir on USB sticks and available_RAM - 2 GiB is about optimal for keeping those systems responsive. See this closed issue for more data: BenWestgate/Bails#41

With -dbcache=<available_RAM - 2 GiB> both 4 GB and 8 GB RAM systems can unlock the screen and manipulate the desktop without exceeding a 10 second lag, after a user locks the screen and lets Bitcoin sync several hours. With 4 GB RAM, this is approximately our default -dbcache=450 as suggested elsewhere to NOT raise it on 4 GB. If -dbcache is too high with a slow swap the machine may take minutes to respond. That's true even when the value is set lower than total or available memory. But whether that lag is undesirable or not depends on whether the user intends to use the machine or not before sync completes.

Suggesting dbcache=$(total_ram - 3650) as an optimum place to start matches what some of our devs have recommended on stack exchange.

@Sjors Sjors force-pushed the 2023/08/double-your-coins---cache branch from 2a71819 to bb3b980 Compare May 28, 2024 06:40
@Sjors
Copy link
Member Author

Sjors commented May 28, 2024

@BenWestgate thanks for the analysis. If we want to add a recommendation to the help text, I suggest we do that in another PR though. It's probably going to take multiple people doing benchmark on wildly different machines.

Checking against RAM can also be done in a followup.

I rebased and changed the .md file name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Raise maximum -dbcache setting