You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add lru cache for loading commit from blockstore #2844
Whenever a peer is lagging by more than 1 block, we load the commit for the height they were on and send them the whole commit (per code comment. Admittedly I haven't looked long, but I don't see how it's currently sending the whole commit vs just a single vote from it). Source
Loading the commit requires doing a db read and a proto unmarshal. Source In benchmarks we see the proto unmarshal taking a large number of heap allocations, and this is likely duplicate work. (Unmarshalling the same block commit)
We should keep a small LRU cache for height to unmarshalled commit to reduce the memory pressure here. I suspect the same maybe helpful for block parts as well.
In v37 we saw that this was around 70GB of heap allocation on a query serving node over 1-2 hours. (Will paste memprofile later)
I do not know the total system impact it has, but a 70GB ram allocation is very high.
Proposal
Add a simple lru cache in blockstore for loading commit and block parts
The gossipDataRoutine was recently refactored (#2663).
We load block parts here. If the peer is still lagging behind in the next iteration, we load another block part. Although block parts are not stored together, so we have to load them one by one (source).
Activity
cason commentedon Apr 18, 2024
Definitely. This LRU cache can be implemented at the store, in my opinion, so no need for code changes in the reactor.
cason commentedon Apr 18, 2024
The
gossipDataRoutinewas recently refactored (#2663).We load block parts here. If the peer is still lagging behind in the next iteration, we load another block part. Although block parts are not stored together, so we have to load them one by one (source).
perf(blockstore): Add LRU caches to blockstore operations used in con…
perf(blockstore): Add LRU caches to blockstore operations used in con…
perf(blockstore): Add LRU caches to blockstore operations used in con…
perf(blockstore): Add LRU caches to blockstore operations used in con…
perf(blockstore): Add LRU caches to blockstore operations used in con…
perf(blockstore): Add LRU caches to blockstore operations used in con…
perf(blockstore): Add LRU caches to blockstore operations used in con…
perf(blockstore): Add LRU caches to blockstore operations used in con…
perf(blockstore): Add LRU caches to blockstore operations used in con…
perf(blockstore): Add LRU caches to blockstore operations used in con…