spacemeshos / go-spacemesh

Go Implementation of the Spacemesh protocol full node. 💾⏰💪
https://spacemesh.io
MIT License
761 stars 212 forks source link

[Merged by Bors] - atx: cache poet proofs with lru #6336

Closed dshulyak closed 1 month ago

dshulyak commented 2 months ago

followup for https://github.com/spacemeshos/go-spacemesh/pull/6326

in current code poet proofs are fetched for every atx submitted to the node, they are relatively large (140KB) and account for sizeable chunk of all reads executed on the atx handler codepath (25%).

they are also a perfect case for lru caching, they are mostly reused and replaced from epoch to epoch.

basic stats in recent epochs.

select round_id, count(*), max(length(poet)) from poets group by round_id;
25|42|146200
26|45|145936
27|45|145738
28|45|145903
codecov[bot] commented 2 months ago

Codecov Report

Attention: Patch coverage is 72.50000% with 11 lines in your changes missing coverage. Please review.

Project coverage is 81.7%. Comparing base (87893ee) to head (d71bc8d). Report is 2 commits behind head on develop.

Files with missing lines Patch % Lines
activation/poetdb.go 66.6% 10 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #6336 +/- ## ========================================= - Coverage 81.8% 81.7% -0.1% ========================================= Files 312 312 Lines 34606 34637 +31 ========================================= + Hits 28314 28328 +14 - Misses 4461 4472 +11 - Partials 1831 1837 +6 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

dshulyak commented 2 months ago

@poszu updated with singleflight just in case, could you please check again?

dshulyak commented 2 months ago

bors try

spacemesh-bors[bot] commented 2 months ago

try

Build failed:

dshulyak commented 1 month ago

bors merge

spacemesh-bors[bot] commented 1 month ago

Pull request successfully merged into develop.

Build succeeded: