Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: Bernard Lerring on June 20, 2014, 09:26:08 AM



Title: bitcoin core uses a lot of RAM. Recommended amount?
Post by: Bernard Lerring on June 20, 2014, 09:26:08 AM
I've been using bitcoin core v0.9.2 for a week or so to help out with the network.

I'm happy to have it running in the background 24/7 because I want BTC to succeed and I'm doing my bit for stability of the network.

The trouble is, I'm using a fairly decent HTPC (6400K CPU, SSD, 4GB 1600MHz RAM in dual channel) but bitcoin-qt is eating my memory. I'm on Ubuntu Trusty and the system monitor shows bitcoin-qt to be using between 600 and 700+ MB of RAM!

If I've got a couple of browsers open and watching a video file this doesn't leave me with a great deal of RAM. The 6400K APU already allocates about 1GB to video performance so I'm left with about 3GB usable and Ubuntu only has about 25% left to spare.

Should I buy an 8GB RAM pair and swap the 4GB pair out? Will bitcoin-qt continue to use more RAM as the size of the blockchain increases and network activity becomes more common?


Title: Re: bitcoin core uses a lot of RAM. Recommended amount?
Post by: Bernard Lerring on June 20, 2014, 03:02:23 PM
So, anyone using bitcoin core with only 4gb RAM? If I limit my incoming or outgoing connections will my node use less RAM?



Title: Re: bitcoin core uses a lot of RAM. Recommended amount?
Post by: rapsaodan84 on June 20, 2014, 03:04:27 PM
Are you sure it's the bitcoin core which is using all that RAM?

I know full nodes run with 1GB of RAM on a headless Linux VM.


Title: Re: bitcoin core uses a lot of RAM. Recommended amount?
Post by: Bernard Lerring on June 20, 2014, 03:11:03 PM
Yeah, I'm sure because I've checked in Ubuntu system monitor.

I might run the non GUI client instead, to see if it makes a difference.



Title: Re: bitcoin core uses a lot of RAM. Recommended amount?
Post by: DeathAndTaxes on June 20, 2014, 03:37:55 PM
A bitcoin client is a database; blocks, transactions, keys, and outputs all need to be queried to make everything work behind the scenes.  Reading from disk is horribly slow compared to main memory.  A joke among db administrators is the proper amount of memory for a database server is ... more.

700MB seems unusually high once the client is up to date.  With default options I usually see about 250MB to 300MB.  There isn't a significant difference between the memory useage of bitcoind and bitcoin-qt so I doubt that is the issue.  Is the wallet particularly large (in terms of # of addresses and transactions)?  That probably makes a significant difference.

You have a couple of options.
1) I would check your bios.  If you are just watching videos or playing casual games I doubt you need 1GB of video RAM.  There may be an option to reduce that.

2) By default both bitcoin-qt and bitcoind devote 100MB to a db cache.  This can be adjusted from 4MB to 4096MB with the command line argument -dbcache=<n> where n is the size of the cache in MBs.  You can also put it in the bitcoin.conf file.  WARNING:  I have only ever increased it, never reduced it below the default 100MB.

3) Personally I would double the RAM on the system.  RAM is dirt cheap.  Maybe this is just the db admin in me talking but I have heard anyone complaining about having too much RAM.  CPU is rarely the bottleneck for most processes these days.


Title: Re: bitcoin core uses a lot of RAM. Recommended amount?
Post by: Bernard Lerring on June 20, 2014, 07:09:57 PM
I'm using an AMD APU, DeathAndTaxes, without a dedicated graphics card. It automatically assigns a portion of RAM as video memory. They're designed to have faster graphics depending on the speed of your main memory.

I'll check out your other points tomorrow when I'm home as I'm posting from my phone right now.

I've been hankering for 8gb RAM for a while now and this might sway it.

Oh, and I haven't made a single transaction with bitcoin core. I'm just running it as a node. I load up electrum if I need to make a transaction.



Title: Re: bitcoin core uses a lot of RAM. Recommended amount?
Post by: DeathAndTaxes on June 20, 2014, 07:16:51 PM
I'm using an AMD APU, DeathAndTaxes, without a dedicated graphics card. It automatically assigns a portion of RAM as video memory. They're designed to have faster graphics depending on the speed of your main memory.

I understood that, I believe that the amount reserved is adjustable in the bios or at least it is on most systems.  If you can get by with reserving 256MB or 512MB for the GPU then reserving more is just wasting RAM.


Title: Re: bitcoin core uses a lot of RAM. Recommended amount?
Post by: cooldgamer on June 20, 2014, 08:05:06 PM
BTC wallets tend to take up a ton of RAM (except for lite ones).  Armory once took up a whole 3 gigs and tried to keep eating more before it froze.  Upgrading will make your life so much easier.  As others have said, you can probably get a little more performance by adjusting the video memory.


Title: Re: bitcoin core uses a lot of RAM. Recommended amount?
Post by: shorena on June 20, 2014, 08:25:49 PM
BTC wallets tend to take up a ton of RAM (except for lite ones).  Armory once took up a whole 3 gigs and tried to keep eating more before it froze.  Upgrading will make your life so much easier.  As others have said, you can probably get a little more performance by adjusting the video memory.

