status-im / nimbus-eth1

Nimbus: an Ethereum Execution Client for Resource-Restricted Devices
https://status-im.github.io/nimbus-eth1/
Apache License 2.0
562 stars 106 forks source link

Add ContentCache for each portal subprotocol (Portal wire protocol) #2186

Open kdeme opened 1 month ago

kdeme commented 1 month ago

Probably each subnetwork would benefit from having a content cache. This means caching the most recently requested content items, even when they are not supposed to be stored by that node.

The first network to apply it on would be history network. There should be a flag to be able to disable/enable it.

Perhaps LRU (https://github.com/status-im/nim-eth/blob/master/eth/p2p/discoveryv5/lru.nim) can be used for it as cache.

web3-developer commented 1 week ago

I see this task as relatively low priority because the database already stores a copy of the content as long as it is within the data radius.

The benefits of this in memory cache are that we can cache recent requests even if the content is outside our data radius and being in memory performance would be improved.