Realistic maximum size of merkle trie #1898
-
So I'm planning to use the My question is if there are any limitations other than memory usage, like reaching N records or X size and the mutations then becoming slow even if they haven't been committed yet. I also assume that copying the root from one tree to another will require available memory in the size of the root? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
I'm not entirely sure if I understand the question but this might help: The tree will get slower and slower over time once the tree gets bigger. The reason for this is that on an empty trie, you can immediately write a key/value. This only hits the disk once. However, if the tree grows bigger, then more disk reads/writes have to be done. Assuming you are using 32 bytes for keys, the max depth of the tree will be 64, so this means that once you are writing these accounts, then the disk has to be read/written 64 times. If you have two trees with a different root, and the MPT points to the same DB, then "copying" the root from one tree to the other is a single operation: you can immediately switch to the other database by just setting the root. So this does not need much memory at all. You might want to give this a read to get a deeper technical understanding: https://eth.wiki/fundamentals/patricia-tree |
Beta Was this translation helpful? Give feedback.
I'm not entirely sure if I understand the question but this might help:
The tree will get slower and slower over time once the tree gets bigger. The reason for this is that on an empty trie, you can immediately write a key/value. This only hits the disk once. However, if the tree grows bigger, then more disk reads/writes have to be done. Assuming you are using 32 bytes for keys, the max depth of the tree will be 64, so this means that once you are writing these accounts, then the disk has to be read/written 64 times.
If you have two trees with a different root, and the MPT points to the same DB, then "copying" the root from one tree to the other is a single operation: you can immediately …