Idk, bitcoin core 0.9.2 is using ~220 MB currently. Thats less than my browsers (~300 MB [FF] and ~260 MB [Chrome]).
electrum uses ~23MB
multibit ~80 MB (mostly java)
multidoge ~70 MB (mostly java)

bitcoin core (0.9.1. IIRC) also runs fine on an old machine with 2 Gigs.

This should be no problem.

Id try down-/upgrading to 0.9.1 / 0.9.2.1. and see if anything changes.


Title: Re: bitcoin core uses a lot of RAM. Recommended amount?
Post by: dserrano5 on June 20, 2014, 09:55:36 PM
My 24/7 node is stable around 600 Mb.


Title: Re: bitcoin core uses a lot of RAM. Recommended amount?
Post by: ranochigo on June 22, 2014, 04:02:34 AM
If you want to let more people connect to your node, try to get at least 1Gb of ram if not use swap to increase your ram. Mine can let 80 people to connect to my node with 2gb of ram.


Title: Re: bitcoin core uses a lot of RAM. Recommended amount?
Post by: Bernard Lerring on June 22, 2014, 09:27:20 AM
Last night I bought 8gb dual-channel Corsair Vengeance RAM from eBay, so I can't wait for that to turn up in the next couple of days.  :D

I want to try running the headless version in the meantime and check out how much it uses compared to QT, but I'm a bit of a noob.

How do I execute the headless version. Is it bitcoind?

When I try running bitcoind in the terminal it runs for 30 seconds and then terminates with the following message:

It is recommended you use the following random password:
rpcuser=bitcoinrpc
rpcpassword=65cBHynVPD1Ffod8JPtMvw6eMuEsq1ASDNEYLQL1i2Ya
(you do not need to remember this password)
The username and password MUST NOT be the same.
If the file does not exist, create it with owner-readable-only file permissions.
It is also recommended to set alertnotify so you are notified of problems;
for example: alertnotify=echo %s | mail -s "Bitcoin Alert" admin@foo.com

Do I need to edit a configuration file to keep it running?


Title: Re: bitcoin core uses a lot of RAM. Recommended amount?
Post by: ranochigo on June 22, 2014, 09:52:29 AM
Last night I bought 8gb dual-channel Corsair Vengeance RAM from eBay, so I can't wait for that to turn up in the next couple of days.  :D

I want to try running the headless version in the meantime and check out how much it uses compared to QT, but I'm a bit of a noob.

How do I execute the headless version. Is it bitcoind?

When I try running bitcoind in the terminal it runs for 30 seconds and then terminates with the following message:

It is recommended you use the following random password:
rpcuser=bitcoinrpc
rpcpassword=65cBHynVPD1Ffod8JPtMvw6eMuEsq1ASDNEYLQL1i2Ya
(you do not need to remember this password)
The username and password MUST NOT be the same.
If the file does not exist, create it with owner-readable-only file permissions.
It is also recommended to set alertnotify so you are notified of problems;
for example: alertnotify=echo %s | mail -s "Bitcoin Alert" admin@foo.com

Do I need to edit a configuration file to keep it running?
This is what I used to make a BTC node. http://pastebin.com/qbmSNhWK You need to make a configuration file.


Title: Re: bitcoin core uses a lot of RAM. Recommended amount?
Post by: Bernard Lerring on June 22, 2014, 10:06:39 AM
Thanks,

I've copied and pasted the sample bitcoin.conf file from here:

https://en.bitcoin.it/wiki/Running_Bitcoin#Bitcoin.conf_Configuration_File

It still terminates but I haven't changed any values in .conf yet.

I've got to go out now but will have a look later.


Title: Re: bitcoin core uses a lot of RAM. Recommended amount?
Post by: tsoPANos on June 22, 2014, 10:46:46 AM
So, anyone using bitcoin core with only 4gb RAM? If I limit my incoming or outgoing connections will my node use less RAM?



Well I have been using bitcoin core since I came into bitcoin last August and I have only 2gb of rab!


Title: Re: bitcoin core uses a lot of RAM. Recommended amount?
Post by: zvs on June 22, 2014, 03:00:43 PM
Here's my bitcoind, I restarted it not too long ago:

