celestiaorg / celestiaorg/celestia-node

feat(share/eds/accessor_cache): rate limit cache rotation.

Open
#2,606 2 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
996
Forks
1.1k
Avg merge
1d 6h
Merged PRs (30d)
34

Description

### Implementation ideas

eds accessor cache is limited in size by 128 items. Based on observations of BN, evection rate from cache could be quite high:
image

Such high rate of cache eviction causes several issues:
- If accessor is evicted while it is being read, it causes panic in dagstore (should be fixed by latest dagstore update)
- (after update) If accessor is evicted while it is being read, it will result in read error and will not serve requested data
- high cache rotation, means there is very little benefit of having cache at all, since accessors are recreated very often.
- if there there are more unique headers are sampled from node, then cache size, it could cause to server unable to serve any data. Cache will be rotated by evictions, while also failing requests.

Solutions:
- Fast: disable cache. It will prevent concurrent close from eviction on opened accessor while it is being read. But will remove any boost from cache
- Harder: introduce cache rotation rate limit. There should be timed budget (evictions/sec), that will rotate the cache if budget is > 0. When budget is used, it prevents storing to cache until budget is reset.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.