hyperledger-iroha / iroha

Iroha - A simple, enterprise-grade decentralized ledger
https://wiki.hyperledger.org/display/iroha
Apache License 2.0
438 stars 280 forks source link

perf: Make kura drop old blocks from memory #5103

Closed dima74 closed 4 weeks ago

dima74 commented 1 month ago

Context

Meta: #5083 Fixes #4954

Solution

Currently kura stores all blocks in memory, which results in memory usage approximately 1.6KB per transaction, or 1.6GB per 1 million transactions. This PR changes to store only N last blocks in memory (128 by default). Other blocks will be loaded from the disk if needed. This improves memory usage to approximately 280 bytes per transaction or 0.26GB per 1 million transactions. Note that memory usage is still unbounded because of State::transactions map.

Checklist

SamHSmith commented 4 weeks ago

I broke DCO by pushing the rebase button. Please rebase locally and then force push so that we can merge.