ChainSafe / ChainSafe/forest

Reduce tipset cache size

Open
#3,760 0 comments 0 reactions 0 assignees View on GitHub
Priority: 4 - Low Type: Enhancement
Dominant language
Rust
Stars
697
Forks
200
Avg merge
1d 5h
Merged PRs (30d)
65

Description

**Issue summary**

https://github.com/ChainSafe/forest/pull/3751 introduced a significantly larger cache to cope with performance issues for specific messages. This adds up to 1 GB overhead to Forest runtime, even though such a large cache is seldom required. Lotus is using[ 8k cache](https://github.com/filecoin-project/lotus/blob/7e6b20cd97b925f4ec76463f27adbb503054734d/chain/store/store.go#L48) so we could possibly take some inspiration from their code or figure out a better way.

Using an Adaptive Replacement Cache doesn't help in this case.

The original issue could be reproduced with `forest-tool snapshot compute-state --epoch 3416862 forest_snapshot_mainnet_2023-11-24_height_3416863.forest.car.zst` and [this snapshot](https://forest-archive.chainsafe.dev/mainnet/debug/forest_snapshot_mainnet_2023-11-24_height_3416863.forest.car.zst).

Acceptance criteria - the aforementioned command finishes in few seconds but the cache size is significantly smaller (ideally not bigger than before).

**Other information and links**

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.