15194 zevus      20   0 2740M 1513M  4992 S 21.9  4.7  2h08:28 bitcoind
15195 zevus      20   0 2740M 1513M  4992 S  0.0  4.7  0:02.46 bitcoind
15196 zevus      20   0 2740M 1513M  4992 S  0.0  4.7  0:00.33 bitcoind
15197 zevus      20   0 2740M 1513M  4992 S  0.0  4.7  0:00.32 bitcoind
15198 zevus      20   0 2740M 1513M  4992 S  0.0  4.7  0:00.32 bitcoind
15199 zevus      20   0 2740M 1513M  4992 S  0.0  4.7  0:00.31 bitcoind
15200 zevus      20   0 2740M 1513M  4992 S  0.0  4.7  0:00.34 bitcoind
15201 zevus      20   0 2740M 1513M  4992 S  0.0  4.7  0:00.32 bitcoind
15202 zevus      20   0 2740M 1513M  4992 S  0.0  4.7  0:00.33 bitcoind
15211 zevus      20   0 2740M 1513M  4992 S 12.0  4.7  1h12:37 bitcoind
15212 zevus      20   0 2740M 1513M  4992 S  0.0  4.7  0:01.62 bitcoind
15213 zevus      20   0 2740M 1513M  4992 S  0.0  4.7  0:00.85 bitcoind
15214 zevus      20   0 2740M 1513M  4992 S 10.0  4.7 55:37.93 bitcoind
15215 zevus      20   0 2740M 1513M  4992 S  0.0  4.7  0:00.22 bitcoind
15216 zevus      20   0 2740M 1513M  4992 S  0.0  4.7  0:00.01 bitcoind
15217 zevus      20   0 2740M 1513M  4992 S  0.0  4.7  0:00.00 bitcoind
15218 zevus      20   0 2740M 1513M  4992 S  0.0  4.7  0:00.00 bitcoind
15219 zevus      20   0 2740M 1513M  4992 S  0.0  4.7  0:00.00 bitcoind

Essentially the base client with a few network optimizations (re: how it used to get the vast majority of the transactions and blocks on blockchain.info).

Since I restarted it not too long ago it only has abt 600 connections now.  It usually maxes out at around 2GB of active memory ~750 connections or so.  I have it set to a max of 1000 but I haven't seen it over 750 in quite a while... obv varies a bit with the # of transactions in memory...

ed: oh, wallet is disabled, & a few other changes, like significantly less stored addresses etc.


Title: Re: bitcoin core uses a lot of RAM. Recommended amount?
Post by: Bernard Lerring on June 23, 2014, 03:13:44 PM
I've got bitcoind running by using the suggested username and randomly generated password it gives you, by inserting them into a bitcoind.conf file.

It's currently using about 850MB RAM and the CPU is idling, after it used a lot of CPU for a minute or two. I assume that was when it was updating what I've missed in the blockchain over the last couple of days.

How can I now check that it's running OK: i.e. that I'm connected to nodes and I have incoming and outgoing traffic?

It's easy to see in bitcoin-qt but as bitcoind is headless I'm not sure if it's actually working as a node.


Title: Re: bitcoin core uses a lot of RAM. Recommended amount?
Post by: dserrano5 on June 23, 2014, 03:32:01 PM
How can I now check that it's running OK: i.e. that I'm connected to nodes and I have incoming and outgoing traffic?

If you're running < 0.9: bitcoind getinfo
If < 0.9.2: bitcoin-cli getinfo
If >= 0.9.2: bitcoin-cli getnetworkinfo

That doesn't show traffic, though. There are other tools you can use for that.


Title: Re: bitcoin core uses a lot of RAM. Recommended amount?
Post by: rapsaodan84 on June 23, 2014, 03:34:41 PM
Bernard, maybe you'll be interested in this:

https://bitcointalk.org/index.php?topic=582817.0


Title: Re: bitcoin core uses a lot of RAM. Recommended amount?
Post by: Bernard Lerring on June 23, 2014, 03:40:33 PM
Cheers,

Just tried it and connections=6 after startup, then increased to 8 moments after. That means I've got a two-way node running, right?


Title: Re: bitcoin core uses a lot of RAM. Recommended amount?
Post by: DeathAndTaxes on June 23, 2014, 04:58:07 PM
Cheers,

Just tried it and connections=6 after startup, then increased to 8 moments after. That means I've got a two-way node running, right?

Not necessarily.  All nodes will attempt to establish 8 outbound connections (but no more).  So 8 connections could just indicate all of your connections are outbound.  9+ would indicate at least one inbound connection.


Title: Re: bitcoin core uses a lot of RAM. Recommended amount?
Post by: Bernard Lerring on June 23, 2014, 05:58:13 PM
Ah, that's good to know.

I'd already allowed ufw through port 8333 but hadn't forwarded the port in my router. I've done that now and currently have 11 connections, so I must be running in full node mode.  :)


Title: Re: bitcoin core uses a lot of RAM. Recommended amount?
Post by: DeathAndTaxes on June 23, 2014, 07:10:21 PM
Ah, that's good to know.

I'd already allowed ufw through port 8333 but hadn't forwarded the port in my router. I've done that now and currently have 11 connections, so I must be running in full node mode.  :)

That would be correct.   One thing I would add is you can limit the number of connections ( maxconnections=n in either the config file or on command line).  The default is 125.  Understand however you can only set a limit, the number of peers that actually connect to you will vary depending on how many peers need outgoing connections, how many addressable peers exist, and how reliable other peers see you (in terms of uptime).  It is very likely that you will not reach the max connections but that is actually a good thing, it means there is "spare capacity" for outbound only nodes.


Title: Re: bitcoin core uses a lot of RAM. Recommended amount?
Post by: leechenlua on June 30, 2014, 06:12:52 AM
good jod
tks