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.
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
CONTRIBUTING.md
.