Author [EN] [ZH] [ES] [PT] [IT] [DE] [FR] [NL] [TR] [SR] [AR] [RU] [EN] [ZH] [ES] [PT] [IT] [DE] [FR] [NL] [TR] [SR] [AR] [RU] [EN] [ZH] [ES] [PT] [IT] [DE] [FR] [NL] [TR] [SR] [AR] [RU] Topic: Why does the bitshares_client use 10x the memory of bitcoind?  (Read 708 times)

0 Members and 1 Guest are viewing this topic.

Offline monsterer


The high memory usage is probably a huge factor in the bad performance of the bitshares client. Why does it need so much RAM compared to bitcoind?
My opinions do not represent those of metaexchange unless explicitly stated.
https://metaexchange.info | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12176
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BTS: xeroc
  • GitHub: xeroc
Re: Why does the bitshares_client use 10x the memory of bitcoind?
« Reply #1 on: May 22, 2015, 11:09:26 AM »
The high memory usage is probably a huge factor in the bad performance of the bitshares client. Why does it need so much RAM compared to bitcoind?
It uses alot more indices than bitcoind ...
Recall that the BitShares client has a BUILT-IN block explorer!
Give BitShares a try! Use the http://testnet.bitshares.eu provided by http://bitshares.eu powered by ChainSquad GmbH

Offline monsterer

Re: Why does the bitshares_client use 10x the memory of bitcoind?
« Reply #2 on: May 22, 2015, 01:16:01 PM »
It uses alot more indices than bitcoind ...
Recall that the BitShares client has a BUILT-IN block explorer!

Why do the indices need to be RAM resident?
My opinions do not represent those of metaexchange unless explicitly stated.
https://metaexchange.info | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

Offline bytemaster

Re: Why does the bitshares_client use 10x the memory of bitcoind?
« Reply #3 on: May 22, 2015, 01:18:15 PM »
It uses alot more indices than bitcoind ...
Recall that the BitShares client has a BUILT-IN block explorer!

Why do the indices need to be RAM resident?

The bottle neck for BitShares is Disk IO.   BitShares uses a lot of RAM in an attempt to minimize Disk IO.   

Bitcoin has just a few LevelDB databases, BitShares has 2 dozen.    Each LevelDB has its own cache.

This is all old news anyway, soon BitShares will be using less RAM than your web browser.
For the latest updates checkout my blog: http://bytemaster.bitshares.org
Anything said on these forums does not constitute an intent to create a legal obligation or contract between myself and anyone else.   These are merely my opinions and I reserve the right to change them at any time.

Offline monsterer

Re: Why does the bitshares_client use 10x the memory of bitcoind?
« Reply #4 on: May 22, 2015, 01:32:17 PM »
The bottle neck for BitShares is Disk IO.   BitShares uses a lot of RAM in an attempt to minimize Disk IO.   

Bitcoin has just a few LevelDB databases, BitShares has 2 dozen.    Each LevelDB has its own cache.

This is all old news anyway, soon BitShares will be using less RAM than your web browser.

That bottle neck is probably the true bottle neck only for machines which aren't forced to swap the caches out to disk due to 'lower' real RAM than your development machines.

However, I am glad to hear you're already on it :)
My opinions do not represent those of metaexchange unless explicitly stated.
https://metaexchange.info | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

Offline bytemaster

Re: Why does the bitshares_client use 10x the memory of bitcoind?
« Reply #5 on: May 22, 2015, 01:40:28 PM »
The bottle neck for BitShares is Disk IO.   BitShares uses a lot of RAM in an attempt to minimize Disk IO.   

Bitcoin has just a few LevelDB databases, BitShares has 2 dozen.    Each LevelDB has its own cache.

This is all old news anyway, soon BitShares will be using less RAM than your web browser.

That bottle neck is probably the true bottle neck only for machines which aren't forced to swap the caches out to disk due to 'lower' real RAM than your development machines.

However, I am glad to hear you're already on it :)

Even with 16 GB of RAM disk io is the bottleneck. 
For the latest updates checkout my blog: http://bytemaster.bitshares.org
Anything said on these forums does not constitute an intent to create a legal obligation or contract between myself and anyone else.   These are merely my opinions and I reserve the right to change them at any time.

Offline monsterer

Re: Why does the bitshares_client use 10x the memory of bitcoind?
« Reply #6 on: May 22, 2015, 01:47:18 PM »
Even with 16 GB of RAM disk io is the bottleneck.

My point was that with substantially less RAM than your development machines have (for example 2GB on a win7 machine), plain disk IO is unlikely to be the bottleneck... I'd expect it to be related to the swapping necessary to maintain the vast array of caches you mentioned.
My opinions do not represent those of metaexchange unless explicitly stated.
https://metaexchange.info | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

Offline testz

Re: Why does the bitshares_client use 10x the memory of bitcoind?
« Reply #7 on: May 22, 2015, 06:18:02 PM »
It uses alot more indices than bitcoind ...
Recall that the BitShares client has a BUILT-IN block explorer!

Why do the indices need to be RAM resident?

The bottle neck for BitShares is Disk IO.   BitShares uses a lot of RAM in an attempt to minimize Disk IO.   

