Bitcoin Forum
December 07, 2016, 12:36:22 PM *
News: Latest stable version of Bitcoin Core: 0.13.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Lots of disk activity on Bitcoin startup: easy fix?  (Read 2114 times)
patvarilly
Guest

July 06, 2011, 06:40:48 AM
 #1

For a few days now, I've noticed that every time I start the Bitcoin client, it goes nuts on disk usage for about 5 minutes and then quiets down.  I finally got curious enough to find out what was going on, and it turns out that I get a large burst of disk activity every time a line "AddAddress(...)" appears in debug.log.  Tracking this down, it seems to boil down to this offending line in net.cpp:

429: bool AddAddress(CAddress addr, int64 nTimePenalty)
430: {
...
444:              CAddrDB().WriteAddress(addr);
...
470: }

So what's going on is that every time there's a new address, the address database is opened, a new record is stored, and then the database is closed (and presumably flushed to disk).  This last part is what I think is driving BDB nuts writing stuff out.

Would it be too hard to keep a single CAddrDB object floating around (maybe lock it with a CRITICAL_SECTION), open it once on startup and close it once on shutdown?  Addresses are volatile information that doesn't need to be stored *right this minute* or bitcoin will fail.  They can be recreated by polling peers if need be after a crash.  The code should reflect this lack of urgency to store addresses, and doing so will substantially reduce the disk usage on Bitcoin startup.
1481114182
Hero Member
*
Offline Offline

Posts: 1481114182

View Profile Personal Message (Offline)

Ignore
1481114182
Reply with quote  #2

1481114182
Report to moderator
1481114182
Hero Member
*
Offline Offline

Posts: 1481114182

View Profile Personal Message (Offline)

Ignore
1481114182
Reply with quote  #2

1481114182
Report to moderator
"This isn't the kind of software where we can leave so many unresolved bugs that we need a tracker for them." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
Mike Hearn
Legendary
*
expert
Offline Offline

Activity: 1526


View Profile
July 06, 2011, 08:59:38 AM
 #2

You're right, patches would be welcome. Also see the bitcoin-development mailing list.
patvarilly
Guest

July 06, 2011, 04:13:54 PM
 #3

You're right, patches would be welcome. Also see the bitcoin-development mailing list.

Thanks for the heads up about the mailing list.  I'll try to put a patch together soon.
BombaUcigasa
Legendary
*
Offline Offline

Activity: 1414



View Profile
July 09, 2011, 12:12:19 PM
 #4

Please also consider the file fragmentation isssue. A brand new blockchain database will split in over 15000 fragments all over the disk.
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!