perf: Implemented custom storage for transactions hashes#5405
Merged
dima74 merged 2 commits intohyperledger-iroha:mainfrom May 7, 2025
Merged
Conversation
s8sato
approved these changes
Apr 30, 2025
0x009922
reviewed
May 1, 2025
0x009922
approved these changes
May 1, 2025
ecfad69 to
b303692
Compare
0x009922
approved these changes
May 7, 2025
Expected ~3x improvement of Iroha memory usage Signed-off-by: Dmitry Murzin <diralik@yandex.ru>
Signed-off-by: Dmitry Murzin <diralik@yandex.ru>
b303692 to
30c67b0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
This PR reduces memory usage of Iroha ~3 times.
(numbers for "bytes per transaction" correspond only to transaction hashes map, without actual transaction details; numbers for "after 10 million transactions" correspond to total Iroha memory usage)
Related: #5083 (comment)
Related: #5378 (comment)
Solution
Implement custom version of storage for
State::transactionsmap. It uses concurrent map fromdashmapcrate to implement memory efficient storage for transaction hashes.Review notes
This PR can be divided into two parts
transactionsfield fromStateTransaction, since it is not used there and implementation will be simpler without it.crates/iroha_core/src/state/storage_transactions.rsChecklist
CONTRIBUTING.md.