ethereum / aleth

Aleth – Ethereum C++ client, tools and libraries
GNU General Public License v3.0
3.97k stars 2.17k forks source link

LevelDb performance #5630

Open xingkong2014 opened 5 years ago

xingkong2014 commented 5 years ago

dev::GenericTrieDB::at(bytesConstRef _key) queries data in leveldb serveral times, which often takes millionseconds. But sometime it runs so slowly and takes more than 1 second. As a result, BlockChain::sync() may imports a block for more than 20s. So the sync process can not catch up. Then I tried to upgrade LevelDB to v1.22, but it failed to query data in old data. I think there is a problem with compatibility.

chfast commented 5 years ago

On what operating system? We have upgraded to leveldb 1.22 anyway, but the performance has decreased slightly in blockchain tests. Not sure about mainnet sync.

xingkong2014 commented 5 years ago

windows server 2019 We use aleth v1.6 in production environment. We found that in most of time, a block would be imported within 10 seconds. But sometimes it took more than 20s, even 100s. It seemed like that the query process was not stable.

Some logs : ... 1 blocks imported in 34490 ms (0.0289933 blocks/s) in #7974684 ... 1 blocks imported in 25216 ms (0.039656 blocks/s) in #7974716

chfast commented 5 years ago

So this change upgrades leveldb on Windows as well: https://github.com/ethereum/aleth/pull/5532 what makes it incompatible with old databases.

In terms of performance, that is not a big surprise to me as we have not spent any time recently on optimizing the blockchain sync. I don't thinks there is anything we can do about it, unless you have more precise suggestions what to change.

xingkong2014 commented 5 years ago

Got it, thank you.