Bitcoin has just a few LevelDB databases, BitShares has 2 dozen.    Each LevelDB has its own cache.

This is all old news anyway, soon BitShares will be using less RAM than your web browser.

Oh, no, my web browser use 7 GB of RAM, let's say that "BitShares will be using less RAM than build-in calc"  :)


Offline mangou007

Re: Why does the bitshares_client use 10x the memory of bitcoind?
« Reply #9 on: May 23, 2015, 02:26:19 PM »

This is all old news anyway, soon BitShares will be using less RAM than your web browser.

Don't know why, but I am loving to see things like that :)  +5%
BitShares French ConneXion, le portail francophone de BitShares
BitShares French ConneXion, the BitShares French gateway
www.bitsharesfcx.com

julian1

  • Guest
Re: Why does the bitshares_client use 10x the memory of bitcoind?
« Reply #10 on: May 24, 2015, 02:04:14 AM »
I'm intensely curious to know what choices have been made here. 

Possibilities I thought off include consolidating all the leveldb databases by prefixing the leveldb keys with namespaces.

Or alternatively using a memory-mapped data-structure (btree) implementation.

Offline sittingduck

  • Sr. Member
  • ****
  • Posts: 246
    • View Profile
Re: Why does the bitshares_client use 10x the memory of bitcoind?
« Reply #11 on: May 24, 2015, 03:17:04 PM »

I'm intensely curious to know what choices have been made here. 

Possibilities I thought off include consolidating all the leveldb databases by prefixing the leveldb keys with namespaces.

Or alternatively using a memory-mapped data-structure (btree) implementation.

If disk io is the issue then neither of your suggestions would work.   


Sent from my iPhone using Tapatalk

Offline bytemaster

Re: Why does the bitshares_client use 10x the memory of bitcoind?
« Reply #12 on: May 25, 2015, 12:11:55 PM »
I'm intensely curious to know what choices have been made here. 

Possibilities I thought off include consolidating all the leveldb databases by prefixing the leveldb keys with namespaces.

Or alternatively using a memory-mapped data-structure (btree) implementation.

1 massive level DB database would still have a random access pattern and make every lookup take longer (the cost per lookup grows with log(n) the number of items). 

A memory mapped btree still requires disk IO (unless it is all cached).   Representing the data in a form that is suitable for storing on disk also slows down access. 

We load everything into memory on startup and keep them in boost::multi_index_container which allow both hashed and sorted indexes on multiple fields.  So lookup is constant time and updates involve mere pointer manipulation.    It takes mere seconds to load everything from disk to memory and then to save it again.   For now we are loading and saving to/from a Level DB database, but in the future it will probably just be a set of flat files.    Depending upon the type, we can get away with a "stack" based structure in a flat file. 
For the latest updates checkout my blog: http://bytemaster.bitshares.org
Anything said on these forums does not constitute an intent to create a legal obligation or contract between myself and anyone else.   These are merely my opinions and I reserve the right to change them at any time.

Offline abit

Re: Why does the bitshares_client use 10x the memory of bitcoind?
« Reply #13 on: May 25, 2015, 02:58:44 PM »
When talking about disk IO bottleneck, we always check I and O (reads and writes) separately. We can't avoid IO, we just reduce the frequency, at lease reduce random accessing.
There are still rooms available for performance optimizing with the use of leveldb, E.G.
* The optional FilterPolicy mechanism can be used to reduce the number of disk reads substantially.
* Using less quantity of level DB's will hopefully reduce competing on writes/compacts.
* Better design of keys (of values)
* Compressing and caching

Anyway, if we've already chosen another way, please go ahead.
BTS account: abit
BTS committee member: abit
BTS witness: in.abit

Offline arubi

  • Sr. Member
  • ****
  • Posts: 209
    • View Profile
Re: Why does the bitshares_client use 10x the memory of bitcoind?
« Reply #14 on: May 25, 2015, 09:51:11 PM »
Ugh.

$ ps -xv | grep bitshares
 2797 pts/6    Sl+   18:01   4478 33385 1064798 955000 46.4 bitshares_client --server --httpport 9989


$ ps -xv | grep bitcoind
 6659 ?        Ssl  112:09   1230  4509 742338 595268 28.9 bitcoind


Both are accepting a maximum of 8 connections + both are not accepting incoming connections*
Bitshares also runs an http daemon (sure, it's technically nothing) but an extra 400~ MB in ram is acceptable (swap is set to 0 in this machine)

* - Don't worry, I have a different machine for seeding Bitcoin and Bitshares. I'm doing my part ;)

--

Oh, if you're interested what the "research" machine's stats are:

$ ps -xv | grep bitshares
 2341 pts/1    Sl+    6:02  24446 34648 2913743 1160992 14.1 bitshares_client --statistics-enabled --server --httpport 9989


$ ps -xv | grep bitcoind
11852 ?        SLsl  71:12   5032  4865 2020482 892552 10.8 bitcoind


* - This still isn't the seed machine. Both instances are full indexing nodes. Bitshares also runs the http daemon. Both are connected to 8 peers. No incoming connections.

--

Oh! I forgot to add, bitcoind listens as an RPC server in both instances.
« Last Edit: May 25, 2015, 10:17:41 PM by arubi »

 

Google+