Cache the Bitcoin Datadir to Improve Performance? Increase Bitcoin DB Cache Size?

6

Bitcoin is very disk intense and that slows it down. It seems to flush data to disk often thus preventing proper caching. With the datadir on a RAMdisk it is much faster.

Is it possible to increase the db cache size (http://doc.gnu-darwin.org/am_conf/cachesize.html) or do something else to improve cache performance.

Of course it would be nice to keep the wallet and important data save but I would not mind the blockchain to be heavily cached.

edit: I'm asking mainly about Windows OS.

kermit

Posted 2012-02-22T17:57:17.623

Reputation: 1 839

It's not really clear what you're asking. Very disk intensive when? During startup? When downloading the block chain? When processing GUI requests? The OS should already be caching all disk data that it can fit in memory anyway.David Schwartz 2012-02-23T10:32:10.000

A getnewaddress took 20 secs or so... I reduced virtual memory and changed the cache settings to "server" - not sure if it did anything but it is much faster now. Will close the question.kermit 2012-02-24T19:32:45.223

1That was likely because you have it set to create several hundred addresses when it runs out. It didn't take as long after that because it was giving you the addresses it had pre-generated.David Schwartz 2012-02-24T22:42:07.723

Hmm I tested it at least five times and it always took so long.kermit 2012-03-08T16:29:18.503

Answers

6

The very recently released bitcoin v0.6.0 has modified bdb cache settings (25 megabytes by default), and provides a way to change this via the command-line option -dbcache=N, with N a number in megabytes.

This change caused a very significant speedup for synchronizing the block chain indeed.

Pieter Wuille

Posted 2012-02-22T17:57:17.623

Reputation: 54 032

2

Bitcoin (through BerkleyDB) frequently flushes writes to disc to main transaction integrity in wallet.dat and the blockchain databases. The operating system can cache the entire blockchain normally,

I have restarted Bitcoin several times and had it start instantly because the entire blockchain is already cached by the OS.

Diablo-D3

Posted 2012-02-22T17:57:17.623

Reputation: 403

0

for the record:

file DB_CONFIG:
set_lg_dir database
set_lk_max_locks 120000
set_cachesize 2 524288000 1

--> 2.5GB cache

http://docs.oracle.com/cd/E17076_02/html/api_reference/C/set_cachesize_parameter.html

For versions higher v0.6 Pieter's way sure is better. This still could be useful for older versions.

Unfortunately I can't get it to work with Namecoin 3.50

kermit

Posted 2012-02-22T17:57:17.623

Reputation: 1 839