Skip to content

Don't use -dbcache for BDB anymore #2422

Merged
merged 1 commit into from Mar 31, 2013

7 participants

@sipa
Bitcoin member
sipa commented Mar 29, 2013

-dbcache was originally used to set the maximum buffer size in the BDB environment, and was later changed to set the chainstate cache and leveldb caches. No need to use it for BDB now that only the wallet remains there.

This should reduce memory allocation (but not necessarily memory usage) a bit, especially when -dbcache is set high.

@sipa sipa Don't use -dbcache for BDB anymore
-dbcache was originally used to set the maximum buffer size in the
BDB environment, and was later changed to set the chainstate cache
and leveldb caches. No need to use it for BDB now that only the
wallet remains there.

This should reduce memory allocation (but not necessarily memory
usage) a bit.
2e3c76b
@jgarzik
Bitcoin member
jgarzik commented Mar 29, 2013

Does init.cpp want updating, too?

@sipa
Bitcoin member
sipa commented Mar 29, 2013

@jgarzik Not that know of?

@gavinandresen
Bitcoin member

ACK

@Diapolo
Diapolo commented Mar 29, 2013

Perhaps @jgarzik was talking about the help message?
Set database cache size in megabytes (default: 25)

@sipa
Bitcoin member
sipa commented Mar 29, 2013

@Diapolo @jgarzik -dbcache is still the intended database cache, but we shouldn't use that number both for the coincache/leveldb AND bdb.

@rebroad rebroad commented on the diff Mar 30, 2013
src/db.cpp
dbenv.set_lg_dir(pathLogDir.string().c_str());
- dbenv.set_cachesize(nDbCache / 1024, (nDbCache % 1024)*1048576, 1);
- dbenv.set_lg_bsize(1048576);
- dbenv.set_lg_max(10485760);
+ dbenv.set_cachesize(0, 0x100000, 1); // 1 MiB should be enough for just the wallet
@rebroad
rebroad added a note Mar 30, 2013

When would 1MB not be sufficient?

@sipa
Bitcoin member
sipa added a note Mar 30, 2013

The wallet is always loaded entirely into RAM anyway, and only modified in small incremental ways, so a large cache shouldn't ever be needed. However, when BDB was still used for the block chain database, we did require large caches to speed up prevout lookups during block validation. That part is now in LevelDB anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@TheBlueMatt

ACK

@BitcoinPullTester

Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/2e3c76bf9857f5ac2814df9fd6b9b5b7a7eff88a for binaries and test log.
This is an automated test script which runs test cases on each commit every time is updated.
It, however, dies sometimes and fails to test properly, if you are waiting on a test, please check timestamps and if the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/
and contact BlueMatt on freenode if something looks broken.

@jgarzik
Bitcoin member
jgarzik commented Mar 31, 2013

ACK

@sipa sipa merged commit 767fe14 into bitcoin:master Mar 31, 2013
@sipa sipa referenced this pull request Apr 2, 2013
Merged

Limited mapAlreadyAskedFor #2423

@sipa sipa deleted the sipa:nowalcache branch May 3